Author: jimtabor
Date: Sun Jan 25 15:57:22 2015
New Revision: 66085
URL:
http://svn.reactos.org/svn/reactos?rev=66085&view=rev
Log:
[Win32ss]
- Fix window from point so it handles disabled windows correctly.
- Cleanup processing mouse routine.
- See CORE-7447.
Modified:
trunk/reactos/win32ss/user/ntuser/msgqueue.c
trunk/reactos/win32ss/user/ntuser/winpos.c
Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgque…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] Sun Jan 25 15:57:22 2015
@@ -61,7 +61,9 @@
continue;
}
- if ((pWnd->style & WS_VISIBLE) && IntPtInWindow(pWnd, x, y))
+ if ((pWnd->style & WS_VISIBLE) &&
+ (pWnd->ExStyle & (WS_EX_LAYERED|WS_EX_TRANSPARENT)) == 0 &&
+ IntPtInWindow(pWnd, x, y))
return pWnd;
}
@@ -1476,18 +1478,17 @@
MOUSEHOOKSTRUCT hook;
BOOL eatMsg = FALSE;
- PWND pwndMsg, pwndDesktop, pwndOrig;
+ PWND pwndMsg, pwndDesktop;
PUSER_MESSAGE_QUEUE MessageQueue;
PTHREADINFO pti;
PSYSTEM_CURSORINFO CurInfo;
PDESKTOP pDesk;
- DECLARE_RETURN(BOOL);
pti = PsGetCurrentThreadWin32Thread();
pwndDesktop = UserGetDesktopWindow();
MessageQueue = pti->MessageQueue;
CurInfo = IntGetSysCursorInfo();
- pwndOrig = pwndMsg = ValidateHwndNoErr(msg->hwnd);
+ pwndMsg = ValidateHwndNoErr(msg->hwnd);
clk_msg = MessageQueue->msgDblClk;
pDesk = pwndDesktop->head.rpdesk;
@@ -1496,7 +1497,6 @@
{
hittest = HTCLIENT;
pwndMsg = MessageQueue->spwndCapture;
- if (pwndMsg) UserReferenceObject(pwndMsg);
}
else
{
@@ -1504,18 +1504,6 @@
Start with null window. See wine win.c:test_mouse_input:WM_COMMAND tests.
*/
pwndMsg = co_WinPosWindowFromPoint( NULL, &msg->pt, &hittest, FALSE);
- //
- // CORE-6129, Override if a diabled window, it might have a visible popup.
- //
- if ( pwndOrig && pwndOrig->style & WS_DISABLED )
- {
- if ( hittest == (USHORT)HTERROR )
- {
- if (pwndMsg) UserReferenceObject(pwndMsg);
- pwndMsg = pwndOrig;
- UserReferenceObject(pwndMsg);
- }
- }
}
TRACE("Got mouse message for %p, hittest: 0x%x\n", msg->hwnd, hittest);
@@ -1525,7 +1513,7 @@
{
/* Remove and ignore the message */
*RemoveMessages = TRUE;
- RETURN(FALSE);
+ return FALSE;
}
if ( MessageQueue == gpqCursor ) // Cursor must use the same Queue!
@@ -1600,7 +1588,7 @@
if (!((first == 0 && last == 0) || (message >= first || message <=
last)))
{
TRACE("Message out of range!!!\n");
- RETURN(FALSE);
+ return FALSE;
}
/* update static double click conditions */
@@ -1611,7 +1599,7 @@
if (!((first == 0 && last == 0) || (message >= first || message <=
last)))
{
TRACE("Message out of range!!!\n");
- RETURN(FALSE);
+ return FALSE;
}
// Update mouse move down keys.
@@ -1621,7 +1609,7 @@
}
}
- if(gspv.bMouseClickLock)
+ if (gspv.bMouseClickLock)
{
BOOL IsClkLck = FALSE;
@@ -1649,11 +1637,11 @@
/* Remove and ignore the message */
*RemoveMessages = TRUE;
TRACE("Remove and ignore the message\n");
- RETURN(FALSE);
+ return FALSE;
}
}
- /* message is accepted now (but may still get dropped) */
+ /* message is accepted now (but still get dropped) */
event.message = msg->message;
event.time = msg->time;
@@ -1679,23 +1667,23 @@
/* Remove and skip message */
*RemoveMessages = TRUE;
- RETURN(FALSE);
+ return FALSE;
}
if ((hittest == (USHORT)HTERROR) || (hittest == (USHORT)HTNOWHERE))
{
co_IntSendMessage( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd, MAKELONG(
hittest, msg->message ));
- ERR("HT errors!\n");
+
/* Remove and skip message */
*RemoveMessages = TRUE;
- RETURN(FALSE);
+ return FALSE;
}
if ((*RemoveMessages == FALSE) || MessageQueue->spwndCapture)
{
/* Accept the message */
msg->message = message;
- RETURN(TRUE);
+ return TRUE;
}
if ((msg->message == WM_LBUTTONDOWN) ||
@@ -1753,13 +1741,7 @@
co_IntSendMessage( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd, MAKELONG(
hittest, msg->message ));
msg->message = message;
- RETURN(!eatMsg);
-
-CLEANUP:
- if(pwndMsg)
- UserDereferenceObject(pwndMsg);
-
- END_CLEANUP;
+ return !eatMsg;
}
BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages)
Modified: trunk/reactos/win32ss/user/ntuser/winpos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winpos…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] Sun Jan 25 15:57:22 2015
@@ -2417,29 +2417,41 @@
IN BOOL Ignore
)
{
- PWND pwndChild;
HWND *List, *phWnd;
-
+ PWND pwndChild = NULL;
+
+ /* not visible */
if (!(ScopeWin->style & WS_VISIBLE))
{
return NULL;
}
+ /* not in window or in window region */
+ if (!IntPtInWindow(ScopeWin, Point->x, Point->y))
+ {
+ return NULL;
+ }
+
+ /* transparent */
+ if ((ScopeWin->ExStyle & (WS_EX_LAYERED|WS_EX_TRANSPARENT)) ==
(WS_EX_LAYERED|WS_EX_TRANSPARENT))
+ {
+ return NULL;
+ }
+
if (!Ignore && (ScopeWin->style & WS_DISABLED))
- {
+ { /* disabled child */
+ if ((ScopeWin->style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return NULL;
+ /* process the hit error */
*HitTest = HTERROR;
- return NULL;
- }
-
- if (!IntPtInWindow(ScopeWin, Point->x, Point->y))
- {
- return NULL;
- }
-
- UserReferenceObject(ScopeWin);
-
- if (RECTL_bPointInRect(&ScopeWin->rcClient, Point->x, Point->y))
- {
+ return ScopeWin;
+ }
+
+ /* not minimized and check if point is inside the window */
+ if (!(ScopeWin->style & WS_MINIMIZE) &&
+ RECTL_bPointInRect(&ScopeWin->rcClient, Point->x, Point->y) )
+ {
+ UserReferenceObject(ScopeWin);
+
List = IntWinListChildren(ScopeWin);
if (List)
{
@@ -2462,6 +2474,7 @@
}
ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
}
+ UserDereferenceObject(ScopeWin);
}
if (ScopeWin->head.pti == PsGetCurrentThreadWin32Thread())
@@ -2470,20 +2483,23 @@
if ((*HitTest) == (USHORT)HTTRANSPARENT)
{
- UserDereferenceObject(ScopeWin);
return NULL;
}
}
else
{
- if (*HitTest == HTNOWHERE) *HitTest = HTCLIENT;
+ if (*HitTest == HTNOWHERE && pwndChild == NULL) *HitTest = HTCLIENT;
}
return ScopeWin;
}
PWND APIENTRY
-co_WinPosWindowFromPoint(IN PWND ScopeWin, IN POINT *WinPoint, IN OUT USHORT* HitTest, IN
BOOL Ignore)
+co_WinPosWindowFromPoint(
+ IN PWND ScopeWin,
+ IN POINT *WinPoint,
+ IN OUT USHORT* HitTest,
+ IN BOOL Ignore)
{
PWND Window;
POINT Point = *WinPoint;
@@ -3433,7 +3449,6 @@
RETURN( NULL);
CLEANUP:
- if (Window) UserDereferenceObject(Window);
if (DesktopWindow) UserDerefObjectCo(DesktopWindow);
TRACE("Leave NtUserWindowFromPoint, ret=%p\n", _ret_);