[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 113/473: Fix context menu disabling detection of clicks outside menu.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:54:43 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 18ad19b8f885804b282ec2f88e78b163189101ed
Author: Graeme Gott <graeme at gottcode.org>
Date: Mon Jul 15 12:54:04 2013 -0400
Fix context menu disabling detection of clicks outside menu.
---
src/menu.cpp | 15 +++++++++++++++
src/menu.hpp | 6 ++++++
2 files changed, 21 insertions(+)
diff --git a/src/menu.cpp b/src/menu.cpp
index 45ff615..892538a 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -72,6 +72,7 @@ Menu::Menu(XfceRc* settings) :
gtk_widget_add_events(GTK_WIDGET(m_window), GDK_BUTTON_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK | GDK_STRUCTURE_MASK);
g_signal_connect(m_window, "enter-notify-event", G_CALLBACK(Menu::on_enter_notify_event_slot), this);
g_signal_connect(m_window, "leave-notify-event", G_CALLBACK(Menu::on_leave_notify_event_slot), this);
+ g_signal_connect(m_window, "focus-in-event", G_CALLBACK(on_focus_in_event_slot), this);
g_signal_connect(m_window, "button-press-event", G_CALLBACK(Menu::on_button_press_event_slot), this);
g_signal_connect(m_window, "key-press-event", G_CALLBACK(Menu::on_key_press_event_slot), this);
g_signal_connect_after(m_window, "key-press-event", G_CALLBACK(Menu::on_key_press_event_after_slot), this);
@@ -530,6 +531,20 @@ bool Menu::on_leave_notify_event(GdkEventCrossing* event)
//-----------------------------------------------------------------------------
+bool Menu::on_focus_in_event()
+{
+ gdk_pointer_grab(gtk_widget_get_window(GTK_WIDGET(m_window)), true,
+ GdkEventMask(
+ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+ GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
+ GDK_POINTER_MOTION_MASK
+ ),
+ NULL, NULL, gtk_get_current_event_time());
+ return false;
+}
+
+//-----------------------------------------------------------------------------
+
bool Menu::on_button_press_event(GdkEventButton* event)
{
// Hide menu if user clicks outside
diff --git a/src/menu.hpp b/src/menu.hpp
index a29efa2..85a57a5 100644
--- a/src/menu.hpp
+++ b/src/menu.hpp
@@ -85,6 +85,7 @@ public:
private:
bool on_enter_notify_event(GdkEventCrossing* event);
bool on_leave_notify_event(GdkEventCrossing* event);
+ bool on_focus_in_event();
bool on_button_press_event(GdkEventButton* event);
bool on_key_press_event(GtkWidget* widget, GdkEventKey* event);
bool on_key_press_event_after(GtkWidget* widget, GdkEventKey* event);
@@ -142,6 +143,11 @@ private:
return obj->on_leave_notify_event(event);
}
+ static gboolean on_focus_in_event_slot(GtkWidget*, GdkEventFocus*, Menu* obj)
+ {
+ return obj->on_focus_in_event();
+ }
+
static gboolean on_button_press_event_slot(GtkWidget*, GdkEventButton* event, Menu* obj)
{
return obj->on_button_press_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