[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 472/473: Fix search activation to allow input methods.

noreply at xfce.org noreply at xfce.org
Tue Feb 17 00:00:42 CET 2015


This is an automated email from the git hooks/post-receive script.

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 05ae5eb8f20fee1a9e19337e456061528fac266f
Author: Graeme Gott <graeme at gottcode.org>
Date:   Sun Feb 15 11:43:02 2015 -0500

    Fix search activation to allow input methods.
---
 panel-plugin/search-page.cpp |   27 +++++++++++++++------------
 panel-plugin/search-page.h   |    3 ++-
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/panel-plugin/search-page.cpp b/panel-plugin/search-page.cpp
index 855838c..6934daa 100644
--- a/panel-plugin/search-page.cpp
+++ b/panel-plugin/search-page.cpp
@@ -38,7 +38,8 @@ SearchPage::SearchPage(Window* window) :
 	get_view()->set_selection_mode(GTK_SELECTION_BROWSE);
 
 	g_signal_connect_slot(window->get_search_entry(), "icon-release", &SearchPage::clear_search, this);
-	g_signal_connect_slot(window->get_search_entry(), "key-press-event", &SearchPage::search_entry_key_press, this);
+	g_signal_connect_slot(window->get_search_entry(), "key-press-event", &SearchPage::cancel_search, this);
+	g_signal_connect_slot<GtkEntry*>(window->get_search_entry(), "activate", &SearchPage::activate_search, this);
 }
 
 //-----------------------------------------------------------------------------
@@ -184,6 +185,18 @@ void SearchPage::unset_menu_items()
 
 //-----------------------------------------------------------------------------
 
+void SearchPage::activate_search()
+{
+	GtkTreePath* path = get_view()->get_selected_path();
+	if (path)
+	{
+		get_view()->activate_path(path);
+		gtk_tree_path_free(path);
+	}
+}
+
+//-----------------------------------------------------------------------------
+
 void SearchPage::clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos, GdkEvent*)
 {
 	if (icon_pos == GTK_ENTRY_ICON_SECONDARY)
@@ -194,7 +207,7 @@ void SearchPage::clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos, Gd
 
 //-----------------------------------------------------------------------------
 
-gboolean SearchPage::search_entry_key_press(GtkWidget* widget, GdkEvent* event)
+gboolean SearchPage::cancel_search(GtkWidget* widget, GdkEvent* event)
 {
 	GdkEventKey* key_event = reinterpret_cast<GdkEventKey*>(event);
 	if (key_event->keyval == GDK_Escape)
@@ -211,16 +224,6 @@ gboolean SearchPage::search_entry_key_press(GtkWidget* widget, GdkEvent* event)
 			return false;
 		}
 	}
-	else if (key_event->keyval == GDK_Return || key_event->keyval == GDK_KP_Enter)
-	{
-		GtkTreePath* path = get_view()->get_selected_path();
-		if (path)
-		{
-			get_view()->activate_path(path);
-			gtk_tree_path_free(path);
-		}
-		return true;
-	}
 
 	return false;
 }
diff --git a/panel-plugin/search-page.h b/panel-plugin/search-page.h
index a0925ed..d271841 100644
--- a/panel-plugin/search-page.h
+++ b/panel-plugin/search-page.h
@@ -39,8 +39,9 @@ public:
 	void unset_menu_items();
 
 private:
+	void activate_search();
 	void clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos, GdkEvent*);
-	gboolean search_entry_key_press(GtkWidget* widget, GdkEvent* event);
+	gboolean cancel_search(GtkWidget* widget, GdkEvent* event);
 
 private:
 	Query m_query;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list