[gtk+/wip/otte/queue-resize: 21/33] widget: Add a resize_needed flag
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/queue-resize: 21/33] widget: Add a resize_needed flag
- Date: Thu, 1 Oct 2015 21:56:16 +0000 (UTC)
commit 30e16f8c2897f3c2ad4b03117f463ceaa48561e6
Author: Benjamin Otte <otte redhat com>
Date: Mon Sep 28 02:19:25 2015 +0200
widget: Add a resize_needed flag
... and API to set and unset it.
It is set when gtk_widget_queue_resize() is called.
It is unset when gtk_widget_get_preferred_width/height() is called.
So far it is not used.
gtk/gtksizerequest.c | 2 ++
gtk/gtkwidget.c | 12 ++++++++++++
gtk/gtkwidgetprivate.h | 1 +
3 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 393af7c..eb46bd6 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -149,6 +149,8 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
gint nat_baseline = -1;
gboolean found_in_cache;
+ gtk_widget_ensure_resize (widget);
+
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
for_size = -1;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index dc7e755..2912d3e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -16164,7 +16164,19 @@ gtk_widget_queue_resize_on_widget (GtkWidget *widget)
{
GtkWidgetPrivate *priv = widget->priv;
+ priv->resize_needed = TRUE;
priv->alloc_needed = TRUE;
+}
+
+void
+gtk_widget_ensure_resize (GtkWidget *widget)
+{
+ GtkWidgetPrivate *priv = widget->priv;
+
+ if (!priv->resize_needed)
+ return;
+
+ priv->resize_needed = FALSE;
_gtk_size_request_cache_clear (&priv->requests);
}
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 3e6fb51..4229f1e 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -167,6 +167,7 @@ void _gtk_widget_set_shadowed (GtkWidget *widget,
gboolean shadowed);
gboolean _gtk_widget_get_alloc_needed (GtkWidget *widget);
void gtk_widget_queue_resize_on_widget (GtkWidget *widget);
+void gtk_widget_ensure_resize (GtkWidget *widget);
void _gtk_widget_draw (GtkWidget *widget,
cairo_t *cr);
void _gtk_widget_scale_changed (GtkWidget *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]