server: Use screen coordinates in the update_window_zorder request.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2018-08-27 14:24:15 +02:00
parent 2068b73db5
commit dc6f39ac29
5 changed files with 14 additions and 22 deletions

View File

@ -491,7 +491,6 @@ static int process_events( DWORD mask )
{ {
HWND capture = get_capture_window(); 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)) if (event->data.motion.input.u.mi.dwFlags & (MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_RIGHTDOWN|MOUSEEVENTF_MIDDLEDOWN))
TRACE( "BUTTONDOWN pos %d,%d hwnd %p flags %x\n", TRACE( "BUTTONDOWN pos %d,%d hwnd %p flags %x\n",
event->data.motion.input.u.mi.dx, event->data.motion.input.u.mi.dy, 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; RECT rect;
SetRect( &rect, event->data.motion.input.u.mi.dx, event->data.motion.input.u.mi.dy, 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 ); 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 ) SERVER_START_REQ( update_window_zorder )
{ {
@ -523,7 +521,6 @@ static int process_events( DWORD mask )
SERVER_END_REQ; SERVER_END_REQ;
} }
__wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input ); __wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input );
SetThreadDpiAwarenessContext( context );
} }
break; break;

View File

@ -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 && if ((flags & MOUSEEVENTF_MOVE) && (flags & MOUSEEVENTF_ABSOLUTE) && !drag &&
cocoa_window != macdrv_thread_data()->capture_window) cocoa_window != macdrv_thread_data()->capture_window)
{ {
RECT rect;
/* update the wine server Z-order */ /* 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) SERVER_START_REQ(update_window_zorder)
{ {
req->window = wine_server_user_handle(top_level_hwnd); req->window = wine_server_user_handle(top_level_hwnd);
req->rect.left = rect.left; req->rect.left = x;
req->rect.top = rect.top; req->rect.top = y;
req->rect.right = rect.right; req->rect.right = x + 1;
req->rect.bottom = rect.bottom; req->rect.bottom = y + 1;
wine_server_call(req); wine_server_call(req);
} }
SERVER_END_REQ; SERVER_END_REQ;

View File

@ -858,7 +858,7 @@ static BOOL X11DRV_FocusOut( HWND hwnd, XEvent *xev )
static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev ) static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev )
{ {
XExposeEvent *event = &xev->xexpose; XExposeEvent *event = &xev->xexpose;
RECT rect; RECT rect, abs_rect;
POINT pos; POINT pos;
struct x11drv_win_data *data; struct x11drv_win_data *data;
HRGN surface_region = 0; 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) if (GetWindowLongW( data->hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
mirror_rect( &data->client_rect, &rect ); mirror_rect( &data->client_rect, &rect );
abs_rect = rect;
MapWindowPoints( hwnd, 0, (POINT *)&abs_rect, 2 );
SERVER_START_REQ( update_window_zorder ) SERVER_START_REQ( update_window_zorder )
{ {
req->window = wine_server_user_handle( hwnd ); req->window = wine_server_user_handle( hwnd );
req->rect.left = rect.left; req->rect.left = abs_rect.left;
req->rect.top = rect.top; req->rect.top = abs_rect.top;
req->rect.right = rect.right; req->rect.right = abs_rect.right;
req->rect.bottom = rect.bottom; req->rect.bottom = abs_rect.bottom;
wine_server_call( req ); wine_server_call( req );
} }
SERVER_END_REQ; SERVER_END_REQ;

View File

@ -627,7 +627,6 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
{ {
RECT rect; RECT rect;
SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 ); SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 );
MapWindowPoints( 0, hwnd, (POINT *)&rect, 2 );
SERVER_START_REQ( update_window_zorder ) SERVER_START_REQ( update_window_zorder )
{ {

View File

@ -2652,8 +2652,6 @@ DECL_HANDLER(update_window_zorder)
struct window *ptr, *win = get_window( req->window ); struct window *ptr, *win = get_window( req->window );
if (!win || !win->parent || !is_visible( win )) return; /* nothing to do */ 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 ) 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->style & WS_VISIBLE)) continue;
if (ptr->ex_style & WS_EX_TRANSPARENT) continue; if (ptr->ex_style & WS_EX_TRANSPARENT) continue;
if (ptr->is_layered && (ptr->layered_flags & LWA_COLORKEY)) 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) if (ptr->win_region)
{ {
tmp = rect;
offset_rect( &tmp, -ptr->window_rect.left, -ptr->window_rect.top ); offset_rect( &tmp, -ptr->window_rect.left, -ptr->window_rect.top );
if (!rect_in_region( ptr->win_region, &tmp )) continue; if (!rect_in_region( ptr->win_region, &tmp )) continue;
} }