[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 01/01: Add keyboard navigation for categories. (bug #11550)

noreply at xfce.org noreply at xfce.org
Fri Mar 20 18:23:24 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 af5e8af6f92faad479bb90bf41dfb50f8210b376
Author: Graeme Gott <graeme at gottcode.org>
Date:   Fri Mar 20 13:14:22 2015 -0400

    Add keyboard navigation for categories. (bug #11550)
---
 panel-plugin/window.cpp |   48 +++++++++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 18 deletions(-)

diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index fdfdf80..2518d1a 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -715,28 +715,40 @@ gboolean WhiskerMenu::Window::on_key_press_event(GtkWidget* widget, GdkEvent* ev
 		return true;
 	}
 
-	// Make up and down keys always scroll current list of applications
-	if ((key_event->keyval == GDK_KEY_Up) || (key_event->keyval == GDK_KEY_Down))
+	Page* page = NULL;
+	if (gtk_widget_get_visible(m_search_results->get_widget()))
 	{
-		GtkWidget* view = NULL;
-		if (gtk_widget_get_visible(m_search_results->get_widget()))
-		{
-			view = m_search_results->get_view()->get_widget();
-		}
-		else if (m_favorites_button->get_active())
-		{
-			view = m_favorites->get_view()->get_widget();
-		}
-		else if (m_recent_button->get_active())
-		{
-			view = m_recent->get_view()->get_widget();
-		}
-		else
+		page = m_search_results;
+	}
+	else if (m_favorites_button->get_active())
+	{
+		page = m_favorites;
+	}
+	else if (m_recent_button->get_active())
+	{
+		page = m_recent;
+	}
+	else
+	{
+		page = m_applications;
+	}
+	GtkWidget* view = page->get_view()->get_widget();
+
+	// Allow keyboard navigation out of treeview
+	if ((key_event->keyval == GDK_KEY_Left) || (key_event->keyval == GDK_KEY_Right))
+	{
+		if ((widget == view) || (gtk_window_get_focus(m_window) == view))
 		{
-			view = m_applications->get_view()->get_widget();
+			gtk_widget_grab_focus(GTK_WIDGET(m_favorites_button->get_button()));
+			page->reset_selection();
 		}
+	}
 
-		if ((widget != view) && (gtk_window_get_focus(m_window) != view))
+	// Make up and down keys scroll current list of applications from search
+	if ((key_event->keyval == GDK_KEY_Up) || (key_event->keyval == GDK_KEY_Down))
+	{
+		GtkWidget* search = GTK_WIDGET(m_search_entry);
+		if ((widget == search) || (gtk_window_get_focus(m_window) == search))
 		{
 			gtk_widget_grab_focus(view);
 		}

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


More information about the Xfce4-commits mailing list