Commit 5db8d2f4 authored by Alexandre Julliard's avatar Alexandre Julliard

Make WIN_WindowFromPoint take a POINT instead of a POINT16.

Small bug fix in scope window handling. Always check for message when QS_SENDMESSAGE is set.
parent 30975c0c
...@@ -38,7 +38,7 @@ extern LONG WINPOS_SendNCCalcSize(HWND hwnd, BOOL calcValidRect, ...@@ -38,7 +38,7 @@ extern LONG WINPOS_SendNCCalcSize(HWND hwnd, BOOL calcValidRect,
RECT *newClientRect ); RECT *newClientRect );
extern LONG WINPOS_HandleWindowPosChanging16(struct tagWND *wndPtr, struct tagWINDOWPOS16 *winpos); extern LONG WINPOS_HandleWindowPosChanging16(struct tagWND *wndPtr, struct tagWINDOWPOS16 *winpos);
extern LONG WINPOS_HandleWindowPosChanging(struct tagWND *wndPtr, WINDOWPOS *winpos); extern LONG WINPOS_HandleWindowPosChanging(struct tagWND *wndPtr, WINDOWPOS *winpos);
extern INT16 WINPOS_WindowFromPoint( struct tagWND* scopeWnd, POINT16 pt, struct tagWND **ppWnd ); extern INT16 WINPOS_WindowFromPoint( struct tagWND* scopeWnd, POINT pt, struct tagWND **ppWnd );
extern void WINPOS_CheckInternalPos( struct tagWND* wndPtr ); extern void WINPOS_CheckInternalPos( struct tagWND* wndPtr );
extern BOOL WINPOS_ActivateOtherWindow(struct tagWND* pWnd); extern BOOL WINPOS_ActivateOtherWindow(struct tagWND* pWnd);
extern BOOL WINPOS_CreateInternalPosAtom(void); extern BOOL WINPOS_CreateInternalPosAtom(void);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "message.h" #include "message.h"
#include "winerror.h" #include "winerror.h"
#include "server.h" #include "server.h"
...@@ -26,9 +27,7 @@ ...@@ -26,9 +27,7 @@
#include "user.h" #include "user.h"
#include "thread.h" #include "thread.h"
#include "task.h" #include "task.h"
#include "options.h"
#include "controls.h" #include "controls.h"
#include "struct32.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(msg); DEFAULT_DEBUG_CHANNEL(msg);
...@@ -114,7 +113,7 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last, ...@@ -114,7 +113,7 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
HWND hWnd; HWND hWnd;
INT16 ht, hittest; INT16 ht, hittest;
UINT message = msg->message; UINT message = msg->message;
POINT16 pt; POINT pt = msg->pt;
HANDLE16 hQ = GetFastQueue16(); HANDLE16 hQ = GetFastQueue16();
MESSAGEQUEUE *queue = QUEUE_Lock(hQ); MESSAGEQUEUE *queue = QUEUE_Lock(hQ);
int mouseClick = ((message == WM_LBUTTONDOWN) || int mouseClick = ((message == WM_LBUTTONDOWN) ||
...@@ -124,8 +123,6 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last, ...@@ -124,8 +123,6 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
/* Find the window to dispatch this mouse message to */ /* Find the window to dispatch this mouse message to */
CONV_POINT32TO16( &msg->pt, &pt );
hWnd = GetCapture(); hWnd = GetCapture();
/* If no capture HWND, find window which contains the mouse position. /* If no capture HWND, find window which contains the mouse position.
...@@ -194,7 +191,7 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last, ...@@ -194,7 +191,7 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
} }
} }
/* save mouse position */ /* save mouse position */
CONV_POINT16TO32( &pt, screen_pt ); *screen_pt = pt;
if (hittest != HTCLIENT) if (hittest != HTCLIENT)
{ {
...@@ -202,7 +199,7 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last, ...@@ -202,7 +199,7 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
msg->wParam = hittest; msg->wParam = hittest;
} }
else else
ScreenToClient16( hWnd, &pt ); ScreenToClient( hWnd, &pt );
/* check message filter */ /* check message filter */
...@@ -604,8 +601,7 @@ static BOOL MSG_PeekHardwareMsg( MSG *msg, HWND hwnd, DWORD first, DWORD last, ...@@ -604,8 +601,7 @@ static BOOL MSG_PeekHardwareMsg( MSG *msg, HWND hwnd, DWORD first, DWORD last,
if ((msg->message >= WM_MOUSEFIRST) && (msg->message <= WM_MOUSELAST)) if ((msg->message >= WM_MOUSEFIRST) && (msg->message <= WM_MOUSELAST))
{ {
HWND hWndScope = (HWND)qmsg->extraInfo; HWND hWndScope = (HWND)qmsg->extraInfo;
WND *tmpWnd = (Options.managed && IsWindow(hWndScope) ) WND *tmpWnd = IsWindow(hWndScope) ? WIN_FindWndPtr(hWndScope) : WIN_GetDesktop();
? WIN_FindWndPtr(hWndScope) : WIN_GetDesktop();
status = MSG_TranslateMouseMsg(hwnd, first, last, msg, remove, tmpWnd, status = MSG_TranslateMouseMsg(hwnd, first, last, msg, remove, tmpWnd,
&hittest, &screen_pt, &mouseClick ); &hittest, &screen_pt, &mouseClick );
...@@ -1025,7 +1021,7 @@ static BOOL MSG_PeekMessage( int type, LPMSG msg_out, HWND hwnd, ...@@ -1025,7 +1021,7 @@ static BOOL MSG_PeekMessage( int type, LPMSG msg_out, HWND hwnd,
/* Now find a normal message */ /* Now find a normal message */
retry: retry:
if (wakeBits & (QS_POSTMESSAGE|QS_TIMER|QS_PAINT)) if (wakeBits & (QS_SENDMESSAGE|QS_POSTMESSAGE|QS_TIMER|QS_PAINT))
{ {
QMSG qmsg; QMSG qmsg;
if (QUEUE_FindMsg( hwnd, first, last, flags & PM_REMOVE, FALSE, &qmsg )) if (QUEUE_FindMsg( hwnd, first, last, flags & PM_REMOVE, FALSE, &qmsg ))
......
...@@ -419,33 +419,32 @@ BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt ) ...@@ -419,33 +419,32 @@ BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
* *
* Find the window and hittest for a given point. * Find the window and hittest for a given point.
*/ */
INT16 WINPOS_WindowFromPoint( WND* wndScope, POINT16 pt, WND **ppWnd ) INT16 WINPOS_WindowFromPoint( WND* wndScope, POINT pt, WND **ppWnd )
{ {
WND *wndPtr; WND *wndPtr;
INT16 hittest = HTERROR; INT16 hittest = HTERROR;
INT16 retvalue; INT16 retvalue;
POINT16 xy = pt; POINT xy = pt;
TRACE("scope %04x %d,%d\n", wndScope->hwndSelf, pt.x, pt.y); TRACE("scope %04x %ld,%ld\n", wndScope->hwndSelf, pt.x, pt.y);
*ppWnd = NULL; *ppWnd = NULL;
wndPtr = WIN_LockWndPtr(wndScope->child); wndPtr = WIN_LockWndPtr(wndScope->child);
if( wndScope->dwStyle & WS_DISABLED ) if( wndScope->dwStyle & WS_DISABLED )
{ {
retvalue = HTERROR; retvalue = HTERROR;
goto end; goto end;
} }
if( wndScope->dwExStyle & WS_EX_MANAGED)
{
/* In managed mode we have to check wndScope first as it is also
* a window which received the mouse event. */
if( pt.x < wndScope->rectClient.left || pt.x >= wndScope->rectClient.right || if (wndScope->parent)
pt.y < wndScope->rectClient.top || pt.y >= wndScope->rectClient.bottom ) MapWindowPoints( GetDesktopWindow(), wndScope->parent->hwndSelf, &xy, 1 );
goto hittest;
} if (xy.x < wndScope->rectClient.left || pt.x >= wndScope->rectClient.right ||
MapWindowPoints16( GetDesktopWindow16(), wndScope->hwndSelf, &xy, 1 ); xy.y < wndScope->rectClient.top || pt.y >= wndScope->rectClient.bottom)
goto hittest;
xy.x -= wndScope->rectClient.left;
xy.y -= wndScope->rectClient.top;
for (;;) for (;;)
{ {
...@@ -467,7 +466,7 @@ INT16 WINPOS_WindowFromPoint( WND* wndScope, POINT16 pt, WND **ppWnd ) ...@@ -467,7 +466,7 @@ INT16 WINPOS_WindowFromPoint( WND* wndScope, POINT16 pt, WND **ppWnd )
(xy.y >= wndPtr->rectWindow.top) && (xy.y >= wndPtr->rectWindow.top) &&
(xy.y < wndPtr->rectWindow.bottom)))) (xy.y < wndPtr->rectWindow.bottom))))
{ {
TRACE("%d,%d is inside %04x\n", xy.x, xy.y, wndPtr->hwndSelf); TRACE("%ld,%ld is inside %04x\n", xy.x, xy.y, wndPtr->hwndSelf);
*ppWnd = wndPtr; /* Got a suitable window */ *ppWnd = wndPtr; /* Got a suitable window */
/* If window is minimized or disabled, return at once */ /* If window is minimized or disabled, return at once */
...@@ -505,8 +504,8 @@ hittest: ...@@ -505,8 +504,8 @@ hittest:
/* Send the WM_NCHITTEST message (only if to the same task) */ /* Send the WM_NCHITTEST message (only if to the same task) */
if ((*ppWnd)->hmemTaskQ == GetFastQueue16()) if ((*ppWnd)->hmemTaskQ == GetFastQueue16())
{ {
hittest = (INT16)SendMessage16( (*ppWnd)->hwndSelf, WM_NCHITTEST, hittest = SendMessageA( (*ppWnd)->hwndSelf, WM_NCHITTEST,
0, MAKELONG( pt.x, pt.y ) ); 0, MAKELONG( pt.x, pt.y ) );
if (hittest != HTTRANSPARENT) if (hittest != HTTRANSPARENT)
{ {
retvalue = hittest; /* Found the window */ retvalue = hittest; /* Found the window */
...@@ -542,10 +541,10 @@ end: ...@@ -542,10 +541,10 @@ end:
*/ */
HWND16 WINAPI WindowFromPoint16( POINT16 pt ) HWND16 WINAPI WindowFromPoint16( POINT16 pt )
{ {
WND *pWnd; POINT pt32;
WINPOS_WindowFromPoint( WIN_GetDesktop(), pt, &pWnd );
WIN_ReleaseDesktop(); CONV_POINT16TO32( &pt, &pt32 );
return pWnd->hwndSelf; return WindowFromPoint( pt32 );
} }
...@@ -555,9 +554,7 @@ HWND16 WINAPI WindowFromPoint16( POINT16 pt ) ...@@ -555,9 +554,7 @@ HWND16 WINAPI WindowFromPoint16( POINT16 pt )
HWND WINAPI WindowFromPoint( POINT pt ) HWND WINAPI WindowFromPoint( POINT pt )
{ {
WND *pWnd; WND *pWnd;
POINT16 pt16; WINPOS_WindowFromPoint( WIN_GetDesktop(), pt, &pWnd );
CONV_POINT32TO16( &pt, &pt16 );
WINPOS_WindowFromPoint( WIN_GetDesktop(), pt16, &pWnd );
WIN_ReleaseDesktop(); WIN_ReleaseDesktop();
return (HWND)pWnd->hwndSelf; return (HWND)pWnd->hwndSelf;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment