gdk/x11: don't select RANDR events if the extension is missing
Prevents an Xlib warning on Xnest, or Xorg with xinerama, or other non-RANDR-capable xserver. Reintroduce a have_randr12 field in GdkDisplayX11 to avoid having to call XRRQuery{Extension,Version} twice, and don't select randr 1.2 events if that's false. https://bugzilla.gnome.org/show_bug.cgi?id=634711 Signed-off-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:

committed by
Matthias Clasen

parent
317f8baf60
commit
d211c8af6b
@ -1220,6 +1220,7 @@ _gdk_x11_display_open (const gchar *display_name)
|
|||||||
_gdk_x11_precache_atoms (display, precache_atoms, G_N_ELEMENTS (precache_atoms));
|
_gdk_x11_precache_atoms (display, precache_atoms, G_N_ELEMENTS (precache_atoms));
|
||||||
|
|
||||||
/* RandR must be initialized before we initialize the screens */
|
/* RandR must be initialized before we initialize the screens */
|
||||||
|
display_x11->have_randr12 = FALSE;
|
||||||
display_x11->have_randr13 = FALSE;
|
display_x11->have_randr13 = FALSE;
|
||||||
#ifdef HAVE_RANDR
|
#ifdef HAVE_RANDR
|
||||||
if (XRRQueryExtension (display_x11->xdisplay,
|
if (XRRQueryExtension (display_x11->xdisplay,
|
||||||
@ -1229,8 +1230,11 @@ _gdk_x11_display_open (const gchar *display_name)
|
|||||||
|
|
||||||
XRRQueryVersion (display_x11->xdisplay, &major, &minor);
|
XRRQueryVersion (display_x11->xdisplay, &major, &minor);
|
||||||
|
|
||||||
if ((major == 1 && minor >= 3) || major > 1)
|
if ((major == 1 && minor >= 2) || major > 1) {
|
||||||
|
display_x11->have_randr12 = TRUE;
|
||||||
|
if (minor >= 3 || major > 1)
|
||||||
display_x11->have_randr13 = TRUE;
|
display_x11->have_randr13 = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gdk_x11_register_standard_event_type (display, display_x11->xrandr_event_base, RRNumberEvents);
|
gdk_x11_register_standard_event_type (display, display_x11->xrandr_event_base, RRNumberEvents);
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ struct _GdkX11Display
|
|||||||
gboolean have_xdamage;
|
gboolean have_xdamage;
|
||||||
gint xdamage_event_base;
|
gint xdamage_event_base;
|
||||||
|
|
||||||
|
gboolean have_randr12;
|
||||||
gboolean have_randr13;
|
gboolean have_randr13;
|
||||||
gint xrandr_event_base;
|
gint xrandr_event_base;
|
||||||
|
|
||||||
|
@ -842,7 +842,7 @@ gdk_x11_screen_is_composited (GdkScreen *screen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_randr_support (GdkScreen * screen)
|
init_randr_support (GdkScreen *screen)
|
||||||
{
|
{
|
||||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||||
|
|
||||||
@ -851,11 +851,14 @@ init_randr_support (GdkScreen * screen)
|
|||||||
StructureNotifyMask);
|
StructureNotifyMask);
|
||||||
|
|
||||||
#ifdef HAVE_RANDR
|
#ifdef HAVE_RANDR
|
||||||
|
if (!GDK_X11_DISPLAY (gdk_screen_get_display (screen))->have_randr12)
|
||||||
|
return;
|
||||||
|
|
||||||
XRRSelectInput (GDK_SCREEN_XDISPLAY (screen),
|
XRRSelectInput (GDK_SCREEN_XDISPLAY (screen),
|
||||||
x11_screen->xroot_window,
|
x11_screen->xroot_window,
|
||||||
RRScreenChangeNotifyMask |
|
RRScreenChangeNotifyMask
|
||||||
RRCrtcChangeNotifyMask |
|
| RRCrtcChangeNotifyMask
|
||||||
RROutputPropertyNotifyMask);
|
| RROutputPropertyNotifyMask);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user