Piotr Caban : user32: Return early on child windows in DrawMenuBar.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Sep 23 14:03:01 CDT 2014


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Sep 23 16:51:53 2014 +0200

user32: Return early on child windows in DrawMenuBar.

---

 dlls/user32/menu.c      |  2 ++
 dlls/user32/tests/msg.c | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 9e05dd4..f0eb66b 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -4360,6 +4360,8 @@ BOOL WINAPI DrawMenuBar( HWND hWnd )
 
     if (!IsWindow( hWnd ))
         return FALSE;
+    if (!WIN_ALLOWED_MENU(GetWindowLongW( hWnd, GWL_STYLE )))
+        return TRUE;
 
     if ((hMenu = GetMenu( hWnd )) && (lppop = MENU_GetMenu( hMenu ))) {
         lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 6badca1..90b87cb 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -4871,6 +4871,18 @@ static void test_messages(void)
     flush_events();
     ok_sequence(WmDrawMenuBarSeq, "DrawMenuBar", FALSE);
     ok(SetCursorPos(pos.x, pos.y), "SetCursorPos failed\n");
+
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_CHILD|WS_VISIBLE,
+            0, 0, 100, 100, hparent, 0, GetModuleHandleA(0), NULL);
+    ok(hwnd != 0, "Failed to create custom dialog window\n");
+    flush_events();
+    flush_sequence();
+    ok(DrawMenuBar(hwnd), "DrawMenuBar failed: %d\n", GetLastError());
+    flush_events();
+    ok_sequence(WmEmptySeq, "DrawMenuBar for a child window", FALSE);
+
     DestroyWindow(hwnd);
 
     flush_sequence();




More information about the wine-cvs mailing list