[gtk/wip/ebassi/constraint-layout: 3/5] Assign a GtkConstraintSolver to each GtkRoot
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/ebassi/constraint-layout: 3/5] Assign a GtkConstraintSolver to each GtkRoot
- Date: Fri, 3 May 2019 16:09:58 +0000 (UTC)
commit bb739da8ff97c958fffd50948cd96eca64828987
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 | 18 ++++++++++++++++++
gtk/gtkrootprivate.h | 11 +++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkroot.c b/gtk/gtkroot.c
index 249d7405b1..c93a065f16 100644
--- a/gtk/gtkroot.c
+++ b/gtk/gtkroot.c
@@ -61,12 +61,19 @@ gtk_root_default_get_surface_transform (GtkRoot *self,
*y = 0;
}
+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_renderer = gtk_root_default_get_renderer;
iface->get_surface_transform = gtk_root_default_get_surface_transform;
+ iface->get_constraint_solver = gtk_root_default_get_constraint_solver;
g_object_interface_install_property (iface,
g_param_spec_object ("focus-widget",
@@ -113,6 +120,17 @@ gtk_root_get_surface_transform (GtkRoot *self,
return iface->get_surface_transform (self, x, y);
}
+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_get_for_surface:
* @surface: a #GdkSurface
diff --git a/gtk/gtkrootprivate.h b/gtk/gtkrootprivate.h
index ecdabe4a25..62c1471121 100644
--- a/gtk/gtkrootprivate.h
+++ b/gtk/gtkrootprivate.h
@@ -3,6 +3,8 @@
#include "gtkroot.h"
+#include "gtkconstraintsolverprivate.h"
+
G_BEGIN_DECLS
/*
@@ -19,17 +21,22 @@ struct _GtkRootInterface
GdkDisplay * (* get_display) (GtkRoot *self);
GskRenderer * (* get_renderer) (GtkRoot *self);
- void (* get_surface_transform) (GtkRoot *root,
+ void (* get_surface_transform) (GtkRoot *self,
int *x,
int *y);
+
+ GtkConstraintSolver * (* get_constraint_solver) (GtkRoot *self);
};
-GdkDisplay * gtk_root_get_display (GtkRoot *root);
+GdkDisplay * gtk_root_get_display (GtkRoot *self);
GskRenderer * gtk_root_get_renderer (GtkRoot *self);
void gtk_root_get_surface_transform (GtkRoot *self,
int *x,
int *y);
+
+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]