Small fixes in controls/menu.c

kenon at go2.pl kenon at go2.pl
Sat May 19 20:33:08 CDT 2001


On Sat, May 19, 2001 at 11:07:19AM +0200, gerard patel wrote:
> At 03:35 AM 18/05/2001 +0200, you wrote:
> 
> 
> My patch is certainly not positioning the menu correctly in the case of your
> app, and your patch fixes the app I did this patch for all right,  but I am wondering
> if  calling SetWindowPos could not generate infinite loops in some cases.
I think it shouldn't generate infinite loops, but my patch could work 
improperly when app catches and doesn't pass to defwndproc  WM_NCCALCSIZE 
message. So I wrote next patch (attached to this e-mail). 
Any comments,hints ?

When WIN_FindWndPtr(hWnd) return a NULL pointer doesn't it means that 
something bad happens ?

> 
> Is Super Memo 8 available on the web as a demo app (freely downloable) ?
> 
At http://www.supermemo.com/ or ftp://ftp.supermemo.com/ftp/sm8zip.exe you 
can find demo version of that app. (I have full ;-) version).
But I'm not sure If it is the same version ,and that bug occurs.
It is hard to me to check it because I have only dial-up connection
to internet :-( .
Maciek
-- 
-------------- next part --------------
--- controls/menu.c_or	Thu May 17 12:28:36 2001
+++ controls/menu.c	Sun May 20 02:48:17 2001
@@ -3023,12 +3023,15 @@
        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);
+ 	    RECT tmprect;
+	    WND *wndPtr=WIN_FindWndPtr(hWnd);
+	    if (wndPtr != NULL) {
+	      tmprect=wndPtr->rectWindow;
+ 	      NC_HandleNCCalcSize(wndPtr,&tmprect);
+	      WIN_ReleaseWndPtr(wndPtr);
+	    } else {
+	      WARN("wndPtr is NULL");
+	    }
        }
     }
     return TRUE;


More information about the wine-devel mailing list