From 89c90ed193331d2ee96f323e10aaafd4366f4b0e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 10 Dec 2011 02:21:09 +0000 Subject: Fix move-resize emulation with XI2 https://bugzilla.gnome.org/show_bug.cgi?id=650943 --- diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 1ff816e..d48927f 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -4296,6 +4296,33 @@ _gdk_x11_moveresize_handle_event (XEvent *event) if (event->xbutton.button == mv_resize->moveresize_button) finish_drag (mv_resize); break; + +#ifdef HAVE_XGENERICEVENTS + case GenericEvent: + { + /* we just assume this is an XI2 event */ + XIEvent *ev = (XIEvent *) event->xcookie.data; + XIDeviceEvent *xev = (XIDeviceEvent *)ev; + gint state; + switch (ev->evtype) + { + case XI_Motion: + update_pos (mv_resize, xev->root_x, xev->root_y); + state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group); + if ((state & button_mask) == 0) + finish_drag (mv_resize); + break; + + case XI_ButtonRelease: + update_pos (mv_resize, xev->root_x, xev->root_y); + if (xev->detail == mv_resize->moveresize_button) + finish_drag (mv_resize); + break; + } + } + break; +#endif + } return TRUE; } -- cgit v0.9.0.2