[gnome-shell] st-bin: Delegate popup-menu signal to child if we have one
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st-bin: Delegate popup-menu signal to child if we have one
- Date: Tue, 7 May 2013 09:15:20 +0000 (UTC)
commit 660b801775b9a58428def543edb541e882bf1167
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue May 7 02:28:13 2013 -0400
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 deletions(-)
---
diff --git a/src/st/st-bin.c b/src/st/st-bin.c
index 0a45148..6a3cf08 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 c07dd7b..91db0c3 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 eb9e4ce..4b600b4 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]