From 322407ae9febde08d5e796b40ea94cc8c76e09fa Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 31 May 2012 01:34:21 +0200 Subject: [PATCH] Moved X11 gamma ramp termination to gamma module. --- src/x11_gamma.c | 11 +++++++++++ src/x11_init.c | 5 ++--- src/x11_platform.h | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/x11_gamma.c b/src/x11_gamma.c index c3791afc..1ca0a8c1 100644 --- a/src/x11_gamma.c +++ b/src/x11_gamma.c @@ -90,6 +90,17 @@ void _glfwInitGammaRamp(void) } +//======================================================================== +// Restore original gamma ramp if necessary +//======================================================================== + +void _glfwTerminateGammaRamp(void) +{ + if (_glfwLibrary.originalRampSize && _glfwLibrary.rampChanged) + _glfwPlatformSetGammaRamp(&_glfwLibrary.originalRamp); +} + + ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// diff --git a/src/x11_init.c b/src/x11_init.c index 3543c9f5..3cb94e54 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -659,9 +659,6 @@ static Cursor createNULLCursor(void) static void terminateDisplay(void) { - if (_glfwLibrary.originalRampSize && _glfwLibrary.rampChanged) - _glfwPlatformSetGammaRamp(&_glfwLibrary.originalRamp); - if (_glfwLibrary.X11.display) { XCloseDisplay(_glfwLibrary.X11.display); @@ -713,6 +710,8 @@ int _glfwPlatformTerminate(void) _glfwLibrary.X11.cursor = (Cursor) 0; } + _glfwTerminateGammaRamp(); + terminateDisplay(); _glfwTerminateJoysticks(); diff --git a/src/x11_platform.h b/src/x11_platform.h index e4fbfe08..4cb20668 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -285,6 +285,7 @@ void _glfwInitTimer(void); // Gamma void _glfwInitGammaRamp(void); +void _glfwTerminateGammaRamp(void); // Fullscreen support int _glfwGetClosestVideoMode(int* width, int* height, int* rate);