summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/gtk/meson.build1
-rw-r--r--gtk/gtkactionbar.c1
-rw-r--r--gtk/gtkbutton.c1
-rw-r--r--gtk/gtkcheckbutton.c1
-rw-r--r--gtk/gtkcontainer.c122
-rw-r--r--gtk/gtkcontainerprivate.h38
-rw-r--r--gtk/gtkcsswidgetnode.c8
-rw-r--r--gtk/gtkdialog.c1
-rw-r--r--gtk/gtkexpander.c1
-rw-r--r--gtk/gtkfixed.c1
-rw-r--r--gtk/gtkflowbox.c1
-rw-r--r--gtk/gtkframe.c1
-rw-r--r--gtk/gtkgrid.c1
-rw-r--r--gtk/gtkgridlayout.c1
-rw-r--r--gtk/gtkheaderbar.c1
-rw-r--r--gtk/gtklistbox.c1
-rw-r--r--gtk/gtkmodelbutton.c1
-rw-r--r--gtk/gtkpaned.c1
-rw-r--r--gtk/gtksizegroup.c1
-rw-r--r--gtk/gtkstack.c1
-rw-r--r--gtk/gtkwidget.c11
-rw-r--r--gtk/gtkwindow.c109
-rw-r--r--gtk/gtkwindowprivate.h5
23 files changed, 118 insertions, 192 deletions
diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build
index 91bab44088..8b66214e20 100644
--- a/docs/reference/gtk/meson.build
+++ b/docs/reference/gtk/meson.build
@@ -23,7 +23,6 @@ private_headers = [
'gtkcolorscaleprivate.h',
'gtkcolorswatchprivate.h',
'gtkcomboboxprivate.h',
- 'gtkcontainerprivate.h',
'gtkconstraintexpressionprivate.h',
'gtkconstraintguideprivate.h',
'gtkconstraintlayoutprivate.h',
diff --git a/gtk/gtkactionbar.c b/gtk/gtkactionbar.c
index ad468a0705..3705e46d9f 100644
--- a/gtk/gtkactionbar.c
+++ b/gtk/gtkactionbar.c
@@ -27,7 +27,6 @@
#include "gtkbox.h"
#include "gtkrevealer.h"
#include "gtkwidgetprivate.h"
-#include "gtkcontainerprivate.h"
#include "gtkprivate.h"
#include "gtkcenterbox.h"
#include "gtkbinlayout.h"
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 666c403a0f..947e440a63 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -57,7 +57,6 @@
#include "gtkactionhelperprivate.h"
#include "gtkcheckbutton.h"
-#include "gtkcontainerprivate.h"
#include "gtkgestureclick.h"
#include "gtkeventcontrollerkey.h"
#include "gtkimage.h"
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 795e41c2de..5411ef5d9c 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -33,7 +33,6 @@
#include "gtkprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkcssnodeprivate.h"
-#include "gtkcontainerprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkradiobutton.h"
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index a2cbd1b8b9..38ef0b1399 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -24,8 +24,6 @@
#include "config.h"
-#include "gtkcontainerprivate.h"
-
#include "gtkadjustment.h"
#include "gtkbuildable.h"
#include "gtkbuilderprivate.h"
@@ -86,14 +84,6 @@
* See more about implementing custom widgets at https://wiki.gnome.org/HowDoI/CustomWidgets
*/
-
-struct _GtkContainerPrivate
-{
- guint resize_handler;
-
- guint restyle_pending : 1;
-};
-
enum {
ADD,
REMOVE,
@@ -120,7 +110,6 @@ static GtkBuildableIface *parent_buildable_iface;
static guint container_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkContainer, gtk_container, GTK_TYPE_WIDGET,
- G_ADD_PRIVATE (GtkContainer)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_container_buildable_init))
@@ -236,10 +225,6 @@ static void
gtk_container_destroy (GtkWidget *widget)
{
GtkContainer *container = GTK_CONTAINER (widget);
- GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
-
- if (priv->restyle_pending)
- priv->restyle_pending = FALSE;
gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
@@ -324,113 +309,6 @@ gtk_container_remove (GtkContainer *container,
g_object_unref (container);
}
-static gboolean
-gtk_container_needs_idle_sizer (GtkContainer *container)
-{
- GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
-
- if (priv->restyle_pending)
- return TRUE;
-
- return gtk_widget_needs_allocate (GTK_WIDGET (container));
-}
-
-static void
-gtk_container_idle_sizer (GdkFrameClock *clock,
- GtkContainer *container)
-{
- GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
-
- /* We validate the style contexts in a single loop before even trying
- * to handle resizes instead of doing validations inline.
- * This is mostly necessary for compatibility reasons with old code,
- * because both css_changed and size_allocate functions often change
- * styles and so could cause infinite loops in this function.
- *
- * It's important to note that even an invalid style context returns
- * sane values. So the result of an invalid style context will never be
- * a program crash, but only a wrong layout or rendering.
- */
- if (priv->restyle_pending)
- {
- priv->restyle_pending = FALSE;
- gtk_css_node_validate (gtk_widget_get_css_node (GTK_WIDGET (container)));
- }
-
- /* we may be invoked with a container_resize_queue of NULL, because
- * queue_resize could have been adding an extra idle function while
- * the queue still got processed. we better just ignore such case
- * than trying to explicitly work around them with some extra flags,
- * since it doesn't cause any actual harm.
- */
- if (gtk_widget_needs_allocate (GTK_WIDGET (container)))
- {
- if (GTK_IS_ROOT (container))
- gtk_native_check_resize (GTK_NATIVE (container));
- else
- g_warning ("gtk_container_idle_sizer() called on a non-native non-window");
- }
-
- if (!gtk_container_needs_idle_sizer (container))
- {
- gtk_container_stop_idle_sizer (container);
- }
- else
- {
- gdk_frame_clock_request_phase (clock,
- GDK_FRAME_CLOCK_PHASE_LAYOUT);
- }
-}
-
-void
-gtk_container_start_idle_sizer (GtkContainer *container)
-{
- GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
- GdkFrameClock *clock;
-
- if (priv->resize_handler != 0)
- return;
-
- if (!gtk_container_needs_idle_sizer (container))
- return;
-
- clock = gtk_widget_get_frame_clock (GTK_WIDGET (container));
- if (clock == NULL)
- return;
-
- priv->resize_handler = g_signal_connect (clock, "layout",
- G_CALLBACK (gtk_container_idle_sizer), container);
- gdk_frame_clock_request_phase (clock,
- GDK_FRAME_CLOCK_PHASE_LAYOUT);
-}
-
-void
-gtk_container_stop_idle_sizer (GtkContainer *container)
-{
- GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
-
- if (priv->resize_handler == 0)
- return;
-
- g_signal_handler_disconnect (gtk_widget_get_frame_clock (GTK_WIDGET (container)),
- priv->resize_handler);
- priv->resize_handler = 0;
-}
-
-void
-_gtk_container_queue_restyle (GtkContainer *container)
-{
- GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
-
- g_return_if_fail (GTK_CONTAINER (container));
-
- if (priv->restyle_pending)
- return;
-
- priv->restyle_pending = TRUE;
- gtk_container_start_idle_sizer (container);
-}
-
static GtkSizeRequestMode
gtk_container_get_request_mode (GtkWidget *widget)
{
diff --git a/gtk/gtkcontainerprivate.h b/gtk/gtkcontainerprivate.h
deleted file mode 100644
index 74f24ddc90..0000000000
--- a/gtk/gtkcontainerprivate.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* GTK - The GIMP Toolkit
- *
- * Copyright (C) 2011 Javier Jardón
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef __GTK_CONTAINER_PRIVATE_H__
-#define __GTK_CONTAINER_PRIVATE_H__
-
-#include "gtkcontainer.h"
-#include <gsk/gsk.h>
-
-G_BEGIN_DECLS
-
-
-void _gtk_container_queue_restyle (GtkContainer *container);
-void gtk_container_stop_idle_sizer (GtkContainer *container);
-void gtk_container_start_idle_sizer (GtkContainer *container);
-void gtk_container_set_focus_child (GtkContainer *container,
- GtkWidget *child);
-
-
-G_END_DECLS
-
-#endif /* __GTK_CONTAINER_PRIVATE_H__ */
diff --git a/gtk/gtkcsswidgetnode.c b/gtk/gtkcsswidgetnode.c
index 7a3a37ffc1..b8aaf45302 100644
--- a/gtk/gtkcsswidgetnode.c
+++ b/gtk/gtkcsswidgetnode.c
@@ -19,12 +19,12 @@
#include "gtkcsswidgetnodeprivate.h"
-#include "gtkcontainerprivate.h"
#include "gtkcssanimatedstyleprivate.h"
#include "gtkprivate.h"
#include "gtksettingsprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkwidgetprivate.h"
+#include "gtkwindowprivate.h"
G_DEFINE_TYPE (GtkCssWidgetNode, gtk_css_widget_node, GTK_TYPE_CSS_NODE)
@@ -46,7 +46,7 @@ gtk_css_widget_node_queue_callback (GtkWidget *widget,
GtkCssNode *node = user_data;
gtk_css_node_invalidate_frame_clock (node, TRUE);
- _gtk_container_queue_restyle (GTK_CONTAINER (widget));
+ gtk_window_queue_restyle (GTK_WINDOW (widget));
return G_SOURCE_CONTINUE;
}
@@ -56,9 +56,7 @@ gtk_css_widget_node_queue_validate (GtkCssNode *node)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
- if (widget_node->widget &&
- GTK_IS_ROOT (widget_node->widget) &&
- GTK_IS_CONTAINER (widget_node->widget))
+ if (widget_node->widget && GTK_IS_ROOT (widget_node->widget))
widget_node->validate_cb_id = gtk_widget_add_tick_callback (widget_node->widget,
gtk_css_widget_node_queue_callback,
node,
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index a2cc9e15ef..f0c73d67f9 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -35,7 +35,6 @@
#include "gtklabel.h"
#include "gtkmarshalers.h"
#include "gtkbox.h"
-#include "gtkcontainerprivate.h"
#include "gtkmain.h"
#include "gtkintl.h"
#include "gtkprivate.h"
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index d7d4f89ec3..0cd753fe01 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -114,7 +114,6 @@
#include "gtkbox.h"
#include "gtkbuildable.h"
-#include "gtkcontainerprivate.h"
#include "gtkdropcontrollermotion.h"
#include "gtkbuiltiniconprivate.h"
#include "gtkgestureclick.h"
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 8049b70e43..3d35f0a24b 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -71,7 +71,6 @@
#include "gtkfixed.h"
-#include "gtkcontainerprivate.h"
#include "gtkfixedlayout.h"
#include "gtkintl.h"
#include "gtkprivate.h"
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 7fb0a58857..e0f0a61317 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -79,7 +79,6 @@
#include "gtkflowboxprivate.h"
#include "gtkadjustment.h"
-#include "gtkcontainerprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkgesturedrag.h"
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 00d7333c55..26880beb20 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -32,7 +32,6 @@
#include "gtkbuildable.h"
#include "gtkcssnodeprivate.h"
#include "gtkwidgetprivate.h"
-#include "gtkcontainerprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtklabel.h"
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index a0c3ac107e..89af6bc311 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -22,7 +22,6 @@
#include "gtkgrid.h"
-#include "gtkcontainerprivate.h"
#include "gtkcsspositionvalueprivate.h"
#include "gtkgridlayout.h"
#include "gtkorientableprivate.h"
diff --git a/gtk/gtkgridlayout.c b/gtk/gtkgridlayout.c
index f913490741..b77169e76f 100644
--- a/gtk/gtkgridlayout.c
+++ b/gtk/gtkgridlayout.c
@@ -44,7 +44,6 @@
#include "gtkgridlayout.h"
-#include "gtkcontainerprivate.h"
#include "gtkcsspositionvalueprivate.h"
#include "gtkdebug.h"
#include "gtkintl.h"
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index eb5bca55a4..b9a1495233 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -25,7 +25,6 @@
#include "gtkbutton.h"
#include "gtkbuildable.h"
#include "gtkcenterlayout.h"
-#include "gtkcontainerprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkimage.h"
#include "gtkintl.h"
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 2ca063710e..28f7299023 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -22,7 +22,6 @@
#include "gtkactionhelperprivate.h"
#include "gtkadjustmentprivate.h"
#include "gtkbuildable.h"
-#include "gtkcontainerprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkgestureclick.h"
#include "gtkintl.h"
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index a6501c1dd5..61b9e3a955 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -37,7 +37,6 @@
#include "gtkcssnodeprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkstylecontextprivate.h"
-#include "gtkcontainerprivate.h"
#include "gtkbuiltiniconprivate.h"
#include "gtksizegroup.h"
#include "gtkaccellabelprivate.h"
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index a4f0a5bd24..b39d5bd56a 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -26,7 +26,6 @@
#include "gtkpaned.h"
-#include "gtkcontainerprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkeventcontrollermotion.h"
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index 2be53f5214..047ac24e16 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -27,7 +27,6 @@
#include "gtkprivate.h"
#include "gtksizegroup-private.h"
#include "gtkwidgetprivate.h"
-#include "gtkcontainerprivate.h"
/**
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 887c9cf6c9..2efdd2be06 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -25,7 +25,6 @@
#include "gtkstack.h"
#include "gtkprivate.h"
#include "gtkintl.h"
-#include "gtkcontainerprivate.h"
#include "gtkprogresstrackerprivate.h"
#include "gtksettingsprivate.h"
#include "gtksnapshot.h"
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index f21586913b..b1c9bea8bd 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -31,7 +31,6 @@
#include "gtkapplicationprivate.h"
#include "gtkbuildable.h"
#include "gtkbuilderprivate.h"
-#include "gtkcontainerprivate.h"
#include "gtkcssboxesprivate.h"
#include "gtkcssfiltervalueprivate.h"
#include "gtkcsstransformvalueprivate.h"
@@ -3104,9 +3103,6 @@ gtk_widget_connect_frame_clock (GtkWidget *widget)
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GdkFrameClock *frame_clock;
- if (GTK_IS_CONTAINER (widget) && GTK_IS_ROOT (widget))
- gtk_container_start_idle_sizer (GTK_CONTAINER (widget));
-
frame_clock = gtk_widget_get_frame_clock (widget);
if (priv->tick_callbacks != NULL && !priv->clock_tick_id)
@@ -3125,9 +3121,6 @@ gtk_widget_disconnect_frame_clock (GtkWidget *widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
- if (GTK_IS_CONTAINER (widget) && GTK_IS_ROOT (widget))
- gtk_container_stop_idle_sizer (GTK_CONTAINER (widget));
-
gtk_css_node_invalidate_frame_clock (priv->cssnode, FALSE);
if (priv->clock_tick_id)
@@ -10444,9 +10437,9 @@ gtk_widget_set_alloc_needed (GtkWidget *widget)
if (!priv->visible)
break;
- if (GTK_IS_ROOT (widget))
+ if (GTK_IS_WINDOW (widget))
{
- gtk_container_start_idle_sizer (GTK_CONTAINER (widget));
+ gtk_window_start_layout (GTK_WINDOW (widget));
break;
}
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index fdc0cf8f1b..c02742e055 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -33,7 +33,6 @@
#include "gtkbuilderprivate.h"
#include "gtkbutton.h"
#include "gtkcheckbutton.h"
-#include "gtkcontainerprivate.h"
#include "gtkcsscornervalueprivate.h"
#include "gtkcssiconthemevalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
@@ -239,8 +238,12 @@ typedef struct
guint hide_on_close : 1;
guint in_emit_close_request : 1;
+ guint restyle_pending : 1;
+
GdkSurfaceTypeHint type_hint;
+ guint resize_handler;
+
GtkGesture *click_gesture;
GtkGesture *drag_gesture;
GtkGesture *bubble_drag_gesture;
@@ -3997,6 +4000,9 @@ gtk_window_destroy (GtkWidget *widget)
if (priv->group)
gtk_window_group_remove_window (priv->group, window);
+ if (priv->restyle_pending)
+ priv->restyle_pending = FALSE;
+
GTK_WIDGET_CLASS (gtk_window_parent_class)->destroy (widget);
}
@@ -4798,6 +4804,8 @@ gtk_window_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_window_parent_class)->realize (widget);
+ gtk_window_start_layout (window);
+
if (priv->renderer == NULL)
priv->renderer = gsk_renderer_new_for_surface (surface);
@@ -4913,6 +4921,8 @@ gtk_window_unrealize (GtkWidget *widget)
g_signal_handlers_disconnect_by_func (surface, surface_render, widget);
g_signal_handlers_disconnect_by_func (surface, surface_event, widget);
+ gtk_window_stop_layout (window);
+
GTK_WIDGET_CLASS (gtk_window_parent_class)->unrealize (widget);
gdk_surface_set_widget (surface, NULL);
@@ -8008,3 +8018,100 @@ gtk_window_maybe_update_cursor (GtkWindow *window,
break;
}
}
+
+static gboolean
+gtk_window_needs_layout (GtkWindow *window)
+{
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+
+ if (priv->restyle_pending)
+ return TRUE;
+
+ return gtk_widget_needs_allocate (GTK_WIDGET (window));
+}
+
+static void
+gtk_window_layout_cb (GdkFrameClock *clock,
+ GtkWindow *window)
+{
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+ GtkWidget *widget = GTK_WIDGET (window);
+
+ /* We validate the style contexts in a single loop before even trying
+ * to handle resizes instead of doing validations inline.
+ * This is mostly necessary for compatibility reasons with old code,
+ * because both css_changed and size_allocate functions often change
+ * styles and so could cause infinite loops in this function.
+ *
+ * It's important to note that even an invalid style context returns
+ * sane values. So the result of an invalid style context will never be
+ * a program crash, but only a wrong layout or rendering.
+ */
+ if (priv->restyle_pending)
+ {
+ priv->restyle_pending = FALSE;
+ gtk_css_node_validate (gtk_widget_get_css_node (widget));
+ }
+
+ /* we may be invoked with a container_resize_queue of NULL, because
+ * queue_resize could have been adding an extra idle function while
+ * the queue still got processed. we better just ignore such case
+ * than trying to explicitly work around them with some extra flags,
+ * since it doesn't cause any actual harm.
+ */
+ if (gtk_widget_needs_allocate (widget))
+ gtk_native_check_resize (GTK_NATIVE (window));
+
+ if (!gtk_window_needs_layout (window))
+ gtk_window_stop_layout (window);
+ else
+ gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_LAYOUT);
+}
+
+void
+gtk_window_start_layout (GtkWindow *window)
+{
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+ GdkFrameClock *clock;
+
+ if (priv->resize_handler != 0)
+ return;
+
+ if (!gtk_window_needs_layout (window))
+ return;
+
+ clock = gtk_widget_get_frame_clock (GTK_WIDGET (window));
+ if (clock == NULL)
+ return;
+
+ priv->resize_handler = g_signal_connect (clock, "layout",
+ G_CALLBACK (gtk_window_layout_cb), window);
+ gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_LAYOUT);
+}
+
+void
+gtk_window_stop_layout (GtkWindow *window)
+{
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+ GdkFrameClock *clock;
+
+ if (priv->resize_handler == 0)
+ return;
+
+ clock = gtk_widget_get_frame_clock (GTK_WIDGET (window));
+ g_signal_handler_disconnect (clock, priv->resize_handler);
+ priv->resize_handler = 0;
+}
+
+void
+gtk_window_queue_restyle (GtkWindow *window)
+{
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+
+ if (priv->restyle_pending)
+ return;
+
+ priv->restyle_pending = TRUE;
+
+ gtk_window_start_layout (window);
+}
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index 948644f574..1cde20fc80 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -141,6 +141,11 @@ GtkWidget * gtk_window_pick_popover (GtkWindow *window,
void gtk_window_set_extra_input_region (GtkWindow *window,
cairo_region_t *region);
+void gtk_window_start_layout (GtkWindow *window);
+void gtk_window_stop_layout (GtkWindow *window);
+void gtk_window_queue_restyle (GtkWindow *window);
+
+
G_END_DECLS
#endif /* __GTK_WINDOW_PRIVATE_H__ */