[gtk+] Don't hide windows and popovers in init()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Don't hide windows and popovers in init()
- Date: Fri, 20 Jan 2017 21:00:03 +0000 (UTC)
commit ab051fd53f8176665c36620a1616014e4c9a59df
Author: Timm Bäder <mail baedert org>
Date: Fri Jan 20 10:37:29 2017 +0100
Don't hide windows and popovers in init()
Instead, don't make them visible in gtk_widget_init in the first place.
gtk/gtkpopover.c | 2 --
gtk/gtkwidget.c | 14 ++++++++++++--
gtk/gtkwindow.c | 3 ---
3 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 4d98abd..4a6c753 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -220,8 +220,6 @@ gtk_popover_init (GtkPopover *popover)
context = gtk_widget_get_style_context (GTK_WIDGET (popover));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BACKGROUND);
-
- gtk_widget_hide (widget);
}
static void
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index d216298..e46bcce 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -772,6 +772,9 @@ static gboolean event_window_is_still_viewable (GdkEvent *event);
static void gtk_widget_update_input_shape (GtkWidget *widget);
+static gboolean gtk_widget_class_get_visible_by_default (GtkWidgetClass *widget_class);
+
+
/* --- variables --- */
static gint GtkWidget_private_offset = 0;
static gpointer gtk_widget_parent_class = NULL;
@@ -3783,7 +3786,7 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
widget->priv = gtk_widget_get_instance_private (widget);
priv = widget->priv;
- priv->visible = TRUE;
+ priv->visible = gtk_widget_class_get_visible_by_default (g_class);
priv->child_visible = TRUE;
priv->name = NULL;
priv->allocation.x = -1;
@@ -3843,7 +3846,7 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
priv->cssnode = gtk_css_widget_node_new (widget);
gtk_css_node_set_state (priv->cssnode, priv->state_flags);
- gtk_css_node_set_visible (priv->cssnode, TRUE);
+ gtk_css_node_set_visible (priv->cssnode, priv->visible);
/* need to set correct type here, and only class has the correct type here */
gtk_css_node_set_widget_type (priv->cssnode, G_TYPE_FROM_CLASS (g_class));
}
@@ -14536,6 +14539,13 @@ gtk_widget_class_set_css_name (GtkWidgetClass *widget_class,
priv->css_name = g_intern_string (name);
}
+static gboolean
+gtk_widget_class_get_visible_by_default (GtkWidgetClass *widget_class)
+{
+ return !(GTK_IS_WINDOW_CLASS (widget_class) ||
+ GTK_IS_POPOVER_CLASS (widget_class));
+}
+
/**
* gtk_widget_class_get_css_name:
* @widget_class: class to set the name on
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 66e804c..f22b9ec 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1714,9 +1714,6 @@ gtk_window_init (GtkWindow *window)
GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
dnd_dest_targets, G_N_ELEMENTS (dnd_dest_targets),
GDK_ACTION_MOVE);
-
-
- gtk_widget_hide (GTK_WIDGET (window));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]