user32: Restore erroneously removed chunk of code

Dmitry Timoshkov dmitry at codeweavers.com
Thu Mar 15 10:46:49 CDT 2007


"Alexandre Julliard" <julliard at winehq.org> wrote:

> This breaks the tests:
> 
> ../../../tools/runtest -q -P wine -M user32.dll -T ../../.. -p user32_test.exe.so msg.c && touch msg.ok
> msg.c:2836: Test failed: ShowWindow(SW_RESTORE):invisible MDI child: the msg sequence is not complete: expected 0046 - actual 0000
> msg.c:2866: Test failed: ShowWindow(SW_RESTORE):maximized MDI child: the msg sequence is not complete: expected 0046 - actual 0000

Hmm, looks like it triggers a bug somewhere else. I've added a workaround
for now, I will investigate the real cause of the test failure later.

Changelog:
    user32: Restore erroneously removed chunk of code.

---
 dlls/user32/mdi.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c
index de43ae3..a6a8d0b 100644
--- a/dlls/user32/mdi.c
+++ b/dlls/user32/mdi.c
@@ -910,11 +910,21 @@ static BOOL MDI_RestoreFrameMenu( HWND frame, HWND hChild )
 {
     MENUITEMINFOW menuInfo;
     HMENU menu = GetMenu( frame );
+    INT nItems;
+    UINT iId;
 
     TRACE("frame %p, child %p\n", frame, hChild);
 
     if( !menu ) return 0;
 
+    /* if there is no system buttons then nothing to do */
+    nItems = GetMenuItemCount(menu) - 1;
+    iId = GetMenuItemID(menu, nItems);
+    if ( !(iId == SC_RESTORE || iId == SC_CLOSE) )
+    {
+        DrawMenuBar(frame); /* FIXME: it should not be here */
+        return 0;
+    }
     /*
      * Remove the system menu, If that menu is the icon of the window
      * as it is in win95, we have to delete the bitmap.
-- 
1.5.0.2






More information about the wine-patches mailing list