Patch to restore iconified window

Duane Clark dclark at akamail.com
Mon Aug 19 20:16:53 CDT 2002


A repost...

Fpga_editor would not restore correctly after being iconified. All that
showed up was the border, without the contents being painted. And
nothing would restore the window at that point. I could only Ctrl-C out
of it.

Unlike most other apps, when iconified fpga_editor triggers
X11DRV_ShowWindow() with a cmd==SW_HIDE, to hide the window. When
X11DRV_MapNotify() was subsequently called, it did nothing because
WS_VISIBLE was not set. This patch fixes that.

I've been using this patch with everything I run for about 5 months now.

Log message:
	Fix restoring of windows that were iconified with SW_HIDE.


-------------- next part --------------
Index: dlls/x11drv/winpos.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/winpos.c,v
retrieving revision 1.46
diff -u -r1.46 winpos.c
--- dlls/x11drv/winpos.c	20 Aug 2002 00:36:45 -0000	1.46
+++ dlls/x11drv/winpos.c	20 Aug 2002 01:10:03 -0000
@@ -1333,11 +1333,13 @@
 {
     HWND hwndFocus = GetFocus();
     WND *win;
+    BOOL wasVisible;
 
     if (!(win = WIN_GetPtr( hwnd ))) return;
 
-    if ((win->dwStyle & WS_VISIBLE) &&
-        (win->dwStyle & WS_MINIMIZE) &&
+    wasVisible = (win->dwStyle & WS_VISIBLE) != 0;
+
+    if ((win->dwStyle & WS_MINIMIZE) &&
         (win->dwExStyle & WS_EX_MANAGED))
     {
         int x, y;
@@ -1365,7 +1367,10 @@
         WIN_ReleasePtr( win );
 
         WIN_InternalShowOwnedPopups( hwnd, TRUE, TRUE );
-        SendMessageA( hwnd, WM_SHOWWINDOW, SW_RESTORE, 0 );
+        /* The SW_SHOW is needed if WS_VISIBLE is false. It will trigger
+           X11DRV_ShowWindow, and pass the SW_SHOW parameter. Otherwise, it
+           does not hurt anything. */
+        SendMessageA( hwnd, WM_SHOWWINDOW, SW_RESTORE, SW_SHOW );
         SetWindowPos( hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
                       SWP_NOZORDER | SWP_WINE_NOHOSTMOVE );
     }


More information about the wine-patches mailing list