aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-04-04 10:10:43 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-04-04 10:10:43 +0000
commitf0fbfe8e8949462338b8a95e704cec8a48f32053 (patch)
tree44f87aa4c3528f6caf15694c0c3095d9edec765b /input.c
parentchangelog: mention memfd sealing failures not being fatal errors fix (diff)
parentdoc: foot.1: right mouse button extends current selection (diff)
Merge branch 'right-mouse-extend-selection'
Diffstat (limited to 'input.c')
-rw-r--r--input.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/input.c b/input.c
index 4fff710f..22cefa1e 100644
--- a/input.c
+++ b/input.c
@@ -1174,7 +1174,9 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
switch (state) {
case WL_POINTER_BUTTON_STATE_PRESSED: {
- if (button == BTN_LEFT) {
+ if (button == BTN_LEFT && wayl->mouse.count <= 3) {
+ selection_cancel(term);
+
switch (wayl->mouse.count) {
case 1:
selection_start(
@@ -1193,6 +1195,10 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
}
}
+ else if (button == BTN_RIGHT && wayl->mouse.count == 1) {
+ selection_extend(term, wayl->mouse.col, wayl->mouse.row, serial);
+ }
+
else {
for (size_t i = 0; i < ALEN(wayl->conf->bindings.mouse); i++) {
const struct mouse_binding *binding =
@@ -1211,7 +1217,6 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
execute_binding(term, binding->action, serial);
break;
}
- selection_cancel(term);
}
term_mouse_down(term, button, wayl->mouse.row, wayl->mouse.col);
@@ -1219,9 +1224,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
}
case WL_POINTER_BUTTON_STATE_RELEASED:
- if (button != BTN_LEFT || term->selection.end.col == -1)
- selection_cancel(term);
- else
+ if (button == BTN_LEFT && term->selection.end.col != -1)
selection_finalize(term, serial);
term_mouse_up(term, button, wayl->mouse.row, wayl->mouse.col);