mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-19 05:33:44 -04:00
Merge branch 'allow-mouse-binding-click-count-less-than' into master
This commit is contained in:
commit
be9736dea3
2 changed files with 25 additions and 6 deletions
|
|
@ -20,6 +20,13 @@
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
* Mouse bindings now match even if the actual click count is larger
|
||||||
|
than specified in the binding. This allows you to, for example,
|
||||||
|
quickly press the middle-button to paste multiple times
|
||||||
|
(https://codeberg.org/dnkl/foot/issues/146).
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
|
|
|
||||||
24
input.c
24
input.c
|
|
@ -1526,6 +1526,8 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
* applications */
|
* applications */
|
||||||
mods &= ~(1 << seat->kbd.mod_shift);
|
mods &= ~(1 << seat->kbd.mod_shift);
|
||||||
|
|
||||||
|
const struct mouse_binding *match = NULL;
|
||||||
|
|
||||||
tll_foreach(seat->mouse.bindings, it) {
|
tll_foreach(seat->mouse.bindings, it) {
|
||||||
const struct mouse_binding *binding = &it->item;
|
const struct mouse_binding *binding = &it->item;
|
||||||
|
|
||||||
|
|
@ -1539,19 +1541,25 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding->count != seat->mouse.count) {
|
if (binding->count > seat->mouse.count) {
|
||||||
/* Not correct click count */
|
/* Not correct click count */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (match == NULL || binding->count > match->count)
|
||||||
|
match = binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match != NULL) {
|
||||||
seat->mouse.consumed = execute_binding(
|
seat->mouse.consumed = execute_binding(
|
||||||
seat, term, binding->action, NULL, serial);
|
seat, term, match->action, NULL, serial);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
/* Seat does NOT have a keyboard - use mouse bindings *without* modifiers */
|
/* Seat does NOT have a keyboard - use mouse bindings *without* modifiers */
|
||||||
|
const struct config_mouse_binding *match = NULL;
|
||||||
|
|
||||||
tll_foreach(seat->wayl->conf->bindings.mouse, it) {
|
tll_foreach(seat->wayl->conf->bindings.mouse, it) {
|
||||||
const struct config_mouse_binding *binding = &it->item;
|
const struct config_mouse_binding *binding = &it->item;
|
||||||
|
|
||||||
|
|
@ -1560,7 +1568,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding->count != seat->mouse.count) {
|
if (binding->count > seat->mouse.count) {
|
||||||
/* Incorrect click count */
|
/* Incorrect click count */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1571,9 +1579,13 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (match == NULL || binding->count > match->count)
|
||||||
|
match = binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match != NULL) {
|
||||||
seat->mouse.consumed = execute_binding(
|
seat->mouse.consumed = execute_binding(
|
||||||
seat, term, binding->action, NULL, serial);
|
seat, term, match->action, NULL, serial);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue