mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 06:14:35 +00:00
Fixed possible X11 screensaver race condition.
This commit is contained in:
parent
58c69a9ac4
commit
dcb4d8ee32
@ -110,6 +110,8 @@ See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/).
|
||||
- [Cocoa] Bugfix: Selectors were used that are not declared by the 10.6 SDK
|
||||
- [X11] Bugfix: Override-redirect windows were resized to the desired instead
|
||||
of the actual resolution of the selected video mode
|
||||
- [X11] Bugfix: Screensaver override for full screen windows had a possible
|
||||
race condition
|
||||
|
||||
|
||||
## Contact
|
||||
|
@ -173,7 +173,7 @@ typedef struct _GLFWlibraryX11
|
||||
int keyCodeLUT[256];
|
||||
|
||||
struct {
|
||||
GLboolean changed;
|
||||
int count;
|
||||
int timeout;
|
||||
int interval;
|
||||
int blanking;
|
||||
|
@ -361,7 +361,7 @@ static void showCursor(_GLFWwindow* window)
|
||||
//
|
||||
static void enterFullscreenMode(_GLFWwindow* window)
|
||||
{
|
||||
if (!_glfw.x11.saver.changed)
|
||||
if (_glfw.x11.saver.count == 0)
|
||||
{
|
||||
// Remember old screen saver settings
|
||||
XGetScreenSaver(_glfw.x11.display,
|
||||
@ -373,10 +373,10 @@ static void enterFullscreenMode(_GLFWwindow* window)
|
||||
// Disable screen saver
|
||||
XSetScreenSaver(_glfw.x11.display, 0, 0, DontPreferBlanking,
|
||||
DefaultExposures);
|
||||
|
||||
_glfw.x11.saver.changed = GL_TRUE;
|
||||
}
|
||||
|
||||
_glfw.x11.saver.count++;
|
||||
|
||||
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
||||
|
||||
if (_glfw.x11.hasEWMH &&
|
||||
@ -455,7 +455,9 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
||||
{
|
||||
_glfwRestoreVideoMode(window->monitor);
|
||||
|
||||
if (_glfw.x11.saver.changed)
|
||||
_glfw.x11.saver.count--;
|
||||
|
||||
if (_glfw.x11.saver.count == 0)
|
||||
{
|
||||
// Restore old screen saver settings
|
||||
XSetScreenSaver(_glfw.x11.display,
|
||||
@ -463,8 +465,6 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
||||
_glfw.x11.saver.interval,
|
||||
_glfw.x11.saver.blanking,
|
||||
_glfw.x11.saver.exposure);
|
||||
|
||||
_glfw.x11.saver.changed = GL_FALSE;
|
||||
}
|
||||
|
||||
if (_glfw.x11.hasEWMH &&
|
||||
|
Loading…
Reference in New Issue
Block a user