[gtk: 1/3] build: fix for use with glib 2.66.0




commit 703fc51d8e1d24287a148e9f4ce8e8b515dcc937
Author: Hannes Müller <>
Date:   Fri Aug 5 13:35:06 2022 +0200

    build: fix for use with glib 2.66.0
    
    Add missing #define g_memdup2() for gdksurface-broadway.c in case of enabled
    broadway-backend as used otherwise.
    
    Copy static would_drop() replacement for g_log_writer_default_would_drop()
    from gtk-builder-tool.c to gtk-reftest.c

 gdk/broadway/gdksurface-broadway.c |  4 ++++
 testsuite/reftests/gtk-reftest.c   | 14 +++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index d341303526..ac1da88ff9 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -47,6 +47,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#if !GLIB_CHECK_VERSION (2, 67, 3)
+# define g_memdup2(mem,size)    g_memdup((mem), (size))
+#endif
+
 /* Forward declarations */
 static void        gdk_broadway_surface_finalize   (GObject            *object);
 
diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c
index 4d3d57db4a..c3900b924b 100644
--- a/testsuite/reftests/gtk-reftest.c
+++ b/testsuite/reftests/gtk-reftest.c
@@ -62,6 +62,18 @@ static const GOptionEntry test_args[] = {
 
 static gboolean using_tap;
 
+/* A simplified version of g_log_writer_default_would_drop(), to avoid
+ * bumping up the required version of GLib to 2.68
+ */
+static gboolean
+would_drop (GLogLevelFlags  level,
+            const char     *domain)
+{
+  return (level & (G_LOG_LEVEL_ERROR |
+                   G_LOG_LEVEL_CRITICAL |
+                   G_LOG_LEVEL_WARNING)) == 0;
+}
+
 static gboolean
 parse_command_line (int *argc, char ***argv)
 {
@@ -497,7 +509,7 @@ log_writer (GLogLevelFlags   log_level,
     }
 #endif
 
- if (!g_log_writer_default_would_drop (log_level, NULL))
+ if (!would_drop (log_level, NULL))
     return g_log_writer_standard_streams (log_level, fields, n_fields, user_data);
 
   return G_LOG_WRITER_HANDLED;


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