[gtk+] widget: Implement map/unmap with child widgets
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget: Implement map/unmap with child widgets
- Date: Sat, 7 Jan 2017 16:20:40 +0000 (UTC)
commit 8ef73660e41f78442da7ab270469ff5acc876054
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 91a155a..39fc7c4 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;
@@ -3087,36 +3083,6 @@ gtk_container_snapshot (GtkWidget *widget,
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 ea9380e..82dadbe 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -10636,10 +10636,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);
+ }
}
}
@@ -10658,10 +10669,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);
+ child != 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]