[mutter] MonitorXrandr: fix setting gamma ramps
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MonitorXrandr: fix setting gamma ramps
- Date: Sun, 18 Aug 2013 10:58:44 +0000 (UTC)
commit 015c05fbf6c64a7e008ba483bdb1cf9a65ecae80
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Aug 18 11:44:45 2013 +0200
MonitorXrandr: fix setting gamma ramps
The value passed to XRRCrtcSetGamma must be allocated with
XRRAllocGamma (because it relies on the locations of green and blue),
otherwise garbage is sent on the wire.
https://bugzilla.gnome.org/show_bug.cgi?id=706231
src/core/monitor-xrandr.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/core/monitor-xrandr.c b/src/core/monitor-xrandr.c
index ec9a6be..51e480a 100644
--- a/src/core/monitor-xrandr.c
+++ b/src/core/monitor-xrandr.c
@@ -921,14 +921,16 @@ meta_monitor_manager_xrandr_set_crtc_gamma (MetaMonitorManager *manager,
unsigned short *blue)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
- XRRCrtcGamma gamma;
+ XRRCrtcGamma *gamma;
+
+ gamma = XRRAllocGamma (size);
+ memcpy (gamma->red, red, sizeof (unsigned short) * size);
+ memcpy (gamma->green, green, sizeof (unsigned short) * size);
+ memcpy (gamma->blue, blue, sizeof (unsigned short) * size);
- gamma.size = size;
- gamma.red = red;
- gamma.green = green;
- gamma.blue = blue;
+ XRRSetCrtcGamma (manager_xrandr->xdisplay, (XID)crtc->crtc_id, gamma);
- XRRSetCrtcGamma (manager_xrandr->xdisplay, (XID)crtc->crtc_id, &gamma);
+ XRRFreeGamma (gamma);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]