[Xfce4-commits] <xfce4-indicator-plugin:master> Indicator-button: Pass secondary-activate event
Andrzej
noreply at xfce.org
Fri Sep 20 00:38:01 CEST 2013
Updating branch refs/heads/master
to 243049c116fb8e239580dac0bbaa9bfeb3545ce6 (commit)
from 82fa77eac573b8610f413587231075a5d83cf253 (commit)
commit 243049c116fb8e239580dac0bbaa9bfeb3545ce6
Author: Andrzej <ndrwrdck at gmail.com>
Date: Thu Sep 19 23:35:25 2013 +0100
Indicator-button: Pass secondary-activate event
e.g. for muting audio with middle click in sound indicator
panel-plugin/indicator-button.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/panel-plugin/indicator-button.c b/panel-plugin/indicator-button.c
index 16504ee..6b5fd92 100644
--- a/panel-plugin/indicator-button.c
+++ b/panel-plugin/indicator-button.c
@@ -46,6 +46,8 @@
static void xfce_indicator_button_finalize (GObject *object);
static gboolean xfce_indicator_button_button_press (GtkWidget *widget,
GdkEventButton *event);
+static gboolean xfce_indicator_button_button_release (GtkWidget *widget,
+ GdkEventButton *event);
static gboolean xfce_indicator_button_scroll_event (GtkWidget *widget,
GdkEventScroll *event);
static void xfce_indicator_button_menu_deactivate (XfceIndicatorButton *button,
@@ -94,6 +96,7 @@ xfce_indicator_button_class_init (XfceIndicatorButtonClass *klass)
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->button_press_event = xfce_indicator_button_button_press;
+ widget_class->button_release_event = xfce_indicator_button_button_release;
widget_class->scroll_event = xfce_indicator_button_scroll_event;
widget_class->get_preferred_width = xfce_indicator_button_get_preferred_width;
widget_class->get_preferred_height = xfce_indicator_button_get_preferred_height;
@@ -342,6 +345,23 @@ xfce_indicator_button_button_press (GtkWidget *widget,
static gboolean
+xfce_indicator_button_button_release (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ XfceIndicatorButton *button = XFCE_INDICATOR_BUTTON (widget);
+
+ if(event->button == 2) /* middle button */
+ {
+ g_signal_emit_by_name(button->io, INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE,
+ button->entry, event->time);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+static gboolean
xfce_indicator_button_scroll_event (GtkWidget *widget, GdkEventScroll *event)
{
XfceIndicatorButton *button = XFCE_INDICATOR_BUTTON (widget);
More information about the Xfce4-commits
mailing list