aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-09-07 17:35:25 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-09-07 17:35:25 +0000
commit5f64c5c33590a41afd3f621870c6abd89b859073 (patch)
tree53038b38e92756a391d96f3f8f14ffaddb68506a /input.c
parentrender: change minimum window size from 4x20 -> 1x2 (rows/cols) (diff)
input: fix assertion when pressing first one mouse button, then another
Diffstat (limited to 'input.c')
-rw-r--r--input.c109
1 files changed, 54 insertions, 55 deletions
diff --git a/input.c b/input.c
index d6bc2e8e..dd9d604e 100644
--- a/input.c
+++ b/input.c
@@ -1493,77 +1493,76 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
switch (state) {
case WL_POINTER_BUTTON_STATE_PRESSED: {
- assert(!seat->mouse.consumed);
+ if (!seat->mouse.consumed) {
+ if (seat->wl_keyboard != NULL) {
+ /* Seat has keyboard - use mouse bindings *with* modifiers */
- if (seat->wl_keyboard != NULL) {
- /* Seat has keyboard - use mouse bindings *with* modifiers */
+ xkb_mod_mask_t mods = xkb_state_serialize_mods(
+ seat->kbd.xkb_state, XKB_STATE_MODS_DEPRESSED);
- xkb_mod_mask_t mods = xkb_state_serialize_mods(
- seat->kbd.xkb_state, XKB_STATE_MODS_DEPRESSED);
+ /* Ignore Shift when matching modifiers, since it is
+ * used to enable selection in mouse grabbing client
+ * applications */
+ mods &= ~(1 << seat->kbd.mod_shift);
- /* Ignore Shift when matching modifiers, since it is
- * used to enable selection in mouse grabbing client
- * applications */
- mods &= ~(1 << seat->kbd.mod_shift);
+ tll_foreach(seat->mouse.bindings, it) {
+ const struct mouse_binding *binding = &it->item;
- tll_foreach(seat->mouse.bindings, it) {
- const struct mouse_binding *binding = &it->item;
+ if (binding->button != button) {
+ /* Wrong button */
+ continue;
+ }
- if (binding->button != button) {
- /* Wrong button */
- continue;
- }
+ if (binding->mods != mods) {
+ /* Modifier mismatch */
+ continue;
+ }
- if (binding->mods != mods) {
- /* Modifier mismatch */
- continue;
- }
+ if (binding->count != seat->mouse.count) {
+ /* Not correct click count */
+ continue;
+ }
- if (binding->count != seat->mouse.count) {
- /* Not correct click count */
- continue;
+ seat->mouse.consumed = execute_binding(
+ seat, term, binding->action, NULL, serial);
+ break;
}
-
- seat->mouse.consumed = execute_binding(
- seat, term, binding->action, NULL, serial);
- break;
}
- }
- else {
- /* Seat does NOT have a keyboard - use mouse bindings *without* modifiers */
- tll_foreach(seat->wayl->conf->bindings.mouse, it) {
- const struct config_mouse_binding *binding = &it->item;
+ else {
+ /* Seat does NOT have a keyboard - use mouse bindings *without* modifiers */
+ tll_foreach(seat->wayl->conf->bindings.mouse, it) {
+ const struct config_mouse_binding *binding = &it->item;
- if (binding->button != button) {
- /* Wrong button */
- continue;
- }
+ if (binding->button != button) {
+ /* Wrong button */
+ continue;
+ }
- if (binding->count != seat->mouse.count) {
- /* Incorrect click count */
- continue;
- }
+ if (binding->count != seat->mouse.count) {
+ /* Incorrect click count */
+ continue;
+ }
- const struct config_key_modifiers no_mods = {0};
- if (memcmp(&binding->modifiers, &no_mods, sizeof(no_mods)) != 0) {
- /* Binding has modifiers */
- continue;
- }
+ const struct config_key_modifiers no_mods = {0};
+ if (memcmp(&binding->modifiers, &no_mods, sizeof(no_mods)) != 0) {
+ /* Binding has modifiers */
+ continue;
+ }
- seat->mouse.consumed = execute_binding(
- seat, term, binding->action, NULL, serial);
- break;
+ seat->mouse.consumed = execute_binding(
+ seat, term, binding->action, NULL, serial);
+ break;
+ }
}
- }
- if (!seat->mouse.consumed &&
- !term_mouse_grabbed(term, seat) &&
- cursor_is_on_grid)
- {
- term_mouse_down(
- term, button, seat->mouse.row, seat->mouse.col,
- seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl);
+ if (!term_mouse_grabbed(term, seat) &&
+ cursor_is_on_grid)
+ {
+ term_mouse_down(
+ term, button, seat->mouse.row, seat->mouse.col,
+ seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl);
+ }
}
break;
}