Commit 6ee45218 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Pass the rectangle in client coordinates for update_window_zorder.

parent d56ac062
......@@ -731,19 +731,16 @@ static void X11DRV_Expose( HWND hwnd, XEvent *xev )
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 @@ static void X11DRV_Expose( HWND hwnd, XEvent *xev )
}
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;
}
......
......@@ -120,29 +120,6 @@ void X11DRV_Xcursor_Init(void)
/***********************************************************************
* 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 @@ void set_window_cursor( HWND hwnd, HCURSOR handle )
*/
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 );
if (!data) return;
get_coords( hwnd, window, x, y, pt );
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;
......
......@@ -2441,7 +2441,7 @@ enum coords_relative
/* 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
......
......@@ -2423,18 +2423,20 @@ DECL_HANDLER(get_update_region)
/* 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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment