[gnome-power-manager] Check for XRR* functions using library version instead of proto version
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Check for XRR* functions using library version instead of proto version
- Date: Sun, 21 Mar 2010 11:08:58 +0000 (UTC)
commit 6ec5d4dd8a55ac7edc507ce0e5457afdaf4a601c
Author: Rémi Cardona <remi gentoo org>
Date: Sun Mar 21 10:52:49 2010 +0000
Check for XRR* functions using library version instead of proto version
randrproto 1.3 can be installed with libXrandr 1.2, which causes linking
errors with g-p-m. This patch checks that libXrandr (and not randrproto)
1.3 is available.
Signed-off-by: Richard Hughes <richard hughsie com>
configure.ac | 4 ++++
src/gpm-brightness-xrandr.c | 13 ++++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a8f864b..fe2d4b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,10 @@ PKG_CHECK_MODULES(X11, x11 xrender)
AC_SUBST(X11_CFLAGS)
AC_SUBST(X11_LIBS)
+PKG_CHECK_EXISTS(
+ [xrandr >= 1.3],
+ [AC_DEFINE(HAVE_XRANDR_13, 1, [xrandr 1.3 available])])
+
PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED)
AC_SUBST(LIBNOTIFY_CFLAGS)
AC_SUBST(LIBNOTIFY_LIBS)
diff --git a/src/gpm-brightness-xrandr.c b/src/gpm-brightness-xrandr.c
index 631459a..46a8b90 100644
--- a/src/gpm-brightness-xrandr.c
+++ b/src/gpm-brightness-xrandr.c
@@ -60,7 +60,7 @@ struct GpmBrightnessXRandRPrivate
Display *dpy;
guint shared_value;
gboolean has_extension;
-#if (RANDR_MAJOR == 1 && RANDR_MINOR >= 3)
+#ifdef HAVE_XRANDR_13
gboolean has_randr13;
#endif
gboolean hw_changed;
@@ -173,7 +173,7 @@ gpm_brightness_xrandr_setup_display (GpmBrightnessXRandR *brightness)
return TRUE;
}
-#if (RANDR_MAJOR == 1 && RANDR_MINOR >= 3)
+#ifdef HAVE_XRANDR_13
/**
* gpm_brightness_xrandr_setup_version: Check whether xserver really supports xrandr-1.3 features.
**/
@@ -642,14 +642,13 @@ gpm_brightness_xrandr_update_cache (GpmBrightnessXRandR *brightness)
in RandR 1.3 or higher and of course xserver needs
to support it.
*/
-#if (RANDR_MAJOR == 1 && RANDR_MINOR >= 3)
+#ifdef HAVE_XRANDR_13
if (brightness->priv->has_randr13)
resource = XRRGetScreenResourcesCurrent (brightness->priv->dpy, root);
else
- resource = XRRGetScreenResources (brightness->priv->dpy, root);
-#else
- resource = XRRGetScreenResources (brightness->priv->dpy, root);
#endif
+ resource = XRRGetScreenResources (brightness->priv->dpy, root);
+
if (resource != NULL) {
egg_debug ("adding resource %p", resource);
g_ptr_array_add (brightness->priv->resources, resource);
@@ -711,7 +710,7 @@ gpm_brightness_xrandr_init (GpmBrightnessXRandR *brightness)
/* can we do this */
brightness->priv->has_extension = gpm_brightness_xrandr_setup_display (brightness);
-#if (RANDR_MAJOR == 1 && RANDR_MINOR >= 3)
+#ifdef HAVE_XRANDR_13
brightness->priv->has_randr13 = gpm_brightness_xrandr_setup_version (brightness);
#endif
if (brightness->priv->has_extension == FALSE) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]