[gtk+/wip/colorchooser-v2: 25/40] Allow context menus on scale sliders



commit 50d8e3e0280985acab67e06247445407217e2e41
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 3 01:41:07 2012 -0500

    Allow context menus on scale sliders
    
    This will be used for a popup in the color chooser.

 gtk/gtkrange.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index ddd669c..14c72f9 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2548,6 +2548,16 @@ gtk_range_button_press (GtkWidget      *widget,
   if (gtk_range_update_mouse_location (range))
     gtk_widget_queue_draw (widget);
 
+  if (priv->mouse_location == MOUSE_SLIDER &&
+      gdk_event_triggers_context_menu ((GdkEvent *)event))
+    {
+      gboolean handled;
+
+      g_signal_emit_by_name (widget, "popup-menu", &handled);
+
+      return TRUE;
+    }
+
   if (priv->mouse_location == MOUSE_TROUGH  &&
       event->button == GDK_BUTTON_PRIMARY)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]