[gtk+/wip/otte/queue-resize: 10/31] API: widget: Add gtk_widget_queue_allocate()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/queue-resize: 10/31] API: widget: Add gtk_widget_queue_allocate()
- Date: Tue, 29 Sep 2015 21:22:36 +0000 (UTC)
commit 676b48e691f29cad91e6c1e22dbf13d7aa87bc45
Author: Benjamin Otte <otte redhat com>
Date: Mon Sep 14 17:56:05 2015 +0200
API: widget: Add gtk_widget_queue_allocate()
This is so widgets can queue a rerun of their allocation logic, but
without triggering resizes everywhere.
For now, it just calls gtk_widget_queue_resize().
gtk/gtkwidget.c | 28 +++++++++++++++++++++++++---
gtk/gtkwidget.h | 2 ++
2 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 1668f6b..72091dd 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5574,6 +5574,28 @@ gtk_widget_queue_draw (GtkWidget *widget)
}
/**
+ * gtk_widget_queue_allocate:
+ * @widget: a #GtkWidget
+ *
+ * This function is only for use in widget implementations.
+ *
+ * Flags the widget for a rerun of the GtkWidgetClasss::size_allocate
+ * function. Use this function instead of gtk_widget_queue_resize()
+ * when the @widget's size request didn't change but it wants to
+ * reposition its contents.
+ *
+ * An example user of this function is gtk_widget_set_halign().
+ */
+void
+gtk_widget_queue_allocate (GtkWidget *widget)
+{
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ /* for now... */
+ gtk_widget_queue_resize (widget);
+}
+
+/**
* gtk_widget_queue_resize:
* @widget: a #GtkWidget
*
@@ -10978,7 +11000,7 @@ gtk_widget_error_bell (GtkWidget *widget)
settings = gtk_widget_get_settings (widget);
if (!settings)
- return;
+ return;
g_object_get (settings,
"gtk-error-bell", &beep,
@@ -14547,7 +14569,7 @@ gtk_widget_set_halign (GtkWidget *widget,
return;
widget->priv->halign = align;
- gtk_widget_queue_resize (widget);
+ gtk_widget_queue_allocate (widget);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HALIGN]);
}
@@ -14613,7 +14635,7 @@ gtk_widget_set_valign (GtkWidget *widget,
return;
widget->priv->valign = align;
- gtk_widget_queue_resize (widget);
+ gtk_widget_queue_allocate (widget);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_VALIGN]);
}
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 616b565..acb1553 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -663,6 +663,8 @@ GDK_AVAILABLE_IN_ALL
void gtk_widget_queue_resize (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
+GDK_AVAILABLE_IN_3_20
+void gtk_widget_queue_allocate (GtkWidget *widget);
GDK_AVAILABLE_IN_3_8
GdkFrameClock* gtk_widget_get_frame_clock (GtkWidget *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]