From e7cd3d46332fb0ec8b267f96381bbc896a2a8656 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 9 Apr 2019 14:22:19 +0100 Subject: window: Create a GtkConstraintSolver Implement the GtkRoot getter for GtkConstraintSolver. --- gtk/gtkwindow.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gtk/gtkwindow.c') diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 3730841f36..dab50be990 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -281,6 +281,8 @@ typedef struct GskRenderer *renderer; GList *foci; + + GtkConstraintSolver *constraint_solver; } GtkWindowPrivate; #ifdef GDK_WINDOWING_X11 @@ -1883,6 +1885,9 @@ gtk_window_init (GtkWindow *window) g_signal_connect_swapped (priv->key_controller, "key-released", G_CALLBACK (gtk_window_key_released), window); gtk_widget_add_controller (widget, priv->key_controller); + + /* Shared constraint solver */ + priv->constraint_solver = gtk_constraint_solver_new (); } static GtkGesture * @@ -2353,6 +2358,15 @@ gtk_window_native_get_renderer (GtkNative *native) return priv->renderer; } +static GtkConstraintSolver * +gtk_window_root_get_constraint_solver (GtkRoot *root) +{ + GtkWindow *self = GTK_WINDOW (root); + GtkWindowPrivate *priv = gtk_window_get_instance_private (self); + + return priv->constraint_solver; +} + static void gtk_window_native_get_surface_transform (GtkNative *native, int *x, @@ -2381,6 +2395,7 @@ static void gtk_window_root_interface_init (GtkRootInterface *iface) { iface->get_display = gtk_window_root_get_display; + iface->get_constraint_solver = gtk_window_root_get_constraint_solver; } static void @@ -4723,6 +4738,7 @@ gtk_window_finalize (GObject *object) priv->mnemonics_display_timeout_id = 0; } + g_clear_object (&priv->constraint_solver); g_clear_object (&priv->renderer); G_OBJECT_CLASS (gtk_window_parent_class)->finalize (object); -- cgit v1.2.1