[PATCH] Fix xrandr backlight brightness control on 64 bit Linux. The display brightness property is a 32 bit integer, using a long doesn't work on 64 bit build.
Marcus Overhagen
marcus.overhagen at gmail.com
Thu May 30 00:35:29 CEST 2013
---
common/xfpm-brightness.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/common/xfpm-brightness.c b/common/xfpm-brightness.c
index aa1ef33..7e5470a 100644
--- a/common/xfpm-brightness.c
+++ b/common/xfpm-brightness.c
@@ -96,7 +96,7 @@ xfpm_brightness_xrandr_get_level (XfpmBrightness *brightness, RROutput output, l
{
unsigned long nitems;
unsigned long bytes_after;
- long *prop;
+ unsigned char *prop;
Atom actual_type;
int actual_format;
gboolean ret = FALSE;
@@ -105,7 +105,7 @@ xfpm_brightness_xrandr_get_level (XfpmBrightness *brightness, RROutput output, l
if (XRRGetOutputProperty (GDK_DISPLAY (), output, brightness->priv->backlight,
0, 4, False, False, None,
&actual_type, &actual_format,
- &nitems, &bytes_after, ((unsigned char **)&prop)) != Success
+ &nitems, &bytes_after, &prop) != Success
|| gdk_error_trap_pop () != 0)
{
g_warning ("failed to get property");
@@ -114,7 +114,7 @@ xfpm_brightness_xrandr_get_level (XfpmBrightness *brightness, RROutput output, l
if (actual_type == XA_INTEGER && nitems == 1 && actual_format == 32)
{
- memcpy (current, prop, sizeof (*current));
+ *current = *(gint32 *) prop;
ret = TRUE;
}
@@ -126,11 +126,12 @@ xfpm_brightness_xrandr_get_level (XfpmBrightness *brightness, RROutput output, l
static gboolean
xfpm_brightness_xrandr_set_level (XfpmBrightness *brightness, RROutput output, long level)
{
+ gint32 prop = level;
gboolean ret = TRUE;
gdk_error_trap_push ();
XRRChangeOutputProperty (GDK_DISPLAY (), output, brightness->priv->backlight, XA_INTEGER, 32,
- PropModeReplace, (unsigned char *) &level, 1);
+ PropModeReplace, (unsigned char *) &prop, 1);
XFlush (GDK_DISPLAY ());
gdk_flush ();
--
1.8.1.2
More information about the Xfce4-dev
mailing list