Bugfix: keypress: Only use the lower 8 bits of the mask so that mouse buttons are filtered out (Thanks Mirko)

Sometimes, when the mouse button gets stuck, state contains the bit for
BUTTON_MASK_1 (or other buttons). We filter them out to continue processing
keys correctly.
This commit is contained in:
Michael Stapelberg 2009-05-19 13:51:03 +02:00
parent 872388752f
commit 77ab4c0b10
1 changed files with 4 additions and 0 deletions

View File

@ -109,6 +109,10 @@ int handle_key_press(void *ignored, xcb_connection_t *conn, xcb_key_press_event_
/* Remove the numlock bit, all other bits are modifiers we can bind to */ /* Remove the numlock bit, all other bits are modifiers we can bind to */
uint16_t state_filtered = event->state & ~(xcb_numlock_mask | XCB_MOD_MASK_LOCK); uint16_t state_filtered = event->state & ~(xcb_numlock_mask | XCB_MOD_MASK_LOCK);
/* Only use the lower 8 bits of the state (modifier masks) so that mouse
* button masks are filtered out */
state_filtered &= 0xFF;
/* Find the binding */ /* Find the binding */
Binding *bind; Binding *bind;
TAILQ_FOREACH(bind, &bindings, bindings) TAILQ_FOREACH(bind, &bindings, bindings)