Module: wine Branch: master Commit: 9d237f97fc94f7dcd8afe0763951c601be6449b2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9d237f97fc94f7dcd8afe07639...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Dec 1 17:42:01 2015 +0900
winex11: Add a helper function to check a motion event against the serial number.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winex11.drv/mouse.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index e462b55..356343d 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -520,6 +520,21 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) return grab_clipping_window( &rect ); }
+ +/*********************************************************************** + * is_old_motion_event + */ +static BOOL is_old_motion_event( unsigned long serial ) +{ + struct x11drv_thread_data *thread_data = x11drv_thread_data(); + + if (!thread_data->warp_serial) return FALSE; + if ((long)(serial - thread_data->warp_serial) < 0) return TRUE; + thread_data->warp_serial = 0; /* we caught up now */ + return FALSE; +} + + /*********************************************************************** * send_mouse_input * @@ -1576,20 +1591,11 @@ void X11DRV_MotionNotify( HWND hwnd, XEvent *xev ) input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.u.mi.dwExtraInfo = 0;
- if (!hwnd) + if (!hwnd && is_old_motion_event( event->serial )) { - struct x11drv_thread_data *thread_data = x11drv_thread_data(); - if (thread_data->warp_serial) - { - if ((long)(event->serial - thread_data->warp_serial) < 0) - { - TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, event->serial ); - return; - } - thread_data->warp_serial = 0; /* we caught up now */ - } + TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, event->serial ); + return; } - send_mouse_input( hwnd, event->window, event->state, &input ); }
@@ -1677,14 +1683,10 @@ static void X11DRV_RawMotion( XGenericEventCookie *xev ) break; }
- if (broken_rawevents && thread_data->warp_serial) + if (broken_rawevents && is_old_motion_event( xev->serial )) { - if ((long)(xev->serial - thread_data->warp_serial) < 0) - { - TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, xev->serial ); - return; - } - thread_data->warp_serial = 0; /* we caught up now */ + TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, xev->serial ); + return; }
TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );