[gtk+] API: widget: Add gtk_widget_queue_allocate()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] API: widget: Add gtk_widget_queue_allocate()
- Date: Wed, 28 Oct 2015 18:57:22 +0000 (UTC)
commit 195397e87ac7e03173dfe65d1cf52e2751c07706
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 cb2a178..75fa743 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5577,6 +5577,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 GtkWidgetClass::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
*
@@ -10979,7 +11001,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,
@@ -14544,7 +14566,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]);
}
@@ -14610,7 +14632,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 e98c537..61881c2 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]