Alexandre Julliard : user32: Only pass the new valid rectangle to the server.

Alexandre Julliard julliard at winehq.org
Tue Jun 5 17:06:42 CDT 2018


Module: wine
Branch: master
Commit: 026309888c8e6b6186491c2f748a7876e4aaf04f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=026309888c8e6b6186491c2f748a7876e4aaf04f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun  5 17:19:53 2018 +0200

user32: Only pass the new valid rectangle to the server.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/winpos.c | 10 +++++-----
 server/window.c      | 22 +++++++++-------------
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index d527409..c792b0e 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -2080,6 +2080,7 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
                                      window_rect, client_rect, &visible_rect, &new_surface );
 
     WIN_GetRectangles( hwnd, COORDS_SCREEN, &old_window_rect, NULL );
+    if (IsRectEmpty( &valid_rects[0] )) valid_rects = NULL;
 
     if (!(win = WIN_GetPtr( hwnd )) || win == WND_DESKTOP || win == WND_OTHER_PROCESS)
     {
@@ -2104,11 +2105,10 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
         req->client.top    = client_rect->top;
         req->client.right  = client_rect->right;
         req->client.bottom = client_rect->bottom;
-        if (!EqualRect( window_rect, &visible_rect ) || !IsRectEmpty( &valid_rects[0] ))
+        if (!EqualRect( window_rect, &visible_rect ) || valid_rects)
         {
             wine_server_add_data( req, &visible_rect, sizeof(visible_rect) );
-            if (!IsRectEmpty( &valid_rects[0] ))
-                wine_server_add_data( req, valid_rects, 2 * sizeof(*valid_rects) );
+            if (valid_rects) wine_server_add_data( req, valid_rects, sizeof(*valid_rects) );
         }
         if (new_surface) req->paint_flags |= SET_WINPOS_PAINT_SURFACE;
         if (win->pixel_format) req->paint_flags |= SET_WINPOS_PIXEL_FORMAT;
@@ -2155,7 +2155,7 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
         register_window_surface( old_surface, new_surface );
         if (old_surface)
         {
-            if (!IsRectEmpty( valid_rects ))
+            if (valid_rects)
             {
                 move_window_bits( hwnd, old_surface, new_surface, &visible_rect,
                                   &old_visible_rect, window_rect, valid_rects );
@@ -2165,7 +2165,7 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
         }
         else if (surface_win && surface_win != hwnd)
         {
-            if (!IsRectEmpty( valid_rects ))
+            if (valid_rects)
             {
                 RECT rects[2];
                 int x_offset = old_visible_rect.left - visible_rect.left;
diff --git a/server/window.c b/server/window.c
index 9492a00..5a415b8 100644
--- a/server/window.c
+++ b/server/window.c
@@ -1653,7 +1653,7 @@ static struct region *expose_window( struct window *win, const rectangle_t *old_
 static void set_window_pos( struct window *win, struct window *previous,
                             unsigned int swp_flags, const rectangle_t *window_rect,
                             const rectangle_t *client_rect, const rectangle_t *visible_rect,
-                            const rectangle_t *valid_rects )
+                            const rectangle_t *valid_rect )
 {
     struct region *old_vis_rgn = NULL, *exposed_rgn = NULL;
     const rectangle_t old_window_rect = win->window_rect;
@@ -1767,8 +1767,7 @@ static void set_window_pos( struct window *win, struct window *previous,
                           client_rect->right  - old_client_rect.right  != x_offset ||
                           client_rect->top    - old_client_rect.top    != y_offset ||
                           client_rect->bottom - old_client_rect.bottom != y_offset ||
-                          !valid_rects ||
-                          memcmp( &valid_rects[0], client_rect, sizeof(*client_rect) ));
+                          !valid_rect || memcmp( valid_rect, client_rect, sizeof(*client_rect) ));
     }
 
     if (frame_changed || client_changed)
@@ -1776,13 +1775,13 @@ static void set_window_pos( struct window *win, struct window *previous,
         struct region *win_rgn = old_vis_rgn;  /* reuse previous region */
 
         set_region_rect( win_rgn, window_rect );
-        if (valid_rects)
+        if (valid_rect)
         {
             /* subtract the valid portion of client rect from the total region */
             struct region *tmp = create_empty_region();
             if (tmp)
             {
-                set_region_rect( tmp, &valid_rects[0] );
+                set_region_rect( tmp, valid_rect );
                 /* subtract update region since invalid parts of the valid rect won't be copied */
                 if (win->update_region)
                 {
@@ -2313,16 +2312,13 @@ DECL_HANDLER(set_window_pos)
     win->paint_flags = (win->paint_flags & ~PAINT_CLIENT_FLAGS) | (req->paint_flags & PAINT_CLIENT_FLAGS);
     if (win->paint_flags & PAINT_HAS_PIXEL_FORMAT) update_pixel_format_flags( win );
 
-    if (get_req_data_size() >= 3 * sizeof(rectangle_t))
+    if (get_req_data_size() >= 2 * sizeof(rectangle_t))
     {
-        rectangle_t valid_rects[2];
-        memcpy( valid_rects, (const rectangle_t *)get_req_data() + 1, 2 * sizeof(rectangle_t) );
+        rectangle_t valid_rect;
+        memcpy( &valid_rect, (const rectangle_t *)get_req_data() + 1, sizeof(rectangle_t) );
         if (win->parent && win->parent->ex_style & WS_EX_LAYOUTRTL)
-        {
-            mirror_rect( &win->parent->client_rect, &valid_rects[0] );
-            mirror_rect( &win->parent->client_rect, &valid_rects[1] );
-        }
-        set_window_pos( win, previous, flags, &window_rect, &client_rect, &visible_rect, valid_rects );
+            mirror_rect( &win->parent->client_rect, &valid_rect );
+        set_window_pos( win, previous, flags, &window_rect, &client_rect, &visible_rect, &valid_rect );
     }
     else set_window_pos( win, previous, flags, &window_rect, &client_rect, &visible_rect, NULL );
 




More information about the wine-cvs mailing list