[gtkmm/gtkmm-3-24] Fix build with X11 backend disabled



commit 8d836ca01f297760aea5c6095afe5fe9f93e4e39
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sat May 9 11:48:49 2020 +0200

    Fix build with X11 backend disabled
    
    * configure.ac:
    * gdk/gdkmmconfig.h.in: Define GDKMM_X11_BACKEND_ENABLED if X11 API
    shall be built.
    * gtk/src/plug.hg:
    * gtk/src/socket.hg: Enable in wrap_init.cc if GDKMM_X11_BACKEND_ENABLED
    is defined. (Was enabled if GDK_WINDOWING_X11 was defined.)
    
    This was partly fixed 8 years ago. See Bugzilla #678883. But it failed if
    the X11 backend was available in gtk, but X11-only code shall still not
    be built in gtkmm. (configuration with --enable-x11-backend=no)

 configure.ac         | 3 +++
 gdk/gdkmmconfig.h.in | 3 +++
 gtk/src/plug.hg      | 4 ++--
 gtk/src/socket.hg    | 4 ++--
 4 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5f47f701..caef2701 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,6 +78,9 @@ AM_CONDITIONAL([GDK_TARGET_X11], [test "x$gdk_target_x11" = xyes])
 AM_CONDITIONAL([GDK_TARGET_BROADWAY], [test "x$gdk_target_broadway" = xyes])
 AM_CONDITIONAL([GDK_TARGET_WAYLAND], [test "x$gdk_target_wayland" = xyes])
 
+AS_IF([test "x$gdk_target_x11" = xyes],
+  [AC_DEFINE([GDKMM_X11_BACKEND_ENABLED], [1], [Define when building X11 API])])
+
 if test "x$gdk_target_win32" = xyes ; then
    AC_MSG_CHECKING([for native Windows host])
    AS_CASE([$host_os], [mingw*], [gtkmm_host_windows=yes], [gtkmm_host_windows=no])
diff --git a/gdk/gdkmmconfig.h.in b/gdk/gdkmmconfig.h.in
index db0076f0..fae72ef6 100644
--- a/gdk/gdkmmconfig.h.in
+++ b/gdk/gdkmmconfig.h.in
@@ -3,6 +3,9 @@
 
 #include <pangommconfig.h>
 
+/* Defined when the --enable-x11-backend configure argument was given */
+#undef GDKMM_X11_BACKEND_ENABLED
+
 /* Define to omit deprecated API from gdkmm. */
 #undef GDKMM_DISABLE_DEPRECATED
 
diff --git a/gtk/src/plug.hg b/gtk/src/plug.hg
index 0c1b2486..1b8f66c3 100644
--- a/gtk/src/plug.hg
+++ b/gtk/src/plug.hg
@@ -21,8 +21,8 @@ _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/window_p.h)
 
 //This file is used only on systems with the X11 backend.
-_INCLUDE_IN_WRAP_INIT(gdk/gdk.h)dnl // If GDK_WINDOWING_X11 is defined, it's defined here.
-_GMMPROC_WRAP_CONDITIONALLY(ifdef GDK_WINDOWING_X11)
+_INCLUDE_IN_WRAP_INIT(gdkmmconfig.h)dnl // If GDKMM_X11_BACKEND_ENABLED is defined, it's defined here.
+_GMMPROC_WRAP_CONDITIONALLY(ifdef GDKMM_X11_BACKEND_ENABLED)
 
 namespace Gtk
 {
diff --git a/gtk/src/socket.hg b/gtk/src/socket.hg
index 4d2c1e8d..46cf4e1a 100644
--- a/gtk/src/socket.hg
+++ b/gtk/src/socket.hg
@@ -22,8 +22,8 @@ _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/container_p.h)
 
 //This file is used only on systems with the X11 backend.
-_INCLUDE_IN_WRAP_INIT(gdk/gdk.h)dnl // If GDK_WINDOWING_X11 is defined, it's defined here.
-_GMMPROC_WRAP_CONDITIONALLY(ifdef GDK_WINDOWING_X11)
+_INCLUDE_IN_WRAP_INIT(gdkmmconfig.h)dnl // If GDKMM_X11_BACKEND_ENABLED is defined, it's defined here.
+_GMMPROC_WRAP_CONDITIONALLY(ifdef GDKMM_X11_BACKEND_ENABLED)
 
 namespace Gtk
 {


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