MDISetMenu patch

Rein Klazes rklazes at xs4all.nl
Tue Sep 23 02:36:15 CDT 2003


Hi,

The "Windows" menu of Agent has been broken since May 2000, here is the
fix.

Changelog:
	Fix MDISetMenu in the case it is called before a Windows Menu
	exists as Agent newsreader does.

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/windows/mdi.c	2003-09-17 08:22:47.000000000 +0200
+++ mywine/windows/mdi.c	2003-09-23 09:31:00.000000000 +0200
@@ -378,22 +378,21 @@
     if( ci->hwndChildMaximized && hmenuFrame && hmenuFrame!=oldFrameMenu )
         MDI_RestoreFrameMenu( GetParent(hwnd), ci->hwndChildMaximized );
 
-    if( hmenuWindow && ci->hWindowMenu && hmenuWindow!=ci->hWindowMenu )
+    if( hmenuWindow && hmenuWindow != ci->hWindowMenu )
     {
         /* delete menu items from ci->hWindowMenu
          * and add them to hmenuWindow */
-
-        INT i = GetMenuItemCount(ci->hWindowMenu) - 1;
-        INT pos = GetMenuItemCount(hmenuWindow) + 1;
-
-        AppendMenuA( hmenuWindow, MF_SEPARATOR, 0, NULL);
-
-        if( ci->nActiveChildren )
+        /* Agent newsreader calls this function with  ci->hWindowMenu == NULL */
+        if( ci->hWindowMenu && ci->nActiveChildren )
         {
             INT j;
             LPWSTR buffer = NULL;
 	    MENUITEMINFOW mii;
             INT nbWindowsMenuItems; /* num of documents shown + "More Windows..." if present */
+            INT i = GetMenuItemCount(ci->hWindowMenu) - 1;
+            INT pos = GetMenuItemCount(hmenuWindow) + 1;
+
+            AppendMenuA( hmenuWindow, MF_SEPARATOR, 0, NULL);
 
             if (ci->nActiveChildren <= MDI_MOREWINDOWSLIMIT)
                 nbWindowsMenuItems = ci->nActiveChildren;
@@ -424,11 +423,9 @@
 		    buffer = NULL;
 		}
             }
+            /* remove separator */
+            DeleteMenu(ci->hWindowMenu, i, MF_BYPOSITION);
         }
-
-        /* remove separator */
-        DeleteMenu(ci->hWindowMenu, i, MF_BYPOSITION);
-
         ci->hWindowMenu = hmenuWindow;
     }
 


More information about the wine-patches mailing list