summaryrefslogtreecommitdiff
path: root/gtk/gtkwindow.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2019-04-09 14:22:19 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2019-06-27 17:38:02 +0100
commite7cd3d46332fb0ec8b267f96381bbc896a2a8656 (patch)
treef25573319ca54c3d9a0128df437fa4bd103bed73 /gtk/gtkwindow.c
parent5780ec4bf1517fd291382ba6a0195c7fe8621ff9 (diff)
downloadgtk+-e7cd3d46332fb0ec8b267f96381bbc896a2a8656.tar.gz
window: Create a GtkConstraintSolver
Implement the GtkRoot getter for GtkConstraintSolver.
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r--gtk/gtkwindow.c16
1 files changed, 16 insertions, 0 deletions
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);