From 57828476015f49a31dbaedf0bd64b51d4557bcff Mon Sep 17 00:00:00 2001 From: bexnoss <82064510+bexnoss@users.noreply.github.com> Date: Fri, 2 Sep 2022 18:21:43 +0200 Subject: [PATCH] fix(gtk): send key events directly to widgets (#3720) The default behavior is to send them to the window first to activate mnemonics and accelerators. Some accelerators conflict with text selection hotkeys (like CTRL+A to select all torrents), this fixes that conflict. --- gtk/MainWindow.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtk/MainWindow.cc b/gtk/MainWindow.cc index af26ef349..02f75f51d 100644 --- a/gtk/MainWindow.cc +++ b/gtk/MainWindow.cc @@ -575,6 +575,14 @@ MainWindow::Impl::Impl(MainWindow& window, Glib::RefPtr const& this); refresh(); + + /* prevent keyboard events being sent to the window first */ + window.signal_key_press_event().connect( + [this](GdkEventKey* event) { return gtk_window_propagate_key_event(static_cast(window_).gobj(), event); }, + false); + window.signal_key_release_event().connect( + [this](GdkEventKey* event) { return gtk_window_propagate_key_event(static_cast(window_).gobj(), event); }, + false); } void MainWindow::Impl::updateStats()