backends/x11: add a flag to denote randr 1.5 is in use.

If the server reports randr 1.5, just cache the information
for later patches to use.
This commit is contained in:
Dave Airlie 2015-03-31 10:38:44 +10:00 committed by Jasper St. Pierre
parent e2d6028924
commit ef296031cb
2 changed files with 14 additions and 0 deletions

View File

@ -284,6 +284,8 @@ AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,
if test "x$found_randr" = "xyes"; then if test "x$found_randr" = "xyes"; then
AC_DEFINE(HAVE_RANDR, , [Have the Xrandr extension library]) AC_DEFINE(HAVE_RANDR, , [Have the Xrandr extension library])
PKG_CHECK_EXISTS([xrandr >= 1.5.0],
AC_DEFINE([HAVE_XRANDR15],[1],[Define if you have support for XRandR 1.5 or greater]))
fi fi
MUTTER_LIBS="$MUTTER_LIBS $RANDR_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm" MUTTER_LIBS="$MUTTER_LIBS $RANDR_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm"

View File

@ -58,6 +58,7 @@ struct _MetaMonitorManagerXrandr
XRRScreenResources *resources; XRRScreenResources *resources;
int rr_event_base; int rr_event_base;
int rr_error_base; int rr_error_base;
gboolean has_randr15;
}; };
struct _MetaMonitorManagerXrandrClass struct _MetaMonitorManagerXrandrClass
@ -1228,6 +1229,7 @@ meta_monitor_manager_xrandr_init (MetaMonitorManagerXrandr *manager_xrandr)
} }
else else
{ {
int major_version, minor_version;
/* We only use ScreenChangeNotify, but GDK uses the others, /* We only use ScreenChangeNotify, but GDK uses the others,
and we don't want to step on its toes */ and we don't want to step on its toes */
XRRSelectInput (manager_xrandr->xdisplay, XRRSelectInput (manager_xrandr->xdisplay,
@ -1235,6 +1237,16 @@ meta_monitor_manager_xrandr_init (MetaMonitorManagerXrandr *manager_xrandr)
RRScreenChangeNotifyMask RRScreenChangeNotifyMask
| RRCrtcChangeNotifyMask | RRCrtcChangeNotifyMask
| RROutputPropertyNotifyMask); | RROutputPropertyNotifyMask);
manager_xrandr->has_randr15 = FALSE;
XRRQueryVersion (manager_xrandr->xdisplay, &major_version,
&minor_version);
#ifdef HAVE_XRANDR15
if (major_version > 1 ||
(major_version == 1 &&
minor_version >= 5))
manager_xrandr->has_randr15 = TRUE;
#endif
} }
} }