[SDL/f17] Work around bug in Xorg to allow changing gamma on X11
Petr Pisar
ppisar at fedoraproject.org
Wed Jan 23 16:23:05 UTC 2013
commit 1655f40b981532e8a066b19f560879e928200fc2
Author: Petr Písař <ppisar at redhat.com>
Date: Wed Jan 23 16:26:08 2013 +0100
Work around bug in Xorg to allow changing gamma on X11
...1-Bypass-SetGammaRamp-when-changing-gamma.patch | 44 ++++++++++++++++++++
SDL.spec | 8 +++-
2 files changed, 51 insertions(+), 1 deletions(-)
---
diff --git a/SDL-1.2.15-x11-Bypass-SetGammaRamp-when-changing-gamma.patch b/SDL-1.2.15-x11-Bypass-SetGammaRamp-when-changing-gamma.patch
new file mode 100644
index 0000000..087a134
--- /dev/null
+++ b/SDL-1.2.15-x11-Bypass-SetGammaRamp-when-changing-gamma.patch
@@ -0,0 +1,44 @@
+From 4b56fa058a45b7c804d1a5fcaf7a70db0bd0581c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <petr.pisar at atlas.cz>
+Date: Tue, 1 Jan 2013 21:25:15 +0100
+Subject: [PATCH] x11: Bypass SetGammaRamp when changing gamma
+
+Recent Xorg has broken dynamic colors setting, so calling SDL_SetGamme()
+does not have any effect here. Recent means xorg-server >= 1.7, since 2010.
+See <https://bugs.freedesktop.org/show_bug.cgi?id=27222>.
+---
+ src/video/SDL_gamma.c | 15 ++-------------
+ 1 files changed, 2 insertions(+), 13 deletions(-)
+
+diff --git a/src/video/SDL_gamma.c b/src/video/SDL_gamma.c
+index 4fd0370..464ab88 100644
+--- a/src/video/SDL_gamma.c
++++ b/src/video/SDL_gamma.c
+@@ -92,22 +92,11 @@ static void CalculateGammaFromRamp(float *gamma, Uint16 *ramp)
+
+ int SDL_SetGamma(float red, float green, float blue)
+ {
+- int succeeded;
++ int succeeded = -1;
+ SDL_VideoDevice *video = current_video;
+ SDL_VideoDevice *this = current_video;
+
+- succeeded = -1;
+- /* Prefer using SetGammaRamp(), as it's more flexible */
+- {
+- Uint16 ramp[3][256];
+-
+- CalculateGammaRamp(red, ramp[0]);
+- CalculateGammaRamp(green, ramp[1]);
+- CalculateGammaRamp(blue, ramp[2]);
+- succeeded = SDL_SetGammaRamp(ramp[0], ramp[1], ramp[2]);
+- }
+- if ( (succeeded < 0) && video->SetGamma ) {
+- SDL_ClearError();
++ if ( video->SetGamma ) {
+ succeeded = video->SetGamma(this, red, green, blue);
+ }
+ return succeeded;
+--
+1.7.8.6
+
diff --git a/SDL.spec b/SDL.spec
index d74b0de..929abc3 100644
--- a/SDL.spec
+++ b/SDL.spec
@@ -1,7 +1,7 @@
Summary: A cross-platform multimedia library
Name: SDL
Version: 1.2.14
-Release: 16%{?dist}
+Release: 17%{?dist}
# Source: http://www.libsdl.org/release/%%{name}-%%{version}.tar.gz
# To create the repackaged archive use ./repackage.sh %%{version}
Source0: %{name}-%{version}_repackaged.tar.gz
@@ -28,6 +28,8 @@ Patch8: SDL-1.2.14-nasm-2.09-compat.patch
Patch9: SDL-1.2.10-GrabNotViewable.patch
# Restore compatibility with libX11-1.4.99.1, in upstream, sdl1376, rh782251
Patch10: SDL-1.2.14-Define__XGetRequest.patch
+# Proposed to upstream as sdl1680, rh891973
+Patch11: SDL-1.2.15-x11-Bypass-SetGammaRamp-when-changing-gamma.patch
URL: http://www.libsdl.org/
License: LGPLv2+
@@ -92,6 +94,7 @@ static SDL applications.
%patch8 -p1 -b .nasm209
%patch9 -p0 -b .grabnotviewable
%patch10 -p1 -b .define__xGetRequest
+%patch11 -p1 -b .gamma
for F in CREDITS; do
iconv -f iso8859-1 -t utf-8 < "$F" > "${F}.utf"
touch --reference "$F" "${F}.utf"
@@ -154,6 +157,9 @@ rm -rf %{buildroot}
%{_libdir}/lib*.a
%changelog
+* Wed Jan 23 2013 Petr Pisar <ppisar at redhat.com> - 1.2.14-17
+- Work around bug in Xorg to allow changing gamma on X11 (bug #891973)
+
* Thu Jan 19 2012 Petr Pisar <ppisar at redhat.com> - 1.2.14-16
- Replace my patch with upstream one (bug #782251)
More information about the scm-commits
mailing list