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
This commit is contained in:
parent
eb80503bcc
commit
660b801775
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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.)
|
||||
*/
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user