winex11.drv: Map coordinates before calling send_mouse_input.
Based on a patch from Gabriel Ivăncescu <gabrielopcode@gmail.com>. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46309 Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9b6b09053a
commit
a358a25eda
|
@ -592,24 +592,38 @@ static BOOL is_old_motion_event( unsigned long serial )
|
||||||
*
|
*
|
||||||
* Map the input event coordinates so they're relative to the desktop.
|
* Map the input event coordinates so they're relative to the desktop.
|
||||||
*/
|
*/
|
||||||
static void map_event_coords( HWND hwnd, Window window, struct x11drv_win_data *data, INPUT *input )
|
static void map_event_coords( HWND hwnd, Window window, INPUT *input )
|
||||||
{
|
{
|
||||||
|
struct x11drv_thread_data *thread_data;
|
||||||
|
struct x11drv_win_data *data;
|
||||||
POINT pt = { input->u.mi.dx, input->u.mi.dy };
|
POINT pt = { input->u.mi.dx, input->u.mi.dy };
|
||||||
|
|
||||||
TRACE( "hwnd %p, window %lx, data %p, input %p\n", hwnd, window, data, input );
|
TRACE( "hwnd %p, window %lx, input %p\n", hwnd, window, input );
|
||||||
|
|
||||||
if (window == root_window) pt = root_to_virtual_screen( pt.x, pt.y );
|
if (!hwnd)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (window == data->whole_window)
|
thread_data = x11drv_thread_data();
|
||||||
|
if (!thread_data->clip_hwnd) return;
|
||||||
|
if (thread_data->clip_window != window) return;
|
||||||
|
pt.x += clip_rect.left;
|
||||||
|
pt.y += clip_rect.top;
|
||||||
|
}
|
||||||
|
else if ((data = get_win_data( hwnd )))
|
||||||
|
{
|
||||||
|
if (window == root_window) pt = root_to_virtual_screen( pt.x, pt.y );
|
||||||
|
else
|
||||||
{
|
{
|
||||||
pt.x += data->whole_rect.left - data->client_rect.left;
|
if (window == data->whole_window)
|
||||||
pt.y += data->whole_rect.top - data->client_rect.top;
|
{
|
||||||
}
|
pt.x += data->whole_rect.left - data->client_rect.left;
|
||||||
|
pt.y += data->whole_rect.top - data->client_rect.top;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
|
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
|
||||||
pt.x = data->client_rect.right - data->client_rect.left - 1 - pt.x;
|
pt.x = data->client_rect.right - data->client_rect.left - 1 - pt.x;
|
||||||
MapWindowPoints( hwnd, 0, &pt, 1 );
|
MapWindowPoints( hwnd, 0, &pt, 1 );
|
||||||
|
}
|
||||||
|
release_win_data( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE( "mapped %s to %s\n", wine_dbgstr_point( (POINT *)&input->u.mi.dx ), wine_dbgstr_point( &pt ) );
|
TRACE( "mapped %s to %s\n", wine_dbgstr_point( (POINT *)&input->u.mi.dx ), wine_dbgstr_point( &pt ) );
|
||||||
|
@ -643,15 +657,11 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||||
sync_window_cursor( window );
|
sync_window_cursor( window );
|
||||||
last_cursor_change = input->u.mi.time;
|
last_cursor_change = input->u.mi.time;
|
||||||
}
|
}
|
||||||
input->u.mi.dx += clip_rect.left;
|
|
||||||
input->u.mi.dy += clip_rect.top;
|
|
||||||
__wine_send_input( hwnd, input );
|
__wine_send_input( hwnd, input );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(data = get_win_data( hwnd ))) return;
|
if (!(data = get_win_data( hwnd ))) return;
|
||||||
map_event_coords( hwnd, window, data, input );
|
|
||||||
|
|
||||||
if (InterlockedExchangePointer( (void **)&cursor_window, hwnd ) != hwnd ||
|
if (InterlockedExchangePointer( (void **)&cursor_window, hwnd ) != hwnd ||
|
||||||
input->u.mi.time - last_cursor_change > 100)
|
input->u.mi.time - last_cursor_change > 100)
|
||||||
{
|
{
|
||||||
|
@ -1699,6 +1709,7 @@ BOOL X11DRV_ButtonPress( HWND hwnd, XEvent *xev )
|
||||||
input.u.mi.dwExtraInfo = 0;
|
input.u.mi.dwExtraInfo = 0;
|
||||||
|
|
||||||
update_user_time( event->time );
|
update_user_time( event->time );
|
||||||
|
map_event_coords( hwnd, event->window, &input );
|
||||||
send_mouse_input( hwnd, event->window, event->state, &input );
|
send_mouse_input( hwnd, event->window, event->state, &input );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1724,6 +1735,7 @@ BOOL X11DRV_ButtonRelease( HWND hwnd, XEvent *xev )
|
||||||
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
|
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
|
||||||
input.u.mi.dwExtraInfo = 0;
|
input.u.mi.dwExtraInfo = 0;
|
||||||
|
|
||||||
|
map_event_coords( hwnd, event->window, &input );
|
||||||
send_mouse_input( hwnd, event->window, event->state, &input );
|
send_mouse_input( hwnd, event->window, event->state, &input );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1752,6 +1764,7 @@ BOOL X11DRV_MotionNotify( HWND hwnd, XEvent *xev )
|
||||||
TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, event->serial );
|
TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, event->serial );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
map_event_coords( hwnd, event->window, &input );
|
||||||
send_mouse_input( hwnd, event->window, event->state, &input );
|
send_mouse_input( hwnd, event->window, event->state, &input );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1783,6 +1796,7 @@ BOOL X11DRV_EnterNotify( HWND hwnd, XEvent *xev )
|
||||||
TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, event->serial );
|
TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, event->serial );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
map_event_coords( hwnd, event->window, &input );
|
||||||
send_mouse_input( hwnd, event->window, event->state, &input );
|
send_mouse_input( hwnd, event->window, event->state, &input );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue