Vitaliy Margolen : user32: Fix F1 message sequence.

Alexandre Julliard julliard at winehq.org
Mon Mar 24 07:54:47 CDT 2008


Module: wine
Branch: master
Commit: d8391a4a463675a5690b4fc720349801550c314d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d8391a4a463675a5690b4fc720349801550c314d

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Sat Mar 22 13:09:21 2008 -0600

user32: Fix F1 message sequence.

---

 dlls/user32/defwnd.c    |   23 +++++++++++++++++++++++
 dlls/user32/message.c   |   12 ++----------
 dlls/user32/tests/msg.c |    6 +++---
 include/winuser.h       |    1 +
 4 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index b1dc739..43ae405 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -723,6 +723,29 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
                 SendMessageW( parent, msg, wParam, lParam );
             break;
         }
+    case WM_KEYF1:
+        {
+            HELPINFO hi;
+
+            hi.cbSize = sizeof(HELPINFO);
+            GetCursorPos( &hi.MousePos );
+            if (MENU_IsMenuActive())
+            {
+                hi.iContextType = HELPINFO_MENUITEM;
+                hi.hItemHandle = MENU_IsMenuActive();
+                hi.iCtrlId = MenuItemFromPoint( hwnd, hi.hItemHandle, hi.MousePos );
+                hi.dwContextId = GetMenuContextHelpId( hi.hItemHandle );
+            }
+            else
+            {
+                hi.iContextType = HELPINFO_WINDOW;
+                hi.hItemHandle = hwnd;
+                hi.iCtrlId = GetWindowLongPtrA( hwnd, GWLP_ID );
+                hi.dwContextId = GetWindowContextHelpId( hwnd );
+            }
+            SendMessageW( hwnd, WM_HELP, 0, (LPARAM)&hi );
+            break;
+        }
     }
 
     return 0;
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index eb0168f..ed5a2a8 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -1702,17 +1702,9 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter,
            (msg->hwnd != GetDesktopWindow()))
         {
             /* Handle F1 key by sending out WM_HELP message */
-            if(msg->wParam == VK_F1 &&
-               !MENU_IsMenuActive())
+            if (msg->wParam == VK_F1)
             {
-                HELPINFO hi;
-                hi.cbSize = sizeof(HELPINFO);
-                hi.iContextType = HELPINFO_WINDOW;
-                hi.iCtrlId = GetWindowLongPtrA( msg->hwnd, GWLP_ID );
-                hi.hItemHandle = msg->hwnd;
-                hi.dwContextId = GetWindowContextHelpId( msg->hwnd );
-                hi.MousePos = msg->pt;
-                SendMessageW( msg->hwnd, WM_HELP, 0, (LPARAM)&hi );
+                PostMessageW( msg->hwnd, WM_KEYF1, 0, 0 );
             }
             else if(msg->wParam >= VK_BROWSER_BACK &&
                     msg->wParam <= VK_LAUNCH_APP2)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 69bba8b..7aa99b4 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -5891,8 +5891,8 @@ static const struct message WmF1Seq[] = {
     { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F1, 1 }, /* XP */
     { WM_KEYDOWN, wparam|lparam, VK_F1, 1 },
     { WM_KEYDOWN, sent|wparam|lparam, VK_F1, 0x00000001 },
-    { 0x4d, wparam|lparam, 0, 0 },
-    { 0x4d, sent|wparam|lparam, 0, 0 },
+    { WM_KEYF1, wparam|lparam, 0, 0 },
+    { WM_KEYF1, sent|wparam|lparam, 0, 0 },
     { WM_HELP, sent|defwinproc },
     { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F1, 0xc0000001 }, /* XP */
     { WM_KEYUP, wparam|lparam, VK_F1, 0xc0000001 },
@@ -6123,7 +6123,7 @@ static void test_accelerators(void)
     keybd_event(VK_F1, 0, 0, 0);
     keybd_event(VK_F1, 0, KEYEVENTF_KEYUP, 0);
     pump_msg_loop(hwnd, 0);
-    ok_sequence(WmF1Seq, "F1 press/release", TRUE);
+    ok_sequence(WmF1Seq, "F1 press/release", FALSE);
 
     trace("testing VK_APPS press/release\n");
     keybd_event(VK_APPS, 0, 0, 0);
diff --git a/include/winuser.h b/include/winuser.h
index d5d0086..f7bf196 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -1160,6 +1160,7 @@ WINUSERAPI BOOL     WINAPI SetSysColors(INT,const INT*,const COLORREF*);
   /* Win32 4.0 messages */
 #define WM_COPYDATA		0x004a
 #define WM_CANCELJOURNAL	0x004b
+#define WM_KEYF1		0x004d
 #define WM_NOTIFY		0x004e
 #define WM_INPUTLANGCHANGEREQUEST       0x0050
 #define WM_INPUTLANGCHANGE              0x0051




More information about the wine-cvs mailing list