experimental mouse click lock feature
authorMatthias Kupfer <mkupfer@reactos.org>
Mon, 12 Oct 2009 21:08:35 +0000 (21:08 +0000)
committerMatthias Kupfer <mkupfer@reactos.org>
Mon, 12 Oct 2009 21:08:35 +0000 (21:08 +0000)
svn path=/trunk/; revision=43420

reactos/subsystems/win32/win32k/include/msgqueue.h
reactos/subsystems/win32/win32k/ntuser/message.c
reactos/subsystems/win32/win32k/ntuser/msgqueue.c

index 637e236..234d0b5 100644 (file)
@@ -197,6 +197,8 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam);
 VOID FASTCALL
 MsqInsertSystemMessage(MSG* Msg);
 BOOL FASTCALL
+MsqIsClkLck(LPMSG Msg, BOOL Remove);
+BOOL FASTCALL
 MsqIsDblClk(LPMSG Msg, BOOL Remove);
 HWND FASTCALL
 MsqSetStateWindow(PUSER_MESSAGE_QUEUE MessageQueue, ULONG Type, HWND hWnd);
index a2857f5..c968192 100644 (file)
@@ -673,6 +673,15 @@ co_IntTranslateMouseMessage(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg, USHORT *
       *HitTest = HTCLIENT;
    }
 
+   if (gspv.bMouseClickLock && ((Msg->message == WM_LBUTTONUP) || (Msg->message == WM_LBUTTONDOWN)))
+   {
+      if (MsqIsClkLck(Msg, Remove))
+      {
+        // FIXME: drop the message, hack: use WM_NULL
+        Msg->message = WM_NULL;
+      }
+   }
+
    if(IS_BTN_MESSAGE(Msg->message, DOWN))
    {
       /* generate double click messages, if necessary */
index 9b4c1d5..1ed3ea3 100644 (file)
@@ -232,6 +232,49 @@ MsqInsertSystemMessage(MSG* Msg)
    KeSetEvent(&HardwareMessageEvent, IO_NO_INCREMENT, FALSE);
 }
 
+BOOL FASTCALL
+MsqIsClkLck(LPMSG Msg, BOOL Remove)
+{
+   PTHREADINFO pti;
+   PWINSTATION_OBJECT WinStaObject;
+   PSYSTEM_CURSORINFO CurInfo;
+   BOOL Res = FALSE;
+
+   pti = PsGetCurrentThreadWin32Thread();
+   if (pti->Desktop == NULL)
+   {
+      return FALSE;
+   }
+
+   WinStaObject = pti->Desktop->WindowStation;
+
+   CurInfo = IntGetSysCursorInfo(WinStaObject);
+
+   switch (Msg->message)
+   {
+     case WM_LBUTTONUP:
+       Res = ((Msg->time - CurInfo->ClickLockTime) >= gspv.dwMouseClickLockTime);
+       if (Res && (!CurInfo->ClickLockActive))
+       {
+         CurInfo->ClickLockActive = TRUE;
+       }
+       break;
+     case WM_LBUTTONDOWN:
+       if (CurInfo->ClickLockActive)
+       {
+         Res = TRUE;
+         CurInfo->ClickLockActive = FALSE;
+         CurInfo->ClickLockTime = 0;
+       }
+       else
+       {
+         CurInfo->ClickLockTime = Msg->time;
+       }
+       break;
+   }
+   return Res;
+}
+
 BOOL FASTCALL
 MsqIsDblClk(LPMSG Msg, BOOL Remove)
 {