Only grab the mouse buttons that need to be grabbed. (#2290)
This is a followup to #2049. While we had fixed that bug by only grabbing buttons 4 and 5 if there is a whole-window binding for that button, this did not consider buttons higher than 5 as found on many mice. Therefore, we now ditch the special handling for scrollwheel buttons and instead do the same for all buttons higher than 3. fixes #2271
This commit is contained in:
committed by
Michael Stapelberg
parent
0060586190
commit
83c8740bf1
18
src/xcb.c
18
src/xcb.c
@ -346,20 +346,12 @@ release_grab:
|
||||
* Grab the specified buttons on a window when managing it.
|
||||
*
|
||||
*/
|
||||
void xcb_grab_buttons(xcb_connection_t *conn, xcb_window_t window, bool bind_scrollwheel) {
|
||||
uint8_t buttons[3];
|
||||
int num = 0;
|
||||
|
||||
if (bind_scrollwheel) {
|
||||
buttons[num++] = XCB_BUTTON_INDEX_ANY;
|
||||
} else {
|
||||
buttons[num++] = XCB_BUTTON_INDEX_1;
|
||||
buttons[num++] = XCB_BUTTON_INDEX_2;
|
||||
buttons[num++] = XCB_BUTTON_INDEX_3;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
void xcb_grab_buttons(xcb_connection_t *conn, xcb_window_t window, int *buttons) {
|
||||
int i = 0;
|
||||
while (buttons[i] > 0) {
|
||||
xcb_grab_button(conn, false, window, XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC,
|
||||
XCB_GRAB_MODE_ASYNC, root, XCB_NONE, buttons[i], XCB_BUTTON_MASK_ANY);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user