From c51f4df0ca014998a3a3a41fbc13ee99c3011db9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 16 Feb 2020 22:55:18 +0530 Subject: [PATCH] When the application running in the terminal grabs the mouse, pass middle clicks to the application unless the terminal_select_modifiers are pressed Fixes #2368 --- docs/changelog.rst | 4 ++++ kitty/mouse.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index cf26dac77..54ece9452 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -19,6 +19,10 @@ To update |kitty|, :doc:`follow the instructions `. - New options :opt:`cursor_beam_thickness` and :opt:`cursor_underline_thickness` to control the thickness of the beam and underline cursors (:iss:`2337` and :pull:`2342`) +- When the application running in the terminal grabs the mouse, pass middle + clicks to the application unless :opt:`terminal_select_modifiers` are + pressed (:iss:`2368`) + - X11: Fix arrow mouse cursor using right pointing instead of the default left pointing arrow (:iss:`2341`) diff --git a/kitty/mouse.c b/kitty/mouse.c index cfc281c0c..0eaa47fed 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -402,7 +402,7 @@ handle_button_event_in_kitty(Window *w, int button, int modifiers, bool is_relea } else add_click(w, button, modifiers, 0); break; case GLFW_MOUSE_BUTTON_MIDDLE: - if (is_release && !modifiers) { call_boss(paste_from_selection, NULL); return; } + if (is_release) { call_boss(paste_from_selection, NULL); return; } break; case GLFW_MOUSE_BUTTON_RIGHT: if (is_release) { extend_selection(w); } @@ -418,10 +418,10 @@ HANDLER(handle_button_event) { } Screen *screen = w->render_data.screen; if (!screen) return; + const int ts1 = OPT(terminal_select_modifiers), ts2 = OPT(terminal_select_modifiers) | OPT(rectangle_select_modifiers); bool handle_in_kitty = ( - modifiers == (int)OPT(terminal_select_modifiers) || modifiers == ((int)OPT(rectangle_select_modifiers) | (int)OPT(terminal_select_modifiers)) || + modifiers == ts1 || modifiers == ts2 || screen->modes.mouse_tracking_mode == 0 || - button == GLFW_MOUSE_BUTTON_MIDDLE || (modifiers == (int)OPT(open_url_modifiers) && button == GLFW_MOUSE_BUTTON_LEFT) ); if (handle_in_kitty) handle_button_event_in_kitty(w, button, modifiers, is_release);