Author: jimtabor
Date: Sat Oct 15 00:38:23 2011
New Revision: 54142
URL:
http://svn.reactos.org/svn/reactos?rev=54142&view=rev
Log:
[Win32k]
- Properly set the timer event id's to match tests and add one more bit for track.
- Restore TME user API (now in mouse.c) and Hover Timer, these are not the Droids you are
looking for.
- Restore TME cancellation point in co_MsqInsertMouseMessage and duplicate the the same in
co_IntProcessMouseMessage. First thing, pDesk->spwndTrack is never NULL. The Theme TME
patch code was setting the wrong QS bit and sending to the wrong queue instead of the
pDesk->spwndTrack queue. Surprising this was working at all.
- Tested with Themes, passes wine test_TrackMouseEvent and fixes bug (6257 <-- !).
Notes:
It's all in the sequencing. Locate cancellation points, tracking mouse moves and set
the hit test and track window. When the window message queue does not match the current
thread, check it again and restore the mouse hover window if it is the same window as the
track window and the hover bit set. Track cancellation points and clear the bits at the
same time. Not when in WM_MOUSEMOVE. Guess when posting or sending to another thread?
co_MsqInsertMouseMessage?
Modified:
trunk/reactos/subsystems/win32/win32k/include/desktop.h
trunk/reactos/subsystems/win32/win32k/include/timer.h
trunk/reactos/subsystems/win32/win32k/ntuser/mouse.c
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] Sat Oct 15
00:38:23 2011
@@ -34,10 +34,10 @@
// Desktop flags
#define DF_TME_HOVER 0x00000400
#define DF_TME_LEAVE 0x00000800
+#define DF_HOTTRACK 0x00004000
#define DF_DESTROYED 0x00008000
#define DF_DESKWNDDESTROYED 0x00010000
#define DF_DYING 0x00020000
-
extern PDESKTOP InputDesktop;
extern HDESK InputDesktopHandle;
Modified: trunk/reactos/subsystems/win32/win32k/include/timer.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/timer.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/timer.h [iso-8859-1] Sat Oct 15 00:38:23
2011
@@ -24,11 +24,11 @@
#define TMRF_WAITING 0x0020
#define TMRF_TIFROMWND 0x0040
-#define ID_EVENT_SYSTIMER_MOUSEHOVER (-6)
-#define ID_EVENT_SYSTIMER_FLASHWIN (-8)
-#define ID_EVENT_SYSTIMER_TRACKWIN (-9)
-#define ID_EVENT_SYSTIMER_ANIMATEDFADE (-10)
-#define ID_EVENT_SYSTIMER_INVALIDATEDCES (-11)
+#define ID_EVENT_SYSTIMER_MOUSEHOVER ID_TME_TIMER
+#define ID_EVENT_SYSTIMER_FLASHWIN (0xFFF8)
+#define ID_EVENT_SYSTIMER_TRACKWIN (0xFFF7)
+#define ID_EVENT_SYSTIMER_ANIMATEDFADE (0xFFF6)
+#define ID_EVENT_SYSTIMER_INVALIDATEDCES (0xFFF5)
extern PKTIMER MasterTimer;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/mouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/mouse.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/mouse.c [iso-8859-1] Sat Oct 15 00:38:23
2011
@@ -334,6 +334,19 @@
if (!(pWnd = UserGetWindowObject(lpEventTrack->hwndTrack)))
return FALSE;
+ if ( pDesk->spwndTrack != pWnd ||
+ (pDesk->htEx != HTCLIENT) ^ !!(lpEventTrack->dwFlags &
TME_NONCLIENT) )
+ {
+ if ( lpEventTrack->dwFlags & TME_LEAVE &&
!(lpEventTrack->dwFlags & TME_CANCEL) )
+ {
+ UserPostMessage( lpEventTrack->hwndTrack,
+ lpEventTrack->dwFlags & TME_NONCLIENT ?
WM_NCMOUSELEAVE : WM_MOUSELEAVE,
+ 0, 0);
+ }
+ TRACE("IntTrackMouseEvent spwndTrack 0x%x pwnd 0x%x\n",
pDesk->spwndTrack, pWnd);
+ return TRUE;
+ }
+
/* Tracking spwndTrack same as pWnd */
if (lpEventTrack->dwFlags & TME_CANCEL) // Canceled mode.
{
@@ -351,7 +364,6 @@
}
else // Not Canceled.
{
- pDesk->spwndTrack = pWnd;
if (lpEventTrack->dwFlags & TME_LEAVE)
pDesk->dwDTFlags |= DF_TME_LEAVE;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Sat Oct 15
00:38:23 2011
@@ -536,34 +536,22 @@
if (pwnd)
{
/* If we a re tracking the mouse and it moves to another top level window */
- if(pDesk->spwndTrack &&
- UserGetAncestor(pDesk->spwndTrack, GA_ROOT) != pwnd)
- {
- /* Generate a WM_MOUSELEAVE message */
- if ( pDesk->dwDTFlags & DF_TME_LEAVE )
- {
- MSG msgMouseLeave;
-
- TRACE("co_MsqInsertMouseMessage: generating WM_MOUSELEAVE\n");
-
- msgMouseLeave.hwnd = UserHMGetHandle(pDesk->spwndTrack);
- msgMouseLeave.message = WM_MOUSELEAVE;
- msgMouseLeave.pt = Msg->pt;
- msgMouseLeave.time = Msg->time;
- msgMouseLeave.lParam = msgMouseLeave.wParam = 0;
-
- MsqPostMessage(pwnd->head.pti->MessageQueue, Msg, TRUE, QS_MOUSE);
- }
-
- /* Stop tracking */
- if ( pDesk->dwDTFlags & DF_TME_HOVER )
- {
- IntKillTimer(pDesk->spwndTrack, ID_EVENT_SYSTIMER_MOUSEHOVER, TRUE);
- }
-
- pDesk->spwndTrack = NULL;
- pDesk->htEx = 0;
- }
+ PWND pwndTrack = IntChildrenWindowFromPoint(pwnd, Msg->pt.x, Msg->pt.y);
+
+ if ( pDesk->spwndTrack != pwndTrack && pDesk->dwDTFlags &
(DF_TME_LEAVE|DF_TME_HOVER) )
+ {
+ if ( pDesk->dwDTFlags & DF_TME_LEAVE )
+ UserPostMessage( UserHMGetHandle(pDesk->spwndTrack),
+ (pDesk->htEx != HTCLIENT) ? WM_NCMOUSELEAVE :
WM_MOUSELEAVE,
+ 0, 0);
+
+ if ( pDesk->dwDTFlags & DF_TME_HOVER )
+ IntKillTimer(UserHMGetHandle(pDesk->spwndTrack),
ID_EVENT_SYSTIMER_MOUSEHOVER, TRUE);
+
+ pDesk->dwDTFlags &= ~(DF_TME_LEAVE|DF_TME_HOVER);
+ }
+ pDesk->spwndTrack = pwndTrack;
+ pDesk->htEx = GetNCHitEx(pDesk->spwndTrack, Msg->pt);
}
hdcScreen = IntGetScreenDC();
@@ -1306,42 +1294,21 @@
}
/* If we a re tracking the mouse and it moves to another window */
- if(pDesk->spwndTrack &&
- pDesk->spwndTrack != pwndMsg &&
- msg->message != WM_MOUSELEAVE)
- {
- /* Generate a WM_MOUSELEAVE message */
- if ( pDesk->dwDTFlags & DF_TME_LEAVE )
- {
- MSG msgMouseLeave;
-
- TRACE("co_IntProcessMouseMessage: generating WM_MOUSELEAVE\n");
-
- msgMouseLeave.hwnd = UserHMGetHandle(pDesk->spwndTrack);
- msgMouseLeave.message = WM_MOUSELEAVE;
- msgMouseLeave.pt = msg->pt;
- msgMouseLeave.time = msg->time;
- msgMouseLeave.lParam = msgMouseLeave.wParam = 0;
-
- MsqPostMessage(pwndMsg->head.pti->MessageQueue,
- &msgMouseLeave,
- TRUE,
- QS_MOUSE);
- }
-
- /* Stop tracking */
- if ( pDesk->dwDTFlags & DF_TME_HOVER )
- {
- IntKillTimer(pDesk->spwndTrack, ID_EVENT_SYSTIMER_MOUSEHOVER, TRUE);
- }
-
- pDesk->spwndTrack = NULL;
- pDesk->htEx = 0;
- }
-
- if(pDesk->spwndTrack)
- {
- pDesk->htEx = hittest;
+ if ( pDesk->spwndTrack != pwndMsg && pDesk->dwDTFlags &
(DF_TME_LEAVE|DF_TME_HOVER) &&
+ msg->message != WM_MOUSELEAVE )
+ {
+ if ( pDesk->dwDTFlags & DF_TME_LEAVE )
+ UserPostMessage( UserHMGetHandle(pDesk->spwndTrack),
+ (pDesk->htEx != HTCLIENT) ? WM_NCMOUSELEAVE :
WM_MOUSELEAVE,
+ 0, 0);
+
+ if ( pDesk->dwDTFlags & DF_TME_HOVER )
+ IntKillTimer(UserHMGetHandle(pDesk->spwndTrack),
ID_EVENT_SYSTIMER_MOUSEHOVER, TRUE);
+
+ pDesk->dwDTFlags &= ~(DF_TME_LEAVE|DF_TME_HOVER);
+
+ pDesk->spwndTrack = pwndMsg;
+ pDesk->htEx = hittest;
}
msg->hwnd = UserHMGetHandle(pwndMsg);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] Sat Oct 15 00:38:23
2011
@@ -344,14 +344,6 @@
UserPostMessage(hwnd, Msg, wParam, MAKELPARAM(Point.x, Point.y));
pDesk->dwDTFlags &= ~DF_TME_HOVER;
break; // Kill this timer.
- }
- else
- {
- RECTL_vSetRect(&pDesk->rcMouseHover,
- Point.x - gspv.iMouseHoverWidth / 2,
- Point.y - gspv.iMouseHoverHeight / 2,
- Point.x + gspv.iMouseHoverWidth / 2,
- Point.y + gspv.iMouseHoverHeight / 2);
}
}
}