Alexandre Julliard : server: Mirror the rectangles for RTL windows in set_window_pos.

Alexandre Julliard julliard at winehq.org
Thu Sep 23 12:43:49 CDT 2010


Module: wine
Branch: master
Commit: bc20ff50b62f40227c6b380cb44c74f0e183042d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bc20ff50b62f40227c6b380cb44c74f0e183042d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Sep 23 15:47:46 2010 +0200

server: Mirror the rectangles for RTL windows in set_window_pos.

---

 server/protocol.def |    8 ++++----
 server/window.c     |   29 ++++++++++++++++++++++++-----
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/server/protocol.def b/server/protocol.def
index 1faff19..687fe6c 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2334,9 +2334,9 @@ enum message_type
     unsigned int   flags;         /* SWP_* flags */
     user_handle_t  handle;        /* handle to the window */
     user_handle_t  previous;      /* previous window in Z order */
-    rectangle_t    window;        /* window rectangle */
-    rectangle_t    client;        /* client rectangle */
-    VARARG(valid,rectangles);     /* valid rectangles from WM_NCCALCSIZE */
+    rectangle_t    window;        /* window rectangle (in parent coords) */
+    rectangle_t    client;        /* client rectangle (in parent coords) */
+    VARARG(valid,rectangles);     /* valid rectangles from WM_NCCALCSIZE (in client coords) */
 @REPLY
     unsigned int   new_style;     /* new window style */
     unsigned int   new_ex_style;  /* new window extended style */
@@ -2426,7 +2426,7 @@ enum coords_relative
     user_handle_t  child;         /* child to repaint (or window itself) */
     unsigned int   flags;         /* resulting update flags (see below) */
     data_size_t    total_size;    /* total size of the resulting region */
-    VARARG(region,rectangles);    /* list of rectangles for the region */
+    VARARG(region,rectangles);    /* list of rectangles for the region (in screen coords) */
 @END
 #define UPDATE_NONCLIENT       0x01  /* get region for repainting non-client area */
 #define UPDATE_ERASE           0x02  /* get region for erasing client area */
diff --git a/server/window.c b/server/window.c
index ebcb5bf..bb66a39 100644
--- a/server/window.c
+++ b/server/window.c
@@ -2073,7 +2073,7 @@ DECL_HANDLER(get_window_tree)
 /* set the position and Z order of a window */
 DECL_HANDLER(set_window_pos)
 {
-    const rectangle_t *visible_rect = NULL, *valid_rects = NULL;
+    rectangle_t window_rect, client_rect, visible_rect;
     struct window *previous = NULL;
     struct window *win = get_window( req->handle );
     unsigned int flags = req->flags;
@@ -2117,11 +2117,30 @@ DECL_HANDLER(set_window_pos)
         return;
     }
 
-    if (get_req_data_size() >= sizeof(rectangle_t)) visible_rect = get_req_data();
-    if (get_req_data_size() >= 3 * sizeof(rectangle_t)) valid_rects = visible_rect + 1;
+    window_rect = visible_rect = req->window;
+    client_rect = req->client;
+    if (get_req_data_size() >= sizeof(rectangle_t))
+        memcpy( &visible_rect, get_req_data(), sizeof(rectangle_t) );
+    if (win->parent && win->parent->ex_style & WS_EX_LAYOUTRTL)
+    {
+        mirror_rect( &win->parent->client_rect, &window_rect );
+        mirror_rect( &win->parent->client_rect, &visible_rect );
+        mirror_rect( &win->parent->client_rect, &client_rect );
+    }
+
+    if (get_req_data_size() >= 3 * sizeof(rectangle_t))
+    {
+        rectangle_t valid_rects[2];
+        memcpy( valid_rects, (const rectangle_t *)get_req_data() + 1, 2 * sizeof(rectangle_t) );
+        if (win->ex_style & WS_EX_LAYOUTRTL)
+        {
+            mirror_rect( &win->client_rect, &valid_rects[0] );
+            mirror_rect( &win->client_rect, &valid_rects[1] );
+        }
+        set_window_pos( win, previous, flags, &window_rect, &client_rect, &visible_rect, valid_rects );
+    }
+    else set_window_pos( win, previous, flags, &window_rect, &client_rect, &visible_rect, NULL );
 
-    if (!visible_rect) visible_rect = &req->window;
-    set_window_pos( win, previous, flags, &req->window, &req->client, visible_rect, valid_rects );
     reply->new_style = win->style;
     reply->new_ex_style = win->ex_style;
 }




More information about the wine-cvs mailing list