[PATCH 2/2] server: Correctly expose composited parent window on SetWindowPos().

Jinoh Kang wine at gitlab.winehq.org
Sun Jun 12 12:44:18 CDT 2022


From: Jinoh Kang <jinoh.kang.kr at gmail.com>

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
 dlls/user32/tests/msg.c |  4 ++--
 server/class.c          |  5 +++++
 server/user.h           |  1 +
 server/window.c         | 28 +++++++++++++++++++++++++---
 4 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 6574318845e..8f1b62ff6ae 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -9303,8 +9303,8 @@ static void test_swp_paint_regions(void)
     static const struct exposure_test composited[] = {
         {                0, WS_CLIPCHILDREN, RGN_DIFF, FALSE },
         {                0,               0, RGN_DIFF, TRUE  },
-        { WS_EX_COMPOSITED, WS_CLIPCHILDREN, RGN_OR  , TRUE  },
-        { WS_EX_COMPOSITED,               0, RGN_OR  , TRUE  },
+        { WS_EX_COMPOSITED, WS_CLIPCHILDREN, RGN_OR  , FALSE },
+        { WS_EX_COMPOSITED,               0, RGN_OR  , FALSE },
         { 0 }
     };
     subtest_swp_paint_regions( 1, "SimpleWindowClass", "SimpleWindowClass", composited );
diff --git a/server/class.c b/server/class.c
index e1e180bd97c..3231f366b26 100644
--- a/server/class.c
+++ b/server/class.c
@@ -141,6 +141,11 @@ int is_hwnd_message_class( struct window_class *class )
     return (!class->local && class->atom == find_global_atom( NULL, &name ));
 }
 
+int get_class_style( struct window_class *class )
+{
+    return class->style;
+}
+
 atom_t get_class_atom( struct window_class *class )
 {
     return class->base_atom;
diff --git a/server/user.h b/server/user.h
index 55a0d35feff..0356fe0c5cd 100644
--- a/server/user.h
+++ b/server/user.h
@@ -175,6 +175,7 @@ extern struct window_class *grab_class( struct process *process, atom_t atom,
 extern void release_class( struct window_class *class );
 extern int is_desktop_class( struct window_class *class );
 extern int is_hwnd_message_class( struct window_class *class );
+extern int get_class_style( struct window_class *class );
 extern atom_t get_class_atom( struct window_class *class );
 extern client_ptr_t get_class_client_ptr( struct window_class *class );
 
diff --git a/server/window.c b/server/window.c
index 7675cd1103d..02ff02f4805 100644
--- a/server/window.c
+++ b/server/window.c
@@ -1706,6 +1706,13 @@ static unsigned int get_window_update_flags( struct window *win, struct window *
 }
 
 
+static int is_composited( struct window *win )
+{
+    if ((win->style & (WS_POPUP|WS_CHILD)) == WS_CHILD && (get_class_style( win->class ) & CS_PARENTDC))
+        return 0;
+    return (win->ex_style & WS_EX_COMPOSITED) != 0;
+}
+
 /* expose the areas revealed by a vis region change on the window parent */
 /* returns the region exposed on the window itself (in client coordinates) */
 static struct region *expose_window( struct window *win, const rectangle_t *old_window_rect,
@@ -1732,13 +1739,28 @@ static struct region *expose_window( struct window *win, const rectangle_t *old_
 
     if (win->parent && !is_desktop_window( win->parent ))
     {
+        struct region *parent_expose_rgn;
+
         /* make it relative to the old window pos for subtracting */
         offset_region( new_vis_rgn, win->window_rect.left - old_window_rect->left,
                        win->window_rect.top - old_window_rect->top  );
 
-        if ((win->parent->style & WS_CLIPCHILDREN) ?
-            subtract_region( new_vis_rgn, old_vis_rgn, new_vis_rgn ) :
-            xor_region( new_vis_rgn, old_vis_rgn, new_vis_rgn ))
+        if (is_composited( win->parent ))
+        {
+            parent_expose_rgn = xor_region( new_vis_rgn, old_vis_rgn, new_vis_rgn );
+            if (parent_expose_rgn && !is_region_empty( parent_expose_rgn ))
+            {
+                parent_expose_rgn = union_region( new_vis_rgn, old_vis_rgn, new_vis_rgn );
+            }
+        }
+        else
+        {
+            parent_expose_rgn = (win->parent->style & WS_CLIPCHILDREN) ?
+                                subtract_region( new_vis_rgn, old_vis_rgn, new_vis_rgn ) :
+                                xor_region( new_vis_rgn, old_vis_rgn, new_vis_rgn );
+        }
+
+        if (parent_expose_rgn)
         {
             if (!is_region_empty( new_vis_rgn ))
             {
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/231



More information about the wine-devel mailing list