Author: gadamopoulos
Date: Sun Jul 17 15:30:12 2011
New Revision: 52716

URL: http://svn.reactos.org/svn/reactos?rev=52716&view=rev
Log:
[win32k]
- Fix TrackMouseEvent. Now hot tracking really works 

Modified:
    branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/input.c
    branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/msgqueue.c
    branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/timer.c

Modified: 
branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/input.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/input.c?rev=52716&r1=52715&r2=52716&view=diff
==============================================================================
--- branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/input.c 
[iso-8859-1] (original)
+++ branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/input.c 
[iso-8859-1] Sun Jul 17 15:30:12 2011
@@ -1612,19 +1612,6 @@
    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);
-      }
-      DPRINT("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.
    {
@@ -1642,6 +1629,7 @@
    }
    else // Not Canceled.
    {
+       pDesk->spwndTrack = pWnd;
       if ( lpEventTrack->dwFlags & TME_LEAVE )
          pDesk->dwDTFlags |= DF_TME_LEAVE;
 
@@ -1657,6 +1645,7 @@
          IntSetTimer( pWnd, ID_EVENT_SYSTIMER_MOUSEHOVER, 
pDesk->dwMouseHoverTime, SystemTimerProc, TMRF_SYSTEM);
          // Get windows thread message points.
          point = pWnd->head.pti->ptLast;
+         DPRINT1("point: %d, %d\n", point.x, point.y);
          // Set desktop mouse hover from the system default hover rectangle.
          RECTL_vSetRect(&pDesk->rcMouseHover,
                          point.x - gspv.iMouseHoverWidth  / 2,

Modified: 
branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/msgqueue.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/msgqueue.c?rev=52716&r1=52715&r2=52716&view=diff
==============================================================================
--- branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/msgqueue.c 
[iso-8859-1] (original)
+++ branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/msgqueue.c 
[iso-8859-1] Sun Jul 17 15:30:12 2011
@@ -540,22 +540,35 @@
 
    if (pwnd)
    {
-      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);
+      /* 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;
+
+              DPRINT1("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;
+      }
    }
 
    hdcScreen = IntGetScreenDC();
@@ -1287,6 +1300,7 @@
     PUSER_MESSAGE_QUEUE MessageQueue;
     PTHREADINFO pti;
     PSYSTEM_CURSORINFO CurInfo;
+    PDESKTOP pDesk;
     DECLARE_RETURN(BOOL);
 
     pti = PsGetCurrentThreadWin32Thread();
@@ -1295,6 +1309,7 @@
     CurInfo = IntGetSysCursorInfo();
     pwndMsg = UserGetWindowObject(msg->hwnd);
     clk_msg = MessageQueue->msgDblClk;
+    pDesk = pwndDesktop->head.rpdesk;
 
     /* find the window to dispatch this mouse message to */
     if (MessageQueue->CaptureWindow)
@@ -1314,6 +1329,45 @@
         /* Remove and ignore the message */
         *RemoveMessages = TRUE;
         RETURN(FALSE);
+    }
+
+    /* 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;
+
+            DPRINT1("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;
     }
 
     msg->hwnd = UserHMGetHandle(pwndMsg);

Modified: 
branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/timer.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/timer.c?rev=52716&r1=52715&r2=52716&view=diff
==============================================================================
--- branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/timer.c 
[iso-8859-1] (original)
+++ branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/timer.c 
[iso-8859-1] Sun Jul 17 15:30:12 2011
@@ -320,12 +320,13 @@
           POINT Point;
           UINT Msg;
           WPARAM wParam;
-
+          
           pDesk = pWnd->head.rpdesk;
           if ( pDesk->dwDTFlags & DF_TME_HOVER &&
                pWnd == pDesk->spwndTrack )
           {
-             Point = gpsi->ptCursor;
+             Point = pWnd->head.pti->MessageQueue->MouseMoveMsg.pt;
+             DPRINT1("point: %d, %d\n", Point.x, Point.y);
              if ( IntPtInRect(&pDesk->rcMouseHover, Point) )
              {
                 if (pDesk->htEx == HTCLIENT) // In a client area.
@@ -346,9 +347,18 @@
                    wParam = pDesk->htEx; // Need to support all HTXYZ hits.
                    Msg = WM_NCMOUSEHOVER;
                 }
+                DPRINT1("Generating WM_NCMOUSEHOVER\n");
                 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);
              }
           }
        }


Reply via email to