[gtk/constraint-guide-3: 6/7] constraint solver: Add a hack for external linking



commit 043fed8612ffb143449047d9a87030caaf8a1c6f
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 28 04:49:42 2019 +0000

    constraint solver: Add a hack for external linking
    
    Make it possible to build tests which use
    GtkConstraintSolver from inside and outside libgtk.
    See the test added in the following commit for
    how this is used.

 gtk/gtkconstraintsolverprivate.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/gtk/gtkconstraintsolverprivate.h b/gtk/gtkconstraintsolverprivate.h
index 69eed376c7..32f3debd51 100644
--- a/gtk/gtkconstraintsolverprivate.h
+++ b/gtk/gtkconstraintsolverprivate.h
@@ -25,10 +25,30 @@
 
 G_BEGIN_DECLS
 
+#ifdef GTK_TEST_EXTERNAL
+
+#define GTK_TYPE_CONSTRAINT_SOLVER (g_type_from_name ("GtkConstraintSolver"))
+#define GTK_CONSTRAINT_SOLVER(solver)                (G_TYPE_CHECK_INSTANCE_CAST ((solver), 
GTK_TYPE_CONSTRAINT_SOLVER, GtkConstraintSolver))
+#define GTK_CONSTRAINT_SOLVER_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST ((klass), 
GTK_TYPE_CONSTRAINT_SOLVER, GtkConstraintSolverClass))
+#define GTK_IS_CONSTRAINT_SOLVER(solver)             (G_TYPE_CHECK_INSTANCE_TYPE ((solver), 
GTK_TYPE_CONSTRAINT_SOLVER))
+#define GTK_IS_CONSTRAINT_SOLVER_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GTK_TYPE_CONSTRAINT_SOLVER))
+#define GTK_CONSTRAINT_SOLVER_GET_CLASS(obj)         (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GTK_TYPE_CONSTRAINT_SOLVER, GtkConstraintSolverClass))
+
+typedef struct _GtkConstraintSolver GtkConstraintSolver;
+typedef struct _GtkConstraintSolverClass GtkConstraintSolverClass;
+
+struct _GtkConstraintSolverClass {
+  GObjectClass parent_class;
+};
+
+#else
+
 #define GTK_TYPE_CONSTRAINT_SOLVER (gtk_constraint_solver_get_type())
 
 G_DECLARE_FINAL_TYPE (GtkConstraintSolver, gtk_constraint_solver, GTK, CONSTRAINT_SOLVER, GObject)
 
+#endif
+
 /* Symbolic weight thresholds
  *
  * Constraint weights live on a continuum, but we use thresholds for simplicity's


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