[PATCH] winex11.drv: Fix drawing of layered windows with a client window.

Giovanni Mascellani gmascellani at codeweavers.com
Tue Apr 27 03:51:12 CDT 2021


Testing on Windows 10, it seems that when a window has both a surface
(because it is layered) and a client window (because a d3d9 or analogous
device was created for it), the surface takes the priority, i.e., gdi
and d3d9 are ignored, and just the layered bitmap is painted.

Before this change, expose events lead to redrawing the surface only
on the whole window, but not on the client window. This implies that
if a d3d9 device is created for a layered window, it takes the priority
in the client window region, contradicting the behavior observed on
Windows.

Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
---
 dlls/winex11.drv/event.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 99943478729..38c8bd825bb 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -938,21 +938,21 @@ static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev )
     rect.right  = pos.x + event->width;
     rect.bottom = pos.y + event->height;
 
-    if (event->window != data->client_window)
+    if (event->window == data->client_window)
+        OffsetRect( &rect, data->client_rect.left - data->whole_rect.left,
+                    data->client_rect.top - data->whole_rect.top );
+    if (data->surface)
     {
-        if (data->surface)
-        {
-            surface_region = expose_surface( data->surface, &rect );
-            if (!surface_region) flags = 0;
-            else OffsetRgn( surface_region, data->whole_rect.left - data->client_rect.left,
-                            data->whole_rect.top - data->client_rect.top );
+        surface_region = expose_surface( data->surface, &rect );
+        if (!surface_region) flags = 0;
+        else OffsetRgn( surface_region, data->whole_rect.left - data->client_rect.left,
+                        data->whole_rect.top - data->client_rect.top );
 
-            if (data->vis.visualid != default_visual.visualid)
-                data->surface->funcs->flush( data->surface );
-        }
-        OffsetRect( &rect, data->whole_rect.left - data->client_rect.left,
-                    data->whole_rect.top - data->client_rect.top );
+        if (data->vis.visualid != default_visual.visualid)
+            data->surface->funcs->flush( data->surface );
     }
+    OffsetRect( &rect, data->whole_rect.left - data->client_rect.left,
+                data->whole_rect.top - data->client_rect.top );
 
     if (event->window != root_window)
     {
-- 
2.31.1




More information about the wine-devel mailing list