[gtk+/wip/baedert/children: 6/15] widget: Implement map/unmap with child widgets
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/children: 6/15] widget: Implement map/unmap with child widgets
- Date: Tue, 22 Nov 2016 11:28:47 +0000 (UTC)
commit 63e6d03775eb59e28d737002498552acba1fc5d1
Author: Timm Bäder <mail baedert org>
Date: Fri Nov 18 09:50:52 2016 +0100
widget: Implement map/unmap with child widgets
Once again, do what GtkContainer did before.
gtk/gtkcontainer.c | 34 ----------------------------------
gtk/gtkwidget.c | 23 +++++++++++++++++++++--
2 files changed, 21 insertions(+), 36 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 66983bc..4fcaf57 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -326,8 +326,6 @@ static gint gtk_container_draw (GtkWidget *widget,
cairo_t *cr);
static void gtk_container_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static void gtk_container_map (GtkWidget *widget);
-static void gtk_container_unmap (GtkWidget *widget);
static GtkSizeRequestMode gtk_container_get_request_mode (GtkWidget *widget);
static GtkWidgetPath * gtk_container_real_get_path_for_child (GtkContainer *container,
@@ -464,8 +462,6 @@ gtk_container_class_init (GtkContainerClass *class)
widget_class->compute_expand = gtk_container_compute_expand;
widget_class->snapshot = gtk_container_snapshot;
widget_class->draw = gtk_container_draw;
- widget_class->map = gtk_container_map;
- widget_class->unmap = gtk_container_unmap;
widget_class->focus = gtk_container_focus;
widget_class->get_request_mode = gtk_container_get_request_mode;
@@ -3098,36 +3094,6 @@ gtk_container_snapshot (GtkWidget *widget,
gtk_snapshot_pop (snapshot);
}
-static void
-gtk_container_map_child (GtkWidget *child,
- gpointer client_data)
-{
- if (_gtk_widget_get_visible (child) &&
- _gtk_widget_get_child_visible (child) &&
- !_gtk_widget_get_mapped (child))
- gtk_widget_map (child);
-}
-
-static void
-gtk_container_map (GtkWidget *widget)
-{
- GTK_WIDGET_CLASS (parent_class)->map (widget);
-
- gtk_container_forall (GTK_CONTAINER (widget),
- gtk_container_map_child,
- NULL);
-}
-
-static void
-gtk_container_unmap (GtkWidget *widget)
-{
- GTK_WIDGET_CLASS (parent_class)->unmap (widget);
-
- gtk_container_forall (GTK_CONTAINER (widget),
- (GtkCallback)gtk_widget_unmap,
- NULL);
-}
-
static gboolean
gtk_container_should_propagate_draw (GtkContainer *container,
GtkWidget *child,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3827232..f26e966 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -10783,10 +10783,21 @@ gtk_widget_real_map (GtkWidget *widget)
if (!_gtk_widget_get_mapped (widget))
{
+ GtkWidget *p;
priv->mapped = TRUE;
if (_gtk_widget_get_has_window (widget))
- gdk_window_show (priv->window);
+ gdk_window_show (priv->window);
+
+ for (p = gtk_widget_get_first_child (widget);
+ p != NULL;
+ p = gtk_widget_get_next_sibling (p))
+ {
+ if (_gtk_widget_get_visible (p) &&
+ _gtk_widget_get_child_visible (p) &&
+ !_gtk_widget_get_mapped (p))
+ gtk_widget_map (p);
+ }
}
}
@@ -10805,10 +10816,18 @@ gtk_widget_real_unmap (GtkWidget *widget)
if (_gtk_widget_get_mapped (widget))
{
+ GtkWidget *child;
priv->mapped = FALSE;
if (_gtk_widget_get_has_window (widget))
- gdk_window_hide (priv->window);
+ gdk_window_hide (priv->window);
+
+ for (child = gtk_widget_get_first_child (widget);
+ chlid != NULL;
+ child = gtk_widget_get_next_sibling (child))
+ {
+ gtk_widget_unmap (child);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]