mdi: Fix vanishing system menu in IDA MDI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



IDA uses MDI, so when the mini-windows are maximised, the menubar of the main 
window should contain the windows system menu for the mini-windows.

In IDA however, the icon for this menu appears briefly before vanishing. This 
occurs whenever you change mini-window.

The reason is:

User changes to a different mini-window.

IDA allows this to occur, and the normal MDI processing occurs.

The MDI_AugmentFrameMenu function is called as normal as a result. This makes 
the system icon appear.

IDA now removes everything on its MDI menus (it has different menus for each 
mini-window). This takes the system menu with it.

It then sets the menus back up again using WM_MDISETMENU. As the main menubar 
HWND has not changed, the system menu is not added again by WINE, so it 
doesn't re-appear.



This patch just moves some pre-existing code out of an if() so that it runs 
every time MDI_MdiSetMenu is called. It checks if a system menu already 
exists, and if not, adds one.
Index: windows/mdi.c
===================================================================
RCS file: /home/wine/wine/windows/mdi.c,v
retrieving revision 1.113
diff -u -r1.113 mdi.c
--- windows/mdi.c	23 Sep 2003 22:47:55 -0000	1.113
+++ windows/mdi.c	3 Dec 2003 04:25:55 -0000
@@ -358,6 +358,9 @@
     MDICLIENTINFO *ci;
     HWND hwndFrame = GetParent(hwnd);
     HMENU oldFrameMenu = GetMenu(hwndFrame);
+    HMENU menu;
+    INT nItems;
+    UINT iId;
 
     TRACE("%p %p %p\n", hwnd, hmenuFrame, hmenuWindow);
 
@@ -439,24 +442,24 @@
             return (LRESULT)oldFrameMenu;
         }
     }
-    else
+
+    /* SetMenu() may already have been called, meaning that this window
+     * already has its menu. But they may have done a SetMenu() on
+     * an MDI window, and called MDISetMenu() after the fact, meaning
+     * that the "if" to this "else" wouldn't catch the need to
+     * augment the frame menu. The app may also have just deleted
+     * everything in its MDI menu using conventional menu calls, in which 
+     * case we need to augment it again.
+     */
+    menu = GetMenu( GetParent(hwnd) );
+    nItems = GetMenuItemCount(menu) - 1;
+    iId = GetMenuItemID(menu,nItems) ;    
+    if( !(iId == SC_RESTORE || iId == SC_CLOSE) )
     {
-        HMENU menu = GetMenu( GetParent(hwnd) );
-	INT nItems = GetMenuItemCount(menu) - 1;
-	UINT iId = GetMenuItemID(menu,nItems) ;
-
-	if( !(iId == SC_RESTORE || iId == SC_CLOSE) )
-	{
-	    /* SetMenu() may already have been called, meaning that this window
-	     * already has its menu. But they may have done a SetMenu() on
-	     * an MDI window, and called MDISetMenu() after the fact, meaning
-	     * that the "if" to this "else" wouldn't catch the need to
-	     * augment the frame menu.
-	     */
-	    if( ci->hwndChildMaximized )
-		MDI_AugmentFrameMenu( GetParent(hwnd), ci->hwndChildMaximized );
-	}
+	 if( ci->hwndChildMaximized )
+	   MDI_AugmentFrameMenu( GetParent(hwnd), ci->hwndChildMaximized );
     }
+
     return 0;
 }
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux