From 210c0ee5cd9cdfac3a8f6430c5f5881e01bf48c2 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 4 Apr 2020 11:57:08 +0200 Subject: input: only cancel selection on left mouse button clicks --- input.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 4fff710f..1b1a7fff 100644 --- a/input.c +++ b/input.c @@ -1175,6 +1175,8 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, switch (state) { case WL_POINTER_BUTTON_STATE_PRESSED: { if (button == BTN_LEFT) { + selection_cancel(term); + switch (wayl->mouse.count) { case 1: selection_start( @@ -1211,7 +1213,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 +1220,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); -- cgit v1.3 From 2344f153d938d4d49ccfbd60fb25e1b2170209b8 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 4 Apr 2020 11:57:33 +0200 Subject: input: hardcoded left mouse button handler requires click-count <= 3 This enables user mappings for the left mouse button with click count > 3 I.e. it is now possible to create custom quad-click mappings (except we don't yet support this in footrc). --- input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'input.c') diff --git a/input.c b/input.c index 1b1a7fff..23a0c3a7 100644 --- a/input.c +++ b/input.c @@ -1174,7 +1174,7 @@ 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) { -- cgit v1.3 From fac4b7310706684bbb719287094d9a9bcd73cb01 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 4 Apr 2020 12:02:07 +0200 Subject: input: right mouse click extends the current selection --- input.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'input.c') diff --git a/input.c b/input.c index 23a0c3a7..22cefa1e 100644 --- a/input.c +++ b/input.c @@ -1195,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 = -- cgit v1.3