aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
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);