From dc6f39ac29bdac0d1be836bbd8d4e720ed2ab88c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 27 Aug 2018 14:24:15 +0200 Subject: [PATCH] server: Use screen coordinates in the update_window_zorder request. Signed-off-by: Alexandre Julliard --- dlls/wineandroid.drv/window.c | 3 --- dlls/winemac.drv/mouse.c | 13 ++++--------- dlls/winex11.drv/event.c | 12 +++++++----- dlls/winex11.drv/mouse.c | 1 - server/window.c | 7 +++---- 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 61c11ce9f3d..aebe4c57b35 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -491,7 +491,6 @@ static int process_events( DWORD mask ) { HWND capture = get_capture_window(); - context = SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ); if (event->data.motion.input.u.mi.dwFlags & (MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_RIGHTDOWN|MOUSEEVENTF_MIDDLEDOWN)) TRACE( "BUTTONDOWN pos %d,%d hwnd %p flags %x\n", event->data.motion.input.u.mi.dx, event->data.motion.input.u.mi.dy, @@ -509,7 +508,6 @@ static int process_events( DWORD mask ) RECT rect; SetRect( &rect, event->data.motion.input.u.mi.dx, event->data.motion.input.u.mi.dy, event->data.motion.input.u.mi.dx + 1, event->data.motion.input.u.mi.dy + 1 ); - MapWindowPoints( 0, event->data.motion.hwnd, (POINT *)&rect, 2 ); SERVER_START_REQ( update_window_zorder ) { @@ -523,7 +521,6 @@ static int process_events( DWORD mask ) SERVER_END_REQ; } __wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input ); - SetThreadDpiAwarenessContext( context ); } break; diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c index a6369c6168e..dd6443fe1ba 100644 --- a/dlls/winemac.drv/mouse.c +++ b/dlls/winemac.drv/mouse.c @@ -144,19 +144,14 @@ static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags, if ((flags & MOUSEEVENTF_MOVE) && (flags & MOUSEEVENTF_ABSOLUTE) && !drag && cocoa_window != macdrv_thread_data()->capture_window) { - RECT rect; - /* update the wine server Z-order */ - SetRect(&rect, x, y, x + 1, y + 1); - MapWindowPoints(0, top_level_hwnd, (POINT *)&rect, 2); - SERVER_START_REQ(update_window_zorder) { req->window = wine_server_user_handle(top_level_hwnd); - req->rect.left = rect.left; - req->rect.top = rect.top; - req->rect.right = rect.right; - req->rect.bottom = rect.bottom; + 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/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 606fa69896e..b36ce6f2679 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -858,7 +858,7 @@ static BOOL X11DRV_FocusOut( HWND hwnd, XEvent *xev ) static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev ) { XExposeEvent *event = &xev->xexpose; - RECT rect; + RECT rect, abs_rect; POINT pos; struct x11drv_win_data *data; HRGN surface_region = 0; @@ -901,14 +901,16 @@ static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev ) { if (GetWindowLongW( data->hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) mirror_rect( &data->client_rect, &rect ); + abs_rect = rect; + MapWindowPoints( hwnd, 0, (POINT *)&abs_rect, 2 ); SERVER_START_REQ( update_window_zorder ) { req->window = wine_server_user_handle( hwnd ); - req->rect.left = rect.left; - req->rect.top = rect.top; - req->rect.right = rect.right; - req->rect.bottom = rect.bottom; + req->rect.left = abs_rect.left; + req->rect.top = abs_rect.top; + req->rect.right = abs_rect.right; + req->rect.bottom = abs_rect.bottom; wine_server_call( req ); } SERVER_END_REQ; diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 8b2966d50e9..10985c1472d 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -627,7 +627,6 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU { RECT rect; SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 ); - MapWindowPoints( 0, hwnd, (POINT *)&rect, 2 ); SERVER_START_REQ( update_window_zorder ) { diff --git a/server/window.c b/server/window.c index 36efb159ac2..c9b131cba5d 100644 --- a/server/window.c +++ b/server/window.c @@ -2652,8 +2652,6 @@ DECL_HANDLER(update_window_zorder) 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 ) { @@ -2661,10 +2659,11 @@ DECL_HANDLER(update_window_zorder) if (!(ptr->style & WS_VISIBLE)) continue; if (ptr->ex_style & WS_EX_TRANSPARENT) continue; if (ptr->is_layered && (ptr->layered_flags & LWA_COLORKEY)) continue; - if (!intersect_rect( &tmp, &ptr->visible_rect, &rect )) continue; + tmp = rect; + map_dpi_rect( win, &tmp, win->parent->dpi, win->dpi ); + if (!intersect_rect( &tmp, &tmp, &ptr->visible_rect )) continue; if (ptr->win_region) { - tmp = rect; offset_rect( &tmp, -ptr->window_rect.left, -ptr->window_rect.top ); if (!rect_in_region( ptr->win_region, &tmp )) continue; }