From 660b801775b9a58428def543edb541e882bf1167 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 7 May 2013 02:28:13 -0400 Subject: [PATCH] st-bin: Delegate popup-menu signal to child if we have one This makes it much easier to implement correct popup-menu behavior in the case of nested bins. This fixes the context menu key in application search results when a result has focus. https://bugzilla.gnome.org/show_bug.cgi?id=699800 --- src/st/st-bin.c | 10 ++++++++++ src/st/st-widget.c | 14 +++++++++++++- src/st/st-widget.h | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/st/st-bin.c b/src/st/st-bin.c index 0a45148ee..6a3cf0860 100644 --- a/src/st/st-bin.c +++ b/src/st/st-bin.c @@ -187,6 +187,15 @@ st_bin_dispose (GObject *gobject) G_OBJECT_CLASS (st_bin_parent_class)->dispose (gobject); } +static void +st_bin_popup_menu (StWidget *widget) +{ + StBinPrivate *priv = ST_BIN (widget)->priv; + + if (priv->child && ST_IS_WIDGET (priv->child)) + st_widget_popup_menu (ST_WIDGET (priv->child)); +} + static gboolean st_bin_navigate_focus (StWidget *widget, ClutterActor *from, @@ -312,6 +321,7 @@ st_bin_class_init (StBinClass *klass) actor_class->get_preferred_height = st_bin_get_preferred_height; actor_class->allocate = st_bin_allocate; + widget_class->popup_menu = st_bin_popup_menu; widget_class->navigate_focus = st_bin_navigate_focus; /** diff --git a/src/st/st-widget.c b/src/st/st-widget.c index c07dd7b4f..91db0c3d2 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -775,7 +775,7 @@ st_widget_key_press_event (ClutterActor *actor, (event->keyval == CLUTTER_KEY_F10 && (event->modifier_state & CLUTTER_SHIFT_MASK))) { - g_signal_emit (actor, signals[POPUP_MENU], 0); + st_widget_popup_menu (ST_WIDGET (actor)); return TRUE; } @@ -1834,6 +1834,18 @@ st_widget_get_can_focus (StWidget *widget) return widget->priv->can_focus; } +/** + * st_widget_popup_menu: + * @self: A #StWidget + * + * Asks the widget to pop-up a context menu. + */ +void +st_widget_popup_menu (StWidget *self) +{ + g_signal_emit (self, signals[POPUP_MENU], 0); +} + /* filter @children to contain only only actors that overlap @rbox * when moving in @direction. (Assuming no transformations.) */ diff --git a/src/st/st-widget.h b/src/st/st-widget.h index eb9e4cec1..4b600b46a 100644 --- a/src/st/st-widget.h +++ b/src/st/st-widget.h @@ -127,6 +127,7 @@ void st_widget_set_hover (StWidget *widg gboolean hover); void st_widget_sync_hover (StWidget *widget); gboolean st_widget_get_hover (StWidget *widget); +void st_widget_popup_menu (StWidget *self); void st_widget_ensure_style (StWidget *widget);