[gcr/wip/nielsdg/lose-x11-dependency: 1/3] prompt: Guard GDK-X11 code with the necessary #ifdefs



commit b53b973c8f5f0dcdc3f24bf4671ed652a6602912
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Dec 3 08:38:50 2019 +0100

    prompt: Guard GDK-X11 code with the necessary #ifdefs
    
    This allows us to lose the hard dependency on `gtk-x11`.

 configure.ac           | 2 +-
 ui/gcr-prompt-dialog.c | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6286f16..c7c5e65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,7 +119,7 @@ AC_ARG_WITH(gtk, [
 AM_CONDITIONAL(WITH_GTK, test "$with_gtk" != "no")
 
 if test "x$with_gtk" != "xno"; then
-       PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQ gtk+-x11-3.0 >= $GTK_REQ)
+       PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQ)
        AC_SUBST(GTK_CFLAGS)
        AC_SUBST(GTK_LIBS)
 fi
diff --git a/ui/gcr-prompt-dialog.c b/ui/gcr-prompt-dialog.c
index 606620e..f623df1 100644
--- a/ui/gcr-prompt-dialog.c
+++ b/ui/gcr-prompt-dialog.c
@@ -27,7 +27,9 @@
 #include "gcr-secure-entry-buffer.h"
 
 #include <gtk/gtk.h>
+#ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
+#endif
 #include <glib/gi18n.h>
 
 /**
@@ -128,7 +130,7 @@ static void
 update_transient_for (GcrPromptDialog *self)
 {
        GdkDisplay *display;
-       GdkWindow *transient_for;
+       GdkWindow *transient_for = NULL;
        GdkWindow *window;
        gint64 handle;
        gchar *end;
@@ -142,6 +144,7 @@ update_transient_for (GcrPromptDialog *self)
        if (window == NULL)
                return;
 
+#ifdef GDK_WINDOWING_X11
        handle = g_ascii_strtoll (self->pv->caller_window, &end, 10);
        if (!end || *end != '\0') {
                g_warning ("couldn't parse caller-window property: %s", self->pv->caller_window);
@@ -157,6 +160,7 @@ update_transient_for (GcrPromptDialog *self)
                gdk_window_set_transient_for (window, transient_for);
                g_object_unref (transient_for);
        }
+#endif
 
        gtk_window_set_modal (GTK_WINDOW (self), TRUE);
 }


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