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:
Julien Cristau
2010-12-23 13:50:13 +01:00
committed by Matthias Clasen
parent 317f8baf60
commit d211c8af6b
3 changed files with 20 additions and 12 deletions

View File

@ -1,7 +1,7 @@
/*
* gdkscreen-x11.c
*
* Copyright 2001 Sun Microsystems Inc.
*
* Copyright 2001 Sun Microsystems Inc.
*
* Erwann Chenede <erwann.chenede@sun.com>
*
@ -842,20 +842,23 @@ gdk_x11_screen_is_composited (GdkScreen *screen)
}
static void
init_randr_support (GdkScreen * screen)
init_randr_support (GdkScreen *screen)
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
XSelectInput (GDK_SCREEN_XDISPLAY (screen),
x11_screen->xroot_window,
StructureNotifyMask);
x11_screen->xroot_window,
StructureNotifyMask);
#ifdef HAVE_RANDR
if (!GDK_X11_DISPLAY (gdk_screen_get_display (screen))->have_randr12)
return;
XRRSelectInput (GDK_SCREEN_XDISPLAY (screen),
x11_screen->xroot_window,
RRScreenChangeNotifyMask |
RRCrtcChangeNotifyMask |
RROutputPropertyNotifyMask);
x11_screen->xroot_window,
RRScreenChangeNotifyMask
| RRCrtcChangeNotifyMask
| RROutputPropertyNotifyMask);
#endif
}