[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    RE: isZeroSizeWnd in x11drv/wnd.c calculated wrongly ?
From:       "Stephane Lussier" <stephane () macadamian ! com>
Date:       2000-08-30 21:34:16
[Download RAW message or body]

>
> 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
>
You're right about that. My code was assuming that rectWindow wasn't changed
yet when entering in X11DRV_WND_SetWindowPos function, which was a false
assumption.

The attached patch fix the problem.

Changed log:
Force mapping a window if the window wasn't map, the window is visible and
we are changing the size of the window. This case could occur, if the
previous size was zero.

Modified file:
	window/x11drv/wnd.c

> 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 ?)
>

You're right, winposPtr will always be the same as wndPtr. Maybe in the past
it wasn't the case, and the code hasn't be updated.

	Stephane Lussier
	Macadamian Technologies

["zerosized.diff" (application/octet-stream)]


Index: windows/x11drv/wnd.c
===================================================================
RCS file: /home/wine/wine/windows/x11drv/wnd.c,v
retrieving revision 1.58
diff -u -r1.58 wnd.c
--- windows/x11drv/wnd.c	2000/08/19 21:38:56	1.58
+++ windows/x11drv/wnd.c	2000/08/30 20:58:28
@@ -622,23 +622,21 @@
     WND *winposPtr = WIN_FindWndPtr( winpos->hwnd );
     if ( !winposPtr ) return;
 
-    /* find out if after this function we will end out with a zero-size window */
     if (X11DRV_WND_IsZeroSizeWnd(winposPtr))
+        isZeroSizeWnd = TRUE;
+    else if ( !(winpos->flags & SWP_NOSIZE) && 
+               (winposPtr->dwStyle & WS_VISIBLE) &&
+              !(winpos->flags & SWP_HIDEWINDOW) &&
+              !(winpos->flags & SWP_SHOWWINDOW) )
     {
-        /* if current size is 0, and no resizing */
-        if (winpos->flags & SWP_NOSIZE)
-            isZeroSizeWnd = TRUE;
-        else if ((winpos->cx > 0) && (winpos->cy > 0)) 
-        {
-            /* if this function is setting a new size > 0 for the window, we
-               should map the window if WS_VISIBLE is set */
-            if ((winposPtr->dwStyle & WS_VISIBLE) && !(winpos->flags & SWP_HIDEWINDOW))
-                forceMapWindow = TRUE;
-        }
+        /* check if the window is map 
+           if not it means, it was a zero-sized window and
+           it needs to be forced to be mapped */
+        XWindowAttributes winAttr;
+        TSXGetWindowAttributes(display, X11DRV_WND_GetXWindow(wndPtr), &winAttr); 
+        if (winAttr.map_state == IsUnmapped)
+            forceMapWindow = TRUE;
     }
-    /* if resizing to 0 */
-    if ( !(winpos->flags & SWP_NOSIZE) && ((winpos->cx <= 0) || (winpos->cy <= 0)) )
-            isZeroSizeWnd = TRUE;
 
     if(!wndPtr->hwndSelf) wndPtr = NULL; /* FIXME: WND destroyed, shouldn't happen!!! */
   


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic