[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 101/473: Work around interaction between scrolling and hover selection. Closes #7.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:54:31 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 974f0f9f131ac7513a32bf85fa5f5806d87848d8
Author: Graeme Gott <graeme at gottcode.org>
Date:   Sat Jul 13 16:24:20 2013 -0400

    Work around interaction between scrolling and hover selection. Closes #7.
---
 src/launcher_view.cpp |   25 +++++++++++++++++++++++++
 src/launcher_view.hpp |   14 ++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/src/launcher_view.cpp b/src/launcher_view.cpp
index ac01fed..177a9ac 100644
--- a/src/launcher_view.cpp
+++ b/src/launcher_view.cpp
@@ -24,6 +24,7 @@
 extern "C"
 {
 #include <exo/exo.h>
+#include <gdk/gdkkeysyms.h>
 }
 
 using namespace WhiskerMenu;
@@ -45,6 +46,8 @@ LauncherView::LauncherView() :
 	gtk_tree_view_set_hover_selection(m_view, true);
 	gtk_tree_view_set_enable_search(m_view, false);
 	create_column();
+	g_signal_connect(m_view, "key-press-event", G_CALLBACK(LauncherView::on_key_press_event_slot), this);
+	g_signal_connect(m_view, "key-release-event", G_CALLBACK(LauncherView::on_key_release_event_slot), this);
 
 	// Use single clicks to activate items
 	exo_tree_view_set_single_click(EXO_TREE_VIEW(m_view), true);
@@ -191,3 +194,25 @@ void LauncherView::create_column()
 }
 
 //-----------------------------------------------------------------------------
+
+bool LauncherView::on_key_press_event(GdkEventKey* event)
+{
+	if ((event->keyval == GDK_KEY_Up) || (event->keyval == GDK_KEY_Down))
+	{
+		gtk_tree_view_set_hover_selection(m_view, false);
+	}
+	return false;
+}
+
+//-----------------------------------------------------------------------------
+
+bool LauncherView::on_key_release_event(GdkEventKey* event)
+{
+	if ((event->keyval == GDK_KEY_Up) || (event->keyval == GDK_KEY_Down))
+	{
+		gtk_tree_view_set_hover_selection(m_view, true);
+	}
+	return false;
+}
+
+//-----------------------------------------------------------------------------
diff --git a/src/launcher_view.hpp b/src/launcher_view.hpp
index 40afe6b..ff3064a 100644
--- a/src/launcher_view.hpp
+++ b/src/launcher_view.hpp
@@ -64,12 +64,26 @@ public:
 
 private:
 	void create_column();
+	bool on_key_press_event(GdkEventKey* event);
+	bool on_key_release_event(GdkEventKey* event);
 
 private:
 	GtkTreeModel* m_model;
 	GtkTreeView* m_view;
 	GtkTreeViewColumn* m_column;
 	GtkCellRenderer* m_icon_renderer;
+
+
+private:
+	static gboolean on_key_press_event_slot(GtkWidget*, GdkEventKey* event, LauncherView* obj)
+	{
+		return obj->on_key_press_event(event);
+	}
+
+	static gboolean on_key_release_event_slot(GtkWidget*, GdkEventKey* event, LauncherView* obj)
+	{
+		return obj->on_key_release_event(event);
+	}
 };
 
 }

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


More information about the Xfce4-commits mailing list