Small fixes in controls/menu.c

kenon at go2.pl kenon at go2.pl
Thu May 17 20:35:50 CDT 2001


Hi
Application Super Memo 8 has two modes of functioning. One  mulit-document
(using MDI)  and the other single-document. 

First problem:
It takes a lot of time when I switch between these modes (of course only
under wine).
The menu flickers. 
I noticed that app called the SetMenu function several times with the
same hMenu argument. I think the second hunk of the patch cures the problem.

Second Problem:
Also occurs at switching between modes.
The menu is displayed at improper place (about 10-20 pixels upper than it
should).
I think the problem is in the function MENU_InitTracking in code :

       if ((menu = MENU_GetMenu( hMenu )) && (!menu->Height))
       { /* app changed/recreated menu bar entries in WM_INITMENU
            Recalculate menu sizes else clicks will not work */
           RECT r;
           HDC hdc = GetDCEx( hWnd, 0, DCX_CACHE | DCX_WINDOW );
           SelectObject( hdc, hMenuFont);
           GetClientRect(hWnd, &r); /* probably too simple */
           MENU_MenuBarCalcSize( hdc, &r, menu, hWnd );
           ReleaseDC(hWnd, hdc);
        }

When I write line :         
           r.top+=GetSystemMetrics(SM_CYCAPTION);
just before : MENU_MenuBarCalcSize , it a little helps.
But I think this isn't a good way to fix that problem.
I think better is first hunk of my patch.

ChangeLog:
	* controls/menu.c
 SetMenu(hWnd,hMenu) doesn't change menu when hWnd already has hMenu.
 Draw MenuBar in proper place (some cases).

PS.
I posted a another patch some time ago. But was silently rejected :-( ,
(and problem still exist in current wine).
If this patch is wrong please write me a short information of reason of 
rejecting (one sentence will suffice) so my next patch will be much 
better.

Maciek Kaliszewski
-- 
-------------- next part --------------
--- ./controls/menu.c_or	Thu May 17 12:28:36 2001
+++ ./controls/menu.c	Fri May 18 03:32:10 2001
@@ -3023,12 +3023,9 @@
        if ((menu = MENU_GetMenu( hMenu )) && (!menu->Height))
        { /* app changed/recreated menu bar entries in WM_INITMENU
             Recalculate menu sizes else clicks will not work */
-           RECT r;
-           HDC hdc = GetDCEx( hWnd, 0, DCX_CACHE | DCX_WINDOW );
-           SelectObject( hdc, hMenuFont);
-           GetClientRect(hWnd, &r); /* probably too simple */
-           MENU_MenuBarCalcSize( hdc, &r, menu, hWnd );
-           ReleaseDC(hWnd, hdc);
+          SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
+                        SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
+                                                        
        }
     }
     return TRUE;
@@ -4127,6 +4124,9 @@
     if (wndPtr && !(wndPtr->dwStyle & WS_CHILD))
     {
 	if (GetCapture() == hWnd) ReleaseCapture();
+	if ( wndPtr->wIDmenu == (UINT) hMenu) 
+	    goto exit;
+            
 	wndPtr->wIDmenu = (UINT)hMenu;
 	if (hMenu != 0)
 	{


More information about the wine-patches mailing list