xi2: Don't set button mask 4 and 5

We interpret buttons 4-7 as old-school scroll events, so it does
not make sense to add these to the mask. Also fix an off-by-one
in the loop here, buttons_mask is 1-based.
This commit is contained in:
Matthias Clasen 2015-05-02 11:51:38 -04:00
parent e478ec09b8
commit 2feaf8f970

View File

@ -762,10 +762,10 @@ _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
{
gint len, i;
/* We're only interested in the first 5 buttons */
len = MIN (5, buttons_state->mask_len * 8);
/* We're only interested in the first 3 buttons */
len = MIN (3, buttons_state->mask_len * 8);
for (i = 0; i < len; i++)
for (i = 1; i <= len; i++)
{
if (!XIMaskIsSet (buttons_state->mask, i))
continue;
@ -781,12 +781,6 @@ _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
case 3:
state |= GDK_BUTTON3_MASK;
break;
case 4:
state |= GDK_BUTTON4_MASK;
break;
case 5:
state |= GDK_BUTTON5_MASK;
break;
default:
break;
}