[Bug 1272] SW_SHOWMINIMIZED bug

Wine Bugs wine-bugs at winehq.com
Sun Jun 22 12:37:03 CDT 2003


http://bugs.winehq.com/show_bug.cgi?id=1272





------- Additional Comments From fsteinel at flonet.net  2003-22-06 12:37 -------
Bug comments restored from Gmane.org: 
 
SW_SHOWMINIMIZED has a weird bug: The application, when restored, goes blank and
have to be killed and re-started to work again.

	This looks like an internal loop inside wine, or a wrong XLib flag being set.

	This seems to be critical, because to app does not work anymore untill it is
re-started.


------- Additional Comments From felipewd <at> elipse.com.br  2003-02-10 06:52
-------
Created an attachment (id=396)
 --> (http://bugs.winehq.com/attachment.cgi?id=396&action=view)
source code of an app to test the SW_SHOWMINIMIZED flag


------- Additional Comments From felipewd <at> elipse.com.br  2003-02-10 06:53
-------
Created an attachment (id=397)
 --> (http://bugs.winehq.com/attachment.cgi?id=397&action=view)
executable of an app to test the SW_SHOWMINIMIZED flag


------- Additional Comments From dclark <at> akamail.com  2003-02-10 11:17 -------
I can never figure out how to download those attachments. Anyway, try this
patch, which fixes the exact same symptom on another app for me. Watch out for
word wrap.

Index: dlls/x11drv/winpos.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/winpos.c,v
retrieving revision 1.63
diff -u -r1.63 winpos.c
--- dlls/x11drv/winpos.c        8 Jan 2003 21:09:26 -0000       1.63
+++ dlls/x11drv/winpos.c        14 Jan 2003 03:02:14 -0000
@@ -1345,8 +1345,7 @@
 
     if (!(win = WIN_GetPtr( hwnd ))) return;
 
-    if ((win->dwStyle & WS_VISIBLE) &&
-        (win->dwStyle & WS_MINIMIZE) &&
+    if ((win->dwStyle & WS_MINIMIZE) &&
         (win->dwExStyle & WS_EX_MANAGED))
     {
         int x, y;
@@ -1373,7 +1372,10 @@
         WIN_SetStyle( hwnd, style );
         WIN_ReleasePtr( win );
 
-        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 );
     }


------- Additional Comments From andi <at> rhlx01.fht-esslingen.de  2003-02-10
11:47 -------
Whoa, that was fast!

I've also been looking at this bug, and I found something different:

I have used Win98 notepad.exe in a desktopified Wine environment for testing.
I started it, minimized notepad, and watched in amazement as it totally
disappeared (no icon anywhere!).
So in fact I uncovered a second bug while investigating that bug. Cool, huh?

Call trace:

X11DRV_ShowWindow
  WINPOS_MinMaximize(hwnd, SW_MINIMIZE, &newPos)
    GetWindowPlacement(hwnd, &wpl)
      WINPOS_InitInternalPos()
    WINPOS_FindIconPos(wndPtr, wp l.ptMinPosition [-1, -1]);
      (rectParent 0/0 - 1400/1050: desktop window!)
    SetRect(newPos, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y,
GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON); --> 21/1596 - 32/32
---> WAY below
    Wine Desktop window!!!!

What seems to happen is that WINPOS_InitInternalPos returns -1, -1
(no position information stored yet for window).

WINPOS_FindIconPos can't deal with -1, -1 properly, it seems.

I tried your patch to check whether it'd also fix this issue,
but it doesn't.
Any idea about my problem?


------- Additional Comments From andi <at> rhlx01.fht-esslingen.de  2003-02-10
12:10 -------
OK, *my* issue is not quite a bug.
My Win98SE copy has horribly negative values for almost all WindowMetrics keys,
so Wine picks up these values and uses them in an uncorrected manner.
I'll try to find out what Windows does in case of negative values, and I'll
change Wine to handle that if required.


------- Additional Comments From dclark <at> akamail.com  2003-02-10 12:35 -------
It was quick because I have been using this patch for quite awhile now :-) It
was even submitted to CVS, but rejected:

http://www.winehq.com/hypermail/wine-devel/2002/08/0360.html

I guess maybe an attempt needs to be made to figure out the right fix.


------- Additional Comments From felipewd <at> elipse.com.br  2003-02-10 12:43
-------
  Well, Duane...I guess it got rejected because it does not work :)

  The problem still exists...in fact, what seems to happen is that when the
window is SW_SHOWMINIMIZED, it also is resized to 0,0, it's not only minimized.

  And when the user tries to restore the windows to normal (having to manually
resize the window to the "normal" size) state, the main window is locked, but
the menu seem to work (could be some flag not being set correctly).

  To download the attachments...just click on them. They're are also available here:

ftp://ftp.elipse.com.br/pub/showWindow/showWindow-exe.tar.gz

ftp://ftp.elipse.com.br/pub/showWindow/showWindow-src.tar.gz


------- Additional Comments From dclark <at> akamail.com  2003-02-10 13:25 -------
I finally figured out that the attachments were gzip files. Netscape 7 thinks
they are named showattachment.cgi, and there were no other clues that I could
see to what they were. The "executable" unpacks into a .so file for some reason.
When I execute, it says I need libstdc++.so.5. 

Anyway, I was able to compile from the source and run that. And yes, my patch
does not fix your app. On the otherhand, I don't get the symptom of it locking
up. Yes it is restored to a tiny window and I have to resize it by hand, but the
"hello world" is displayed just fine for me.


------- Additional Comments From felipewd <at> elipse.com.br  2003-02-10 13:53
-------
   You're right.

   It turned out to be a Window Maker bug.

   I tried the same program with gnome and it worked fine.

   So, ok...the "main" bug is not a wine bug...but a minor bug still exists: The
window gets resized to a really tiniy value when minimized.


------- Additional Comments From dclark <at> akamail.com  2003-02-11 12:03 -------
Hmm, what I am seeing now is that sometimes the contents of the Window are
painted when I open and resize it, and sometimes they are not. Apparently
somewhat random, or at least no obvious cause that I can see.


------- Additional Comments From dclark <at> akamail.com  2003-02-11 19:50 -------
It looks like SW_SHOWMINIMIZED should be setting a flag to not resize the top
level window. Like this.

Index: dlls/x11drv/winpos.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/winpos.c,v
retrieving revision 1.63
diff -u -r1.63 winpos.c
--- dlls/x11drv/winpos.c	8 Jan 2003 21:09:26 -0000	1.63
+++ dlls/x11drv/winpos.c	12 Feb 2003 01:39:59 -0000
@@ -1237,7 +1240,7 @@
             /* fall through */
 	case SW_SHOWMINIMIZED:
         case SW_FORCEMINIMIZE: /* FIXME: Does not work if thread is hung. */
-            swp |= SWP_SHOWWINDOW;
+            swp |= SWP_SHOWWINDOW | SWP_WINE_NOHOSTMOVE;
             /* fall through */
 	case SW_MINIMIZE:
             swp |= SWP_FRAMECHANGED;
@@ -1296,7 +1299,7 @@
         swp |= SWP_NOACTIVATE | SWP_NOZORDER;
 
     SetWindowPos( hwnd, HWND_TOP, newPos.left, newPos.top,
-                  newPos.right, newPos.bottom, LOWORD(swp) );
+                  newPos.right, newPos.bottom, swp );
     if (cmd == SW_HIDE)
     {
         /* FIXME: This will cause the window to be activated irrespective

The next problem is that somewhere, the SW_MINIMIZE client style is removed, but
the client window is not mapped. If you use just the above patch, you will see
the missing interior (client) area. This patch explicitely maps the client area,
but it kind of masks the original problem.

Index: dlls/x11drv/window.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/window.c,v
retrieving revision 1.50
diff -u -r1.50 window.c
--- dlls/x11drv/window.c	30 Jan 2003 01:07:43 -0000	1.50
+++ dlls/x11drv/window.c	12 Feb 2003 01:49:42 -0000
@@ -587,7 +587,7 @@
         if (was_mapped && !is_client_window_mapped( win ))
             XUnmapWindow( display, data->client_window );
         XConfigureWindow( display, data->client_window, mask, &changes );
-        if (!was_mapped && is_client_window_mapped( win ))
+        if (is_client_window_mapped( win ))
             XMapWindow( display, data->client_window );
         wine_tsx11_unlock();
     }


------- Additional Comments From felipewd <at> elipse.com.br  2003-02-12 12:46
-------
   This last patch fixed my problem. Thanks!

   Could you submit it for inclusion in the CVS?


------- Additional Comments From dclark <at> akamail.com  2003-02-12 13:24 -------
I kind of doubt the second part of the patch would be accepted. There are a
couple of lingering problems with minimizing and restoring (like the problem
that my earlier patch fixes on one of my apps :-) I'm getting much more
comfortable with analyzing problems and figuring out how things "should" work
than when I created that old patch; which I originally wrote almost two years
ago. So maybe it is time for me to take a second look and dig into this a little
deeper.

-- 
Configure bugmail: http://bugs.winehq.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the wine-bugs mailing list