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
This commit is contained in:
Giovanni Campagna 2013-08-18 11:44:45 +02:00
parent 8ad5ccd2f8
commit 015c05fbf6

View File

@ -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.size = size;
gamma.red = red;
gamma.green = green;
gamma.blue = blue;
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);
XRRSetCrtcGamma (manager_xrandr->xdisplay, (XID)crtc->crtc_id, &gamma);
XRRSetCrtcGamma (manager_xrandr->xdisplay, (XID)crtc->crtc_id, gamma);
XRRFreeGamma (gamma);
}
static gboolean