St: add a popup-menu signal to StWidget
Add a popup-menu signal to StWidget, and emit it if the user types the Menu key or Shift+F10 while the widget is focused. https://bugzilla.gnome.org/show_bug.cgi?id=618887
This commit is contained in:
parent
af4fcc831e
commit
fe16f2b058
@ -218,7 +218,7 @@ st_button_key_press (ClutterActor *actor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return CLUTTER_ACTOR_CLASS (st_button_parent_class)->key_press_event (actor, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -586,7 +586,7 @@ st_entry_key_press_event (ClutterActor *actor,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->key_press_event (actor, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -103,6 +103,7 @@ enum
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
STYLE_CHANGED,
|
STYLE_CHANGED,
|
||||||
|
POPUP_MENU,
|
||||||
|
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
@ -689,6 +690,21 @@ st_widget_key_focus_out (ClutterActor *actor)
|
|||||||
st_widget_remove_style_pseudo_class (widget, "focus");
|
st_widget_remove_style_pseudo_class (widget, "focus");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
st_widget_key_press_event (ClutterActor *actor,
|
||||||
|
ClutterKeyEvent *event)
|
||||||
|
{
|
||||||
|
if (event->keyval == CLUTTER_KEY_Menu ||
|
||||||
|
(event->keyval == CLUTTER_KEY_F10 &&
|
||||||
|
(event->modifier_state & CLUTTER_SHIFT_MASK)))
|
||||||
|
{
|
||||||
|
g_signal_emit (actor, signals[POPUP_MENU], 0);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
st_widget_hide (ClutterActor *actor)
|
st_widget_hide (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
@ -763,6 +779,7 @@ st_widget_class_init (StWidgetClass *klass)
|
|||||||
actor_class->leave_event = st_widget_leave;
|
actor_class->leave_event = st_widget_leave;
|
||||||
actor_class->key_focus_in = st_widget_key_focus_in;
|
actor_class->key_focus_in = st_widget_key_focus_in;
|
||||||
actor_class->key_focus_out = st_widget_key_focus_out;
|
actor_class->key_focus_out = st_widget_key_focus_out;
|
||||||
|
actor_class->key_press_event = st_widget_key_press_event;
|
||||||
actor_class->hide = st_widget_hide;
|
actor_class->hide = st_widget_hide;
|
||||||
|
|
||||||
actor_class->get_accessible = st_widget_get_accessible;
|
actor_class->get_accessible = st_widget_get_accessible;
|
||||||
@ -918,6 +935,7 @@ st_widget_class_init (StWidgetClass *klass)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* StWidget::style-changed:
|
* StWidget::style-changed:
|
||||||
|
* @widget: the #StWidget
|
||||||
*
|
*
|
||||||
* Emitted when the style information that the widget derives from the
|
* Emitted when the style information that the widget derives from the
|
||||||
* theme changes
|
* theme changes
|
||||||
@ -930,6 +948,22 @@ st_widget_class_init (StWidgetClass *klass)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_st_marshal_VOID__VOID,
|
_st_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* StWidget::popup-menu:
|
||||||
|
* @widget: the #StWidget
|
||||||
|
*
|
||||||
|
* Emitted when the user has requested a context menu (eg, via a
|
||||||
|
* keybinding)
|
||||||
|
*/
|
||||||
|
signals[POPUP_MENU] =
|
||||||
|
g_signal_new ("popup-menu",
|
||||||
|
G_TYPE_FROM_CLASS (klass),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
G_STRUCT_OFFSET (StWidgetClass, popup_menu),
|
||||||
|
NULL, NULL,
|
||||||
|
_st_marshal_VOID__VOID,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,13 +77,15 @@ struct _StWidgetClass
|
|||||||
/*< private >*/
|
/*< private >*/
|
||||||
ClutterActorClass parent_class;
|
ClutterActorClass parent_class;
|
||||||
|
|
||||||
/* vfuncs */
|
/* signals */
|
||||||
void (* style_changed) (StWidget *self);
|
void (* style_changed) (StWidget *self);
|
||||||
gboolean (* navigate_focus) (StWidget *self,
|
void (* popup_menu) (StWidget *self);
|
||||||
ClutterActor *from,
|
|
||||||
GtkDirectionType direction);
|
|
||||||
|
|
||||||
GType (*get_accessible_type) (void);
|
/* vfuncs */
|
||||||
|
gboolean (* navigate_focus) (StWidget *self,
|
||||||
|
ClutterActor *from,
|
||||||
|
GtkDirectionType direction);
|
||||||
|
GType (* get_accessible_type) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType st_widget_get_type (void) G_GNUC_CONST;
|
GType st_widget_get_type (void) G_GNUC_CONST;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user