From b03c8e7849750c517de7ff7b59f22b88e856fdbd Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 6 Jun 2021 08:06:11 -0600 Subject: [PATCH] add key forwarding to playlist selector dialog --- gtk2_ardour/playlist_selector.cc | 20 ++++++++++++++++++++ gtk2_ardour/playlist_selector.h | 1 + 2 files changed, 21 insertions(+) diff --git a/gtk2_ardour/playlist_selector.cc b/gtk2_ardour/playlist_selector.cc index 4c4f924c0e..254a1f500f 100644 --- a/gtk2_ardour/playlist_selector.cc +++ b/gtk2_ardour/playlist_selector.cc @@ -37,6 +37,7 @@ #include "playlist_selector.h" #include "route_ui.h" #include "gui_thread.h" +#include "utils.h" #include "pbd/i18n.h" @@ -362,3 +363,22 @@ PlaylistSelector::selection_changed () } } } + +bool +PlaylistSelector::on_key_press_event (GdkEventKey* ev) +{ + /* Allow these keys to have their in-dialog effect */ + + switch (ev->keyval) { + case GDK_Up: + case GDK_Down: + case GDK_Return: + case GDK_KP_Enter: + return ArdourDialog::on_key_press_event (ev); + } + + /* Don't just forward the key press ... make it act as if it occured in + whatever the main window currently is. + */ + return ARDOUR_UI_UTILS::emulate_key_event (ev->keyval, ev->state); +} diff --git a/gtk2_ardour/playlist_selector.h b/gtk2_ardour/playlist_selector.h index 357e97ee6d..a4398ac4d6 100644 --- a/gtk2_ardour/playlist_selector.h +++ b/gtk2_ardour/playlist_selector.h @@ -71,6 +71,7 @@ public: protected: bool on_unmap_event (GdkEventAny*); + bool on_key_press_event (GdkEventKey*); private: typedef std::map >*> TrackPlaylistMap;