[gtk/wip/ebassi/constraint-layout: 33/38] Assign a GtkConstraintSolver to each GtkRoot



commit 78e86b4df10a63a0d8c97018c2180d602c3689b6
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Apr 9 14:20:54 2019 +0100

    Assign a GtkConstraintSolver to each GtkRoot
    
    Constraints need to work across different parents, so it's better to
    have a single constraint solver per top level.

 gtk/gtkroot.c        | 19 +++++++++++++++++++
 gtk/gtkrootprivate.h |  6 ++++++
 2 files changed, 25 insertions(+)
---
diff --git a/gtk/gtkroot.c b/gtk/gtkroot.c
index 919aa65f94..dce284a57f 100644
--- a/gtk/gtkroot.c
+++ b/gtk/gtkroot.c
@@ -50,10 +50,18 @@ gtk_root_default_get_display (GtkRoot *self)
   return gdk_display_get_default ();
 }
 
+
+static GtkConstraintSolver *
+gtk_root_default_get_constraint_solver (GtkRoot *self)
+{
+  return NULL;
+}
+
 static void
 gtk_root_default_init (GtkRootInterface *iface)
 {
   iface->get_display = gtk_root_default_get_display;
+  iface->get_constraint_solver = gtk_root_default_get_constraint_solver;
 
   g_object_interface_install_property (iface,
       g_param_spec_object ("focus-widget",
@@ -82,6 +90,17 @@ gtk_root_get_display (GtkRoot *self)
   return iface->get_display (self);
 }
 
+GtkConstraintSolver *
+gtk_root_get_constraint_solver (GtkRoot *self)
+{
+  GtkRootInterface *iface;
+
+  g_return_val_if_fail (GTK_IS_ROOT (self), NULL);
+
+  iface = GTK_ROOT_GET_IFACE (self);
+  return iface->get_constraint_solver (self);
+}
+
 /**
  * gtk_root_set_focus:
  * @self: a #GtkRoot
diff --git a/gtk/gtkrootprivate.h b/gtk/gtkrootprivate.h
index 37e8149f33..aae7a674a5 100644
--- a/gtk/gtkrootprivate.h
+++ b/gtk/gtkrootprivate.h
@@ -3,6 +3,8 @@
 
 #include "gtkroot.h"
 
+#include "gtkconstraintsolverprivate.h"
+
 G_BEGIN_DECLS
 
 /**
@@ -17,8 +19,12 @@ struct _GtkRootInterface
 
   /*< public >*/
   GdkDisplay * (* get_display)  (GtkRoot *self);
+
+  GtkConstraintSolver * (* get_constraint_solver) (GtkRoot *self);
 };
 
+GtkConstraintSolver *   gtk_root_get_constraint_solver  (GtkRoot *self);
+
 enum {
   GTK_ROOT_PROP_FOCUS_WIDGET,
   GTK_ROOT_NUM_PROPERTIES


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]