Index: gcr-3.20.0/gcr/Makefile.am
===================================================================
--- gcr-3.20.0.orig/gcr/Makefile.am
+++ gcr-3.20.0/gcr/Makefile.am
@@ -118,6 +118,7 @@ nodist_libgcr_base_@GCR_MAJOR@_la_SOURCE
 libgcr_base_@GCR_MAJOR@_la_CFLAGS = \
 	$(LIBGCRYPT_CFLAGS) \
 	$(P11_KIT_CFLAGS) \
+	$(GTK_CFLAGS) \
 	-DGCK_API_SUBJECT_TO_CHANGE \
 	-DP11_KIT_API_SUBJECT_TO_CHANGE \
 	-DGCR_COMPILATION \
@@ -133,7 +134,8 @@ libgcr_base_@GCR_MAJOR@_la_LIBADD = \
 	libgck-@GCK_MAJOR@.la \
 	$(GLIB_LIBS) \
 	$(LIBGCRYPT_LIBS) \
-	$(P11_KIT_LIBS)
+	$(P11_KIT_LIBS) \
+	$(GTK_LIBS)
 
 gcr/gcr-marshal.h: gcr/gcr-marshal.list $(GLIB_GENMARSHAL)
 	$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=_gcr_marshal > $@
Index: gcr-3.20.0/gcr/gcr-gnupg-process.c
===================================================================
--- gcr-3.20.0.orig/gcr/gcr-gnupg-process.c
+++ gcr-3.20.0/gcr/gcr-gnupg-process.c
@@ -27,6 +27,7 @@
 #include "gcr/gcr-marshal.h"
 
 #include <glib/gi18n-lib.h>
+#include <gdk/gdk.h>
 
 #include <sys/wait.h>
 #include <fcntl.h>
@@ -971,6 +972,8 @@ _gcr_gnupg_process_run_async (GcrGnupgPr
 	GSource *source;
 	GPid pid;
 	guint i;
+	GdkDisplay *display;
+	const gchar *display_name;
 
 	g_return_if_fail (GCR_IS_GNUPG_PROCESS (self));
 	g_return_if_fail (argv);
@@ -996,6 +999,13 @@ _gcr_gnupg_process_run_async (GcrGnupgPr
 	child_fds[FD_OUTPUT] = 1;
 	child_fds[FD_ERROR] = 2;
 
+	if ((display = gdk_display_get_default ())
+	    && (display_name = gdk_display_get_name (display)))
+	  {
+	    g_ptr_array_add (args, g_strdup ("--display"));
+	    g_ptr_array_add (args, g_strdup (display_name));
+	  }
+
 	if (flags & GCR_GNUPG_PROCESS_WITH_STATUS) {
 		if (pipe (status_fds) < 0)
 			g_return_if_reached ();
