[gtk/wip/otte/matthiasc/popup2: 21/92] label: Use root api for mnemonic setup
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/matthiasc/popup2: 21/92] label: Use root api for mnemonic setup
- Date: Fri, 19 Apr 2019 16:07:02 +0000 (UTC)
commit 0c040e7bfeab238dbbceac6488d1e7bb2cdd572c
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Mar 3 20:02:55 2019 -0500
label: Use root api for mnemonic setup
gtk/gtklabel.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 522a2197a2..d7b5fa82ee 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -254,7 +254,7 @@ struct _GtkLabelPrivate
{
GtkLabelSelectionInfo *select_info;
GtkWidget *mnemonic_widget;
- GtkWindow *mnemonic_window;
+ GtkRoot *mnemonic_root;
PangoAttrList *attrs;
PangoAttrList *markup_attrs;
@@ -477,7 +477,7 @@ static void gtk_label_update_active_link (GtkWidget *widget,
static gboolean gtk_label_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
static void gtk_label_setup_mnemonic (GtkLabel *label,
- GtkWidget *toplevel,
+ GtkRoot *root,
guint last_key);
static void gtk_label_drag_data_get (GtkWidget *widget,
GdkDrag *drag,
@@ -1302,7 +1302,7 @@ gtk_label_init (GtkLabel *label)
priv->attrs = NULL;
priv->mnemonic_widget = NULL;
- priv->mnemonic_window = NULL;
+ priv->mnemonic_root = NULL;
priv->mnemonics_visible = TRUE;
}
@@ -1743,7 +1743,7 @@ gtk_label_mnemonic_activate (GtkWidget *widget,
static void
gtk_label_setup_mnemonic (GtkLabel *label,
- GtkWidget *toplevel,
+ GtkRoot *root,
guint last_key)
{
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
@@ -1754,12 +1754,10 @@ gtk_label_setup_mnemonic (GtkLabel *label,
if (last_key != GDK_KEY_VoidSymbol)
{
- if (priv->mnemonic_window)
+ if (priv->mnemonic_root)
{
- gtk_window_remove_mnemonic (priv->mnemonic_window,
- last_key,
- widget);
- priv->mnemonic_window = NULL;
+ gtk_root_remove_mnemonic (priv->mnemonic_root, last_key, widget);
+ priv->mnemonic_root = NULL;
}
if (mnemonic_menu)
{
@@ -1775,7 +1773,7 @@ gtk_label_setup_mnemonic (GtkLabel *label,
connect_mnemonics_visible_notify (GTK_LABEL (widget));
- if (toplevel && gtk_widget_is_toplevel (toplevel))
+ if (root)
{
GtkWidget *menu_shell;
@@ -1792,10 +1790,8 @@ gtk_label_setup_mnemonic (GtkLabel *label,
if (!GTK_IS_MENU (menu_shell))
{
- gtk_window_add_mnemonic (GTK_WINDOW (toplevel),
- priv->mnemonic_keyval,
- widget);
- priv->mnemonic_window = GTK_WINDOW (toplevel);
+ gtk_root_add_mnemonic (root, priv->mnemonic_keyval, widget);
+ priv->mnemonic_root = root;
}
}
@@ -1811,7 +1807,7 @@ gtk_label_root (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_label_parent_class)->root (widget);
- gtk_label_setup_mnemonic (label, gtk_widget_get_toplevel (widget), priv->mnemonic_keyval);
+ gtk_label_setup_mnemonic (label, gtk_widget_get_root (widget), priv->mnemonic_keyval);
}
static void
@@ -2146,7 +2142,7 @@ gtk_label_recalculate (GtkLabel *label)
if (keyval != priv->mnemonic_keyval)
{
- gtk_label_setup_mnemonic (label, gtk_widget_get_toplevel (GTK_WIDGET (label)), keyval);
+ gtk_label_setup_mnemonic (label, gtk_widget_get_root (GTK_WIDGET (label)), keyval);
g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_MNEMONIC_KEYVAL]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]