Author: gadamopoulos
Date: Thu Aug 16 07:32:49 2012
New Revision: 57083

URL: http://svn.reactos.org/svn/reactos?rev=57083&view=rev
Log:
[win32k]
- Do not treat the release of the windows key as a hotkey if it was used as a 
modifier for another hotkey that was pressed
- Now if I press win+R only the Run window opens

Modified:
    trunk/reactos/win32ss/user/ntuser/hotkey.c

Modified: trunk/reactos/win32ss/user/ntuser/hotkey.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/hotkey.c?rev=57083&r1=57082&r2=57083&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/hotkey.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/hotkey.c [iso-8859-1] Thu Aug 16 07:32:49 
2012
@@ -25,6 +25,7 @@
 HOT_KEY hkWinKey =   {NULL, NULL, MOD_WIN,   0,      IDHK_WINKEY,   
&hkShiftF12};
 
 PHOT_KEY gphkFirst = &hkWinKey;
+BOOL bWinHotkeyActive = FALSE;
 
 /* FUNCTIONS *****************************************************************/
 
@@ -140,40 +141,6 @@
     }
 
     return NULL;
-}
-
-/*
- * SendSysCmdMsg
- *
- * Sends syscommand to specified window
- */
-static
-VOID NTAPI
-SendSysCmdMsg(HWND hWnd, WPARAM Cmd, LPARAM lParam)
-{
-    PWND pWnd;
-    MSG Msg;
-    LARGE_INTEGER LargeTickCount;
-
-    /* Get ptr to given window */
-    pWnd = UserGetWindowObject(hWnd);
-    if (!pWnd)
-    {
-        WARN("Invalid window!\n");
-        return;
-    }
-
-    /* Prepare WM_SYSCOMMAND message */
-    Msg.hwnd = hWnd;
-    Msg.message = WM_SYSCOMMAND;
-    Msg.wParam = Cmd;
-    Msg.lParam = lParam;
-    KeQueryTickCount(&LargeTickCount);
-    Msg.time = MsqCalculateMessageTime(&LargeTickCount);
-    Msg.pt = gpsi->ptCursor;
-
-    /* Post message to window */
-    MsqPostMessage(pWnd->head.pti->MessageQueue, &Msg, FALSE, QS_POSTMESSAGE);
 }
 
 /*
@@ -206,21 +173,39 @@
 
             /* WIN and F12 keys are hardcoded here. See: 
http://ivanlef0u.fr/repo/windoz/VI20051005.html */
             if (pHotKey == &hkWinKey)
-                SendSysCmdMsg(InputWindowStation->ShellWindow, SC_TASKLIST, 0);
+            {
+                if(bWinHotkeyActive == TRUE)
+                {
+                    UserPostMessage(InputWindowStation->ShellWindow, 
WM_SYSCOMMAND, SC_TASKLIST, 0);
+                    bWinHotkeyActive = FALSE;
+                }
+            }
             else if (pHotKey == &hkF12 || pHotKey == &hkShiftF12)
             {
                 //co_ActivateDebugger(); // FIXME
             }
             else if (pHotKey->id == IDHK_REACTOS && !pHotKey->pThread) // 
FIXME: Those hotkeys doesn't depend on RegisterHotKey
             {
-                SendSysCmdMsg(pHotKey->hWnd, SC_HOTKEY, (LPARAM)pHotKey->hWnd);
+                UserPostMessage(pHotKey->hWnd, WM_SYSCOMMAND, SC_HOTKEY, 
(LPARAM)pHotKey->hWnd);
             }
             else
             {
+                /* If a hotkey with the WIN modifier was activated, do not 
treat the release of the WIN key as a hotkey*/
+                if((pHotKey->fsModifiers & MOD_WIN) != 0)
+                    bWinHotkeyActive = FALSE;
+
                 MsqPostHotKeyMessage(pHotKey->pThread,
                                      pHotKey->hWnd,
                                      (WPARAM)pHotKey->id,
                                      MAKELPARAM((WORD)fModifiers, wVk));
+            }
+        }
+        else
+        {
+            if (pHotKey == &hkWinKey)
+            {
+               /* The user pressed the win key */
+                bWinHotkeyActive = TRUE;
             }
         }
 


Reply via email to