server: Pass the rectangle in client coordinates for update_window_zorder.
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 8fc955a..a1e0d7f 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c
@@ -731,19 +731,16 @@ if (!(data = X11DRV_get_win_data( hwnd ))) return; + rect.left = event->x; + rect.top = event->y; + rect.right = event->x + event->width; + rect.bottom = event->y + event->height; if (event->window == data->whole_window) { - rect.left = data->whole_rect.left + event->x; - rect.top = data->whole_rect.top + event->y; + OffsetRect( &rect, data->whole_rect.left - data->client_rect.left, + data->whole_rect.top - data->client_rect.top ); flags |= RDW_FRAME; } - else - { - rect.left = data->client_rect.left + event->x; - rect.top = data->client_rect.top + event->y; - } - rect.right = rect.left + event->width; - rect.bottom = rect.top + event->height; if (event->window != root_window) { @@ -758,8 +755,6 @@ } SERVER_END_REQ; - /* make position relative to client area instead of parent */ - OffsetRect( &rect, -data->client_rect.left, -data->client_rect.top ); flags |= RDW_ALLCHILDREN; }
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 922df65..b7258235 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c
@@ -120,29 +120,6 @@ /*********************************************************************** - * get_coords - * - * get the coordinates of a mouse event - */ -static inline void get_coords( HWND hwnd, Window window, int x, int y, POINT *pt ) -{ - struct x11drv_win_data *data = X11DRV_get_win_data( hwnd ); - - if (!data) return; - - if (window == data->client_window) - { - pt->x = x + data->client_rect.left; - pt->y = y + data->client_rect.top; - } - else - { - pt->x = x + data->whole_rect.left; - pt->y = y + data->whole_rect.top; - } -} - -/*********************************************************************** * clip_point_to_rect * * Clip point to the provided rectangle @@ -241,25 +218,33 @@ */ static void update_mouse_state( HWND hwnd, Window window, int x, int y, unsigned int state, POINT *pt ) { - struct x11drv_thread_data *data = x11drv_thread_data(); + struct x11drv_win_data *data = X11DRV_get_win_data( hwnd ); - get_coords( hwnd, window, x, y, pt ); + if (!data) return; + + if (window == data->whole_window) + { + x += data->whole_rect.left - data->client_rect.left; + y += data->whole_rect.top - data->client_rect.top; + } + pt->x = x + data->client_rect.left; + pt->y = y + data->client_rect.top; cursor_window = hwnd; /* update the wine server Z-order */ - if (window != data->grab_window && + if (window != x11drv_thread_data()->grab_window && /* ignore event if a button is pressed, since the mouse is then grabbed too */ !(state & (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask|Button6Mask|Button7Mask))) { SERVER_START_REQ( update_window_zorder ) { req->window = wine_server_user_handle( hwnd ); - req->rect.left = pt->x; - req->rect.top = pt->y; - req->rect.right = pt->x + 1; - req->rect.bottom = pt->y + 1; + req->rect.left = x; + req->rect.top = y; + req->rect.right = x + 1; + req->rect.bottom = y + 1; wine_server_call( req ); } SERVER_END_REQ;
diff --git a/server/protocol.def b/server/protocol.def index ccc87fe..21cae9c 100644 --- a/server/protocol.def +++ b/server/protocol.def
@@ -2441,7 +2441,7 @@ /* Update the z order of a window so that a given rectangle is fully visible */ @REQ(update_window_zorder) user_handle_t window; /* handle to the window */ - rectangle_t rect; /* rectangle that must be visible */ + rectangle_t rect; /* rectangle that must be visible (in client coords) */ @END
diff --git a/server/window.c b/server/window.c index e3dc47a..8900751 100644 --- a/server/window.c +++ b/server/window.c
@@ -2423,18 +2423,20 @@ /* update the z order of a window so that a given rectangle is fully visible */ DECL_HANDLER(update_window_zorder) { - rectangle_t tmp; + rectangle_t tmp, rect = req->rect; struct window *ptr, *win = get_window( req->window ); if (!win || !win->parent || !is_visible( win )) return; /* nothing to do */ + if (win->ex_style & WS_EX_LAYOUTRTL) mirror_rect( &win->client_rect, &rect ); + offset_rect( &rect, win->client_rect.left, win->client_rect.top ); LIST_FOR_EACH_ENTRY( ptr, &win->parent->children, struct window, entry ) { if (ptr == win) break; if (!(ptr->style & WS_VISIBLE)) continue; if (ptr->ex_style & WS_EX_TRANSPARENT) continue; - if (!intersect_rect( &tmp, &ptr->visible_rect, &req->rect )) continue; - if (ptr->win_region && !rect_in_region( ptr->win_region, &req->rect )) continue; + if (!intersect_rect( &tmp, &ptr->visible_rect, &rect )) continue; + if (ptr->win_region && !rect_in_region( ptr->win_region, &rect )) continue; /* found a window obscuring the rectangle, now move win above this one */ /* making sure to not violate the topmost rule */ if (!(ptr->ex_style & WS_EX_TOPMOST) || (win->ex_style & WS_EX_TOPMOST))