Window restore fix

Duane Clark dclark at akamail.com
Thu Mar 28 23:19:28 CST 2002


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.

With this patch, I can declare fpga_editor %100 fixed. Err, well if I 
can convince Alexandre to accept my scrollbar and window refresh patches...

If it helps, I am testing all of these against a significant collection 
of apps. fpga_editor, Actel Designer, Viewmate, CapFast, Word 2000, 
Winzip, Kaleidegraph, FOF, Riven, and Myst.

As usual, this patch is released under the old X11 style wine license.

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.37
diff -u -r1.37 winpos.c
--- dlls/x11drv/winpos.c	12 Mar 2002 19:18:48 -0000	1.37
+++ dlls/x11drv/winpos.c	29 Mar 2002 04:53:43 -0000
@@ -1285,11 +1285,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;
@@ -1317,7 +1319,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