First thanks for the bug report.

At 05:04 PM 8/23/00 +0300, you wrote:
>Lotus Notes 5.03 bookmarks and database popups (much like the explorer
>feature of StarOffice) were disabled (actually not "mapped")
>in Wine 20000801 onwards (although they worked fine in Wine 20000716). The
>offending code was traced to these two lines, in the function
>windows/x11drv/X11DRV_WND_SetWindowPos:
>
>        if (winpos->flags & SWP_NOSIZE)
>            isZeroSizeWnd = TRUE;
>
>Commenting out these two lines (and the "else" that follows) solved the
>problem for Lotus Notes.
>However, I'm not sure this is a correct solution to the problem being
>addressed by this code (mapping zero sized
>windows to X11 windows).

No, this is not a correct fix. What the zero sized window patch do is
to disable the mapping of a Wine windows to a X window when it's 'zero-sized'
Your fix just maps the window anyway. This works since there is a hack
to set the X window dimension to 1x1. Then when Lotus notes resizes it, there 
is no problem.

The real problem of Wine code is that it does not handle correctly the
case when a window is created with a zero size, then it is resized to a non-zero
size; it's not mapped in this case

here is a hack addressing the real problem I think (it's obviously not
good for submission to wine-patch as it is)

--- wnd.c.orig  Sun Aug 20 16:54:48 2000
+++ wnd.c       Fri Aug 25 13:07:56 2000
@@ -636,6 +636,14 @@
                 forceMapWindow = TRUE;
         }
     }
+    else
+    {
+    /* window is viewable, is it mapped ? */
+    if ((wndPtr->dwStyle  & WS_VISIBLE) && 
+       (!(winpos->flags & SWP_HIDEWINDOW)) &&
+       (!(wndPtr->flags & 0x8000)))
+       forceMapWindow = TRUE; /* no, force mapping */
+    }
     /* if resizing to 0 */
     if ( !(winpos->flags & SWP_NOSIZE) && ((winpos->cx <= 0) || (winpos->cy <= 0)) )
             isZeroSizeWnd = TRUE;
@@ -645,7 +653,10 @@
     if (!(winpos->flags & SWP_SHOWWINDOW) && (winpos->flags & SWP_HIDEWINDOW))
     {
       if(X11DRV_WND_GetXWindow(wndPtr)) 
+      {
+        wndPtr->flags &= 0x7fff; 
        TSXUnmapWindow( display, X11DRV_WND_GetXWindow(wndPtr) );
+      }
     }
 
     if(bChangePos)
@@ -762,7 +773,10 @@
     if ( ((winpos->flags & SWP_SHOWWINDOW) && !isZeroSizeWnd) || forceMapWindow )
     {
        if(X11DRV_WND_GetXWindow(wndPtr)) 
+        {
+           wndPtr->flags |= 0x8000;
           TSXMapWindow( display, X11DRV_WND_GetXWindow(wndPtr) );
+        }
     }
     WIN_ReleaseWndPtr(winposPtr);
 }
@@ -1076,6 +1090,7 @@
                            else
                            {
                                XEvent xe;
+                                wnd->flags |= 0x8000;
                                TSXMapWindow(display, w );
                                while( !TSXCheckTypedWindowEvent( display, w, 
MapNotify, &xe) );
                            }

Now, even if I added a flag in the X window structure instead of using
the wnd structure, this would not be very satisfying as I don't really
understand fully the X setwindowpos function.

I would appreciate some comment of the person who wrote this
code (hey, Stephane :)). (I'm confused by the winposPtr pointer; why
not use wndPtr directly ? is there any case where the hwnd in winpos
could be different from the hwnd in wndptr ?)

Gerard

Reply via email to