From 549e98e5e73e727bf6e6d38414bb3cf7c06c7962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Wed, 9 May 2018 23:40:53 +0200 Subject: [PATCH] wayland: make xrandr query conditional --- gtk/src/gtk_display.cpp | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/gtk/src/gtk_display.cpp b/gtk/src/gtk_display.cpp index 84168959..776e30d0 100644 --- a/gtk/src/gtk_display.cpp +++ b/gtk/src/gtk_display.cpp @@ -1588,34 +1588,24 @@ S9xQueryDrivers (void) #endif gui_config->allow_xrandr = 0; + +#ifdef GDK_WINDOWING_X11 + GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (top_level->get_window())); + if (GDK_IS_X11_DISPLAY (display)) + { + int error_base_p, event_base_p; + int major_version, minor_version; + Display *dpy = gdk_x11_display_get_xdisplay (gtk_widget_get_display (GTK_WIDGET (top_level->get_window()))); + Window xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (top_level->get_window()))); - int error_base_p, event_base_p; - int major_version, minor_version; - Display *dpy = gdk_x11_display_get_xdisplay (gtk_widget_get_display (GTK_WIDGET (top_level->get_window()))); - Window xid = GDK_COMPAT_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (top_level->get_window()))); - - if (!XRRQueryExtension (dpy, &event_base_p, &error_base_p)) - { - gui_config->change_display_resolution = FALSE; - return; - } - if (!XRRQueryVersion (dpy, &major_version, &minor_version)) - { - gui_config->change_display_resolution = FALSE; - return; - } - if (minor_version < 3) - { - gui_config->change_display_resolution = FALSE; - return; + gui_config->allow_xrandr = 1; + gui_config->xrr_screen_resources = XRRGetScreenResourcesCurrent (dpy, xid); + gui_config->xrr_crtc_info = XRRGetCrtcInfo (dpy, + gui_config->xrr_screen_resources, + gui_config->xrr_screen_resources->crtcs[0]); } - gui_config->allow_xrandr = 1; - gui_config->xrr_screen_resources = XRRGetScreenResourcesCurrent (dpy, xid); - gui_config->xrr_crtc_info = XRRGetCrtcInfo (dpy, - gui_config->xrr_screen_resources, - gui_config->xrr_screen_resources->crtcs[0]); - +#endif return; }