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
This commit is contained in:
Kovid Goyal 2020-02-16 22:55:18 +05:30
parent 84453bf15c
commit c51f4df0ca
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 3 deletions

View File

@ -19,6 +19,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- 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`)

View File

@ -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);