diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-06-08 13:37:12 +0200 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-06-08 13:49:18 +0200 |
commit | 1a7ec54699dbb1aaffba4c1d5cfdad54528bcd69 (patch) | |
tree | 1513fdbaa02e661195d86fb0d247b895ed532228 | |
parent | 3410c95d991390463965ddf6b584b37f67d30746 (diff) |
gtkui: improved keyboard handling
-rw-r--r-- | plugins/gtkui/ddblistview.c | 6 | ||||
-rw-r--r-- | plugins/gtkui/deadbeef.glade | 4 | ||||
-rw-r--r-- | plugins/gtkui/interface.c | 12 | ||||
-rw-r--r-- | plugins/gtkui/search.c | 13 |
4 files changed, 17 insertions, 18 deletions
diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c index 83c8d7d6..2e76f47d 100644 --- a/plugins/gtkui/ddblistview.c +++ b/plugins/gtkui/ddblistview.c @@ -3358,7 +3358,9 @@ ddb_listview_clear_sort (DdbListview *listview) { gboolean ddb_listview_list_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) { DdbListview *listview = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner")); - return ddb_listview_handle_keypress (listview, event->keyval, event->state); - + if (!ddb_listview_handle_keypress (listview, event->keyval, event->state)) { + return on_mainwin_key_press_event (widget, event, user_data); + } + return TRUE; } diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index c2082b28..967b97b3 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -22,7 +22,7 @@ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> - <signal name="key_press_event" handler="on_mainwin_key_press_event" last_modification_time="Thu, 30 Jul 2009 21:14:26 GMT"/> + <signal name="key_press_event" handler="on_mainwin_key_press_event" after="yes" last_modification_time="Thu, 30 Jul 2009 21:14:26 GMT"/> <signal name="delete_event" handler="on_mainwin_delete_event" last_modification_time="Thu, 13 Aug 2009 20:35:55 GMT"/> <signal name="configure_event" handler="on_mainwin_configure_event" last_modification_time="Sun, 23 Aug 2009 15:26:53 GMT"/> <signal name="window_state_event" handler="on_mainwin_window_state_event" last_modification_time="Wed, 09 Dec 2009 19:39:55 GMT"/> @@ -781,7 +781,7 @@ <signal name="delete_event" handler="gtk_widget_hide_on_delete" last_modification_time="Sat, 08 Aug 2009 23:03:33 GMT"/> <signal name="configure_event" handler="on_searchwin_configure_event" last_modification_time="Mon, 28 Dec 2009 19:24:44 GMT"/> <signal name="window_state_event" handler="on_searchwin_window_state_event" last_modification_time="Mon, 28 Dec 2009 19:26:50 GMT"/> - <signal name="key_press_event" handler="on_searchwin_key_press_event" after="yes" last_modification_time="Mon, 21 Oct 2013 21:53:35 GMT"/> + <signal name="key_press_event" handler="on_searchwin_key_press_event" last_modification_time="Mon, 21 Oct 2013 21:53:35 GMT"/> <child> <widget class="GtkVBox" id="vbox4"> diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index 49f4434d..d75ff742 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -461,9 +461,9 @@ create_mainwin (void) gtk_widget_show (statusbar); gtk_box_pack_start (GTK_BOX (vbox1), statusbar, FALSE, FALSE, 0); - g_signal_connect ((gpointer) mainwin, "key_press_event", - G_CALLBACK (on_mainwin_key_press_event), - NULL); + g_signal_connect_after ((gpointer) mainwin, "key_press_event", + G_CALLBACK (on_mainwin_key_press_event), + NULL); g_signal_connect ((gpointer) mainwin, "delete_event", G_CALLBACK (on_mainwin_delete_event), NULL); @@ -739,9 +739,9 @@ create_searchwin (void) g_signal_connect ((gpointer) searchwin, "window_state_event", G_CALLBACK (on_searchwin_window_state_event), NULL); - g_signal_connect_after ((gpointer) searchwin, "key_press_event", - G_CALLBACK (on_searchwin_key_press_event), - NULL); + g_signal_connect ((gpointer) searchwin, "key_press_event", + G_CALLBACK (on_searchwin_key_press_event), + NULL); g_signal_connect ((gpointer) searchentry, "changed", G_CALLBACK (on_searchentry_changed), NULL); diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c index ed0d69e6..d6c9aed0 100644 --- a/plugins/gtkui/search.c +++ b/plugins/gtkui/search.c @@ -189,18 +189,14 @@ on_searchwin_key_press_event (GtkWidget *widget, { // that's for when user attempts to navigate list while entry has focus if (event->keyval == GDK_Escape) { - gtk_widget_hide (widget); + gtk_widget_hide (searchwin); + return TRUE; } else if (event->keyval == GDK_Return) { on_searchentry_activate (NULL, 0); + return TRUE; } - else if (event->keyval != GDK_Delete && event->keyval != GDK_Home && event->keyval != GDK_End){ - GtkWidget *pl = lookup_widget (searchwin, "searchlist"); - if (!ddb_listview_handle_keypress (DDB_LISTVIEW (pl), event->keyval, event->state)) { - return on_mainwin_key_press_event (widget, event, user_data); - } - } - return TRUE; + return FALSE; } gboolean @@ -411,6 +407,7 @@ DdbListviewBinding search_binding = { void search_playlist_init (GtkWidget *widget) { DdbListview *listview = DDB_LISTVIEW(widget); + g_signal_connect ((gpointer)listview->list, "key_press_event", G_CALLBACK (on_searchwin_key_press_event), listview); search_binding.ref = (void (*) (DdbListviewIter))deadbeef->pl_item_ref; search_binding.unref = (void (*) (DdbListviewIter))deadbeef->pl_item_unref; search_binding.is_selected = (int (*) (DdbListviewIter))deadbeef->pl_is_selected; |