A window size/move fix (repost)

Duane Clark dclark at akamail.com
Tue Feb 18 11:57:55 CST 2003


This patch fixes bugs 1265 and 1266. It is a separate bug from that
addressed by the "Window resizing" patch.

A fair amount of detail about the problem can be found on the bug:
http://bugs.winehq.com/show_bug.cgi?id=1265

Visual Foxpro displays several things like tooltips by creating internal 
hDCs, drawing into the internal hDC, and then copying the hDC to the 
screen hDC.

To display the tooltip, it calls MoveWindow followed immediately by 
SetWindowPos to resize both the internal hDC and the screen hDC. This 
causes two X ConfigureNotify events to be generated. VFP really did not 
need to call MoveWindow on the internal hDC, and this leads to the 
problem, though it really just exposes a problem in how Wine handles a 
sequence of sizes and moves on a window.

The event handler (X11DRV_ConfigureNotify) for the first event notices 
that the current window size is different from the size in the event 
message, and resizes the window back to the original size! The second 
event sees that the window is again the wrong size, and resizes the 
window once again to the correct size. At this point, the only valid 
portion of the window is the intersection of the two rectangles.

For a normal window, exposure events would then cause the invalid window 
contents to be repainted, thus covering up all this extra resizing. 
However, for an offscreen hDC, no application is going to have a method 
for repainting, because there is no reason for the offscreen image to 
become corrupted. And indeed in Visual Foxpro, that is all that gets 
painted into the tooltip (the rest has only the background painted).

The solution of course is that before sizing or moving a window, all 
pending X ConfigureNotify events should be processed. Hopefully I am not 
violating DLL separation here (I still have not really figured that part 
out).

Changelog:
	Before changing window size/pos, handle pending ConfigureNotify events.





-------------- next part --------------
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	10 Feb 2003 22:33:20 -0000
@@ -887,6 +887,9 @@
     UINT wvrFlags = 0;
     BOOL bChangePos;
 
+    /* This is needed to flush pending X ConfigureNotify events on this window */
+    MsgWaitForMultipleObjectsEx( 0, NULL, 0, 0, 0 );
+    
     TRACE( "hwnd %p, swp (%i,%i)-(%i,%i) flags %08x\n",
            winpos->hwnd, winpos->x, winpos->y,
            winpos->x + winpos->cx, winpos->y + winpos->cy, winpos->flags);


More information about the wine-patches mailing list