XI2: don't translate button releases as scroll events

This fixes scroll-by-2 sympoms seen in combo boxes.
https://bugzilla.gnome.org/show_bug.cgi?id=639846
This commit is contained in:
Matthias Clasen 2011-02-04 12:51:46 -05:00
parent 03df034684
commit 272aa7bc55

View File

@ -1016,7 +1016,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
parent_iface->translate_event (translator, display, event, xevent))
{
GdkDevice *device;
g_print ("translating core keypress with keycode 0 and state %d\n", xevent->xkey.state);
/* The core device manager sets a core device on the event.
* We need to override that with an XI2 device, since we are
* using XI2.
@ -1132,6 +1132,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
case 5:
case 6:
case 7:
/* Button presses of button 4-7 are scroll events */
if (ev->evtype == XI_ButtonPress)
{
event->scroll.type = GDK_SCROLL;
if (xev->detail == 4)
@ -1159,6 +1162,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->scroll.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons);
break;
}
/* else (XI_ButtonRelease) fall thru */
default:
event->button.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;