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,
RECT *newClientRect );
extern LONG WINPOS_HandleWindowPosChanging16(struct tagWND *wndPtr, struct tagWINDOWPOS16 *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 BOOL WINPOS_ActivateOtherWindow(struct tagWND* pWnd);
extern BOOL WINPOS_CreateInternalPosAtom(void);
......
......@@ -11,6 +11,7 @@
#include <sys/types.h>
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "message.h"
#include "winerror.h"
#include "server.h"
......@@ -26,9 +27,7 @@
#include "user.h"
#include "thread.h"
#include "task.h"
#include "options.h"
#include "controls.h"
#include "struct32.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(msg);
......@@ -114,7 +113,7 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
HWND hWnd;
INT16 ht, hittest;
UINT message = msg->message;
POINT16 pt;
POINT pt = msg->pt;
HANDLE16 hQ = GetFastQueue16();
MESSAGEQUEUE *queue = QUEUE_Lock(hQ);
int mouseClick = ((message == WM_LBUTTONDOWN) ||
......@@ -124,8 +123,6 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
/* Find the window to dispatch this mouse message to */
CONV_POINT32TO16( &msg->pt, &pt );
hWnd = GetCapture();
/* 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,
}
}
/* save mouse position */
CONV_POINT16TO32( &pt, screen_pt );
*screen_pt = pt;
if (hittest != HTCLIENT)
{
......@@ -202,7 +199,7 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
msg->wParam = hittest;
}
else
ScreenToClient16( hWnd, &pt );
ScreenToClient( hWnd, &pt );
/* check message filter */
......@@ -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))
{
HWND hWndScope = (HWND)qmsg->extraInfo;
WND *tmpWnd = (Options.managed && IsWindow(hWndScope) )
? WIN_FindWndPtr(hWndScope) : WIN_GetDesktop();
WND *tmpWnd = IsWindow(hWndScope) ? WIN_FindWndPtr(hWndScope) : WIN_GetDesktop();
status = MSG_TranslateMouseMsg(hwnd, first, last, msg, remove, tmpWnd,
&hittest, &screen_pt, &mouseClick );
......@@ -1025,7 +1021,7 @@ static BOOL MSG_PeekMessage( int type, LPMSG msg_out, HWND hwnd,
/* Now find a normal message */
retry:
if (wakeBits & (QS_POSTMESSAGE|QS_TIMER|QS_PAINT))
if (wakeBits & (QS_SENDMESSAGE|QS_POSTMESSAGE|QS_TIMER|QS_PAINT))
{
QMSG qmsg;
if (QUEUE_FindMsg( hwnd, first, last, flags & PM_REMOVE, FALSE, &qmsg ))
......
......@@ -419,33 +419,32 @@ BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
*
* 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;
INT16 hittest = HTERROR;
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;
wndPtr = WIN_LockWndPtr(wndScope->child);
if( wndScope->dwStyle & WS_DISABLED )
{
retvalue = HTERROR;
goto end;
retvalue = HTERROR;
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 ||
pt.y < wndScope->rectClient.top || pt.y >= wndScope->rectClient.bottom )
goto hittest;
}
MapWindowPoints16( GetDesktopWindow16(), wndScope->hwndSelf, &xy, 1 );
if (wndScope->parent)
MapWindowPoints( GetDesktopWindow(), wndScope->parent->hwndSelf, &xy, 1 );
if (xy.x < wndScope->rectClient.left || pt.x >= wndScope->rectClient.right ||
xy.y < wndScope->rectClient.top || pt.y >= wndScope->rectClient.bottom)
goto hittest;
xy.x -= wndScope->rectClient.left;
xy.y -= wndScope->rectClient.top;
for (;;)
{
......@@ -467,7 +466,7 @@ INT16 WINPOS_WindowFromPoint( WND* wndScope, POINT16 pt, WND **ppWnd )
(xy.y >= wndPtr->rectWindow.top) &&
(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 */
/* If window is minimized or disabled, return at once */
......@@ -505,8 +504,8 @@ hittest:
/* Send the WM_NCHITTEST message (only if to the same task) */
if ((*ppWnd)->hmemTaskQ == GetFastQueue16())
{
hittest = (INT16)SendMessage16( (*ppWnd)->hwndSelf, WM_NCHITTEST,
0, MAKELONG( pt.x, pt.y ) );
hittest = SendMessageA( (*ppWnd)->hwndSelf, WM_NCHITTEST,
0, MAKELONG( pt.x, pt.y ) );
if (hittest != HTTRANSPARENT)
{
retvalue = hittest; /* Found the window */
......@@ -542,10 +541,10 @@ end:
*/
HWND16 WINAPI WindowFromPoint16( POINT16 pt )
{
WND *pWnd;
WINPOS_WindowFromPoint( WIN_GetDesktop(), pt, &pWnd );
WIN_ReleaseDesktop();
return pWnd->hwndSelf;
POINT pt32;
CONV_POINT16TO32( &pt, &pt32 );
return WindowFromPoint( pt32 );
}
......@@ -555,9 +554,7 @@ HWND16 WINAPI WindowFromPoint16( POINT16 pt )
HWND WINAPI WindowFromPoint( POINT pt )
{
WND *pWnd;
POINT16 pt16;
CONV_POINT32TO16( &pt, &pt16 );
WINPOS_WindowFromPoint( WIN_GetDesktop(), pt16, &pWnd );
WINPOS_WindowFromPoint( WIN_GetDesktop(), pt, &pWnd );
WIN_ReleaseDesktop();
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