From e953e47216b95549ad8f92458e2fd5af5805e5e0 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 11 Dec 2017 10:39:13 -0500
Subject: [PATCH 007/142] x11: don't call gdk_display_get_name before gtk_init

The x11 plugin calls gdk_display_get_name at load time
to set the device name state.  This no longer works, since
gtk_init_check() happens later at open_device time, and
GTK+ no longer allows gdk_display_get_name before gtk_init.

This commit moves the gtk_init call earlier, to
create_backend, so gdk_display_get_name works again.

https://bugzilla.gnome.org/show_bug.cgi?id=104204
---
 src/plugins/renderers/x11/plugin.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/plugins/renderers/x11/plugin.c b/src/plugins/renderers/x11/plugin.c
index 8948f69..76addda 100644
--- a/src/plugins/renderers/x11/plugin.c
+++ b/src/plugins/renderers/x11/plugin.c
@@ -105,6 +105,11 @@ create_backend (const char     *device_name,
 {
         ply_renderer_backend_t *backend;
 
+        gdk_set_allowed_backends ("x11");
+
+        if (!gtk_init_check (0, NULL))
+                return false;
+
         backend = calloc (1, sizeof(ply_renderer_backend_t));
 
         backend->loop = ply_event_loop_get_default ();
@@ -150,11 +155,6 @@ open_device (ply_renderer_backend_t *backend)
         Display *display;
         int display_fd;
 
-        gdk_set_allowed_backends ("x11");
-
-        if (!gtk_init_check (0, NULL))
-                return false;
-
         /* Force gtk+ to deal in device pixels */
         gdk_x11_display_set_window_scale (gdk_display_get_default (), 1);
 
-- 
2.7.4

