[gtk+/wip/baedert/children: 33/44] Move child widget snapshotting into GtkWidget
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/children: 33/44] Move child widget snapshotting into GtkWidget
- Date: Sun, 4 Dec 2016 11:02:00 +0000 (UTC)
commit 7a2ccea7a2d36af90cab33bc332ae61d3a60e661
Author: Timm Bäder <mail baedert org>
Date: Wed Nov 30 11:18:50 2016 +0100
Move child widget snapshotting into GtkWidget
gtk/gtkcontainer.c | 35 -----------------------------------
gtk/gtkwidget.c | 23 ++++++++++++++++++++++-
2 files changed, 22 insertions(+), 36 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index a289ce5..3b05b8f 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -42,7 +42,6 @@
#include "gtkmarshalers.h"
#include "gtksizerequest.h"
#include "gtksizerequestcacheprivate.h"
-#include "gtksnapshotprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkwindow.h"
#include "gtkassistant.h"
@@ -322,8 +321,6 @@ static void gtk_container_children_callback (GtkWidget *widget,
gpointer client_data);
static gint gtk_container_draw (GtkWidget *widget,
cairo_t *cr);
-static void gtk_container_snapshot (GtkWidget *widget,
- GtkSnapshot *snapshot);
static GtkSizeRequestMode gtk_container_get_request_mode (GtkWidget *widget);
static GtkWidgetPath * gtk_container_real_get_path_for_child (GtkContainer *container,
@@ -458,7 +455,6 @@ gtk_container_class_init (GtkContainerClass *class)
widget_class->destroy = gtk_container_destroy;
widget_class->compute_expand = gtk_container_compute_expand;
- widget_class->snapshot = gtk_container_snapshot;
widget_class->draw = gtk_container_draw;
widget_class->focus = gtk_container_focus;
widget_class->get_request_mode = gtk_container_get_request_mode;
@@ -3044,37 +3040,6 @@ gtk_container_draw (GtkWidget *widget,
return FALSE;
}
-static void
-gtk_container_snapshot_forall (GtkWidget *child,
- gpointer snapshot)
-{
- gtk_widget_snapshot_child (_gtk_widget_get_parent (child),
- child,
- snapshot);
-}
-
-static void
-gtk_container_snapshot (GtkWidget *widget,
- GtkSnapshot *snapshot)
-{
- GtkContainer *container = GTK_CONTAINER (widget);
- GtkAllocation allocation, clip;
- graphene_rect_t bounds;
-
- gtk_widget_get_clip (widget, &clip);
- gtk_widget_get_allocation (widget, &allocation);
- graphene_rect_init (&bounds,
- clip.x - allocation.x, clip.y - allocation.y,
- clip.width, clip.height);
- gtk_snapshot_push (snapshot, &bounds, "Children<%s>", G_OBJECT_TYPE_NAME (container));
-
- gtk_container_forall (container,
- gtk_container_snapshot_forall,
- snapshot);
-
- gtk_snapshot_pop (snapshot);
-}
-
static gboolean
gtk_container_should_propagate_draw (GtkContainer *container,
GtkWidget *child,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b55d150..c5e9d1f 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -940,7 +940,28 @@ static void
gtk_widget_real_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
- /* nothing to do here */
+ GtkAllocation allocation, clip;
+ GtkWidget *child;
+ graphene_rect_t bounds;
+
+ gtk_widget_get_clip (widget, &clip);
+ gtk_widget_get_allocation (widget, &allocation);
+ graphene_rect_init (&bounds,
+ clip.x - allocation.x, clip.y - allocation.y,
+ clip.width, clip.height);
+ gtk_snapshot_push (snapshot, &bounds, "Children<%s>", G_OBJECT_TYPE_NAME (widget));
+
+ for (child = _gtk_widget_get_first_child (widget);
+ child != NULL;
+ child = _gtk_widget_get_next_sibling (child))
+ {
+ gtk_widget_snapshot_child (widget,
+ child,
+ snapshot);
+
+ }
+
+ gtk_snapshot_pop (snapshot);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]