From 36226401bf8943badd70a1c462b70e055279965e Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Mon, 20 Dec 2010 17:38:26 +0100 Subject: [PATCH] Store and restore caption and mouse visibility when using setMode (bug #142) --- src/modules/graphics/opengl/Graphics.cpp | 8 ++++++++ src/modules/graphics/opengl/Graphics.h | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index e116e541d..6f117967c 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -117,6 +117,11 @@ namespace opengl //do we have scissor, if so, store the box if (s.scissor) glGetIntegerv(GL_SCISSOR_BOX, s.scissorBox); + + char *cap = 0; + SDL_WM_GetCaption(&cap, 0); + s.caption = cap; + s.mouseVisible = (SDL_ShowCursor(SDL_QUERY) == SDL_ENABLE) ? true : false; return s; } @@ -136,6 +141,9 @@ namespace opengl setScissor(s.scissorBox[0], s.scissorBox[1], s.scissorBox[2], s.scissorBox[3]); else setScissor(); + + setCaption(s.caption.c_str()); + SDL_ShowCursor(s.mouseVisible ? SDL_ENABLE : SDL_DISABLE); } bool Graphics::setMode(int width, int height, bool fullscreen, bool vsync, int fsaa) diff --git a/src/modules/graphics/opengl/Graphics.h b/src/modules/graphics/opengl/Graphics.h index 5e3bbd103..eab462031 100644 --- a/src/modules/graphics/opengl/Graphics.h +++ b/src/modules/graphics/opengl/Graphics.h @@ -93,6 +93,10 @@ namespace opengl bool scissor; GLint scissorBox[4]; + // Window info. + std::string caption; + bool mouseVisible; + // Default values. DisplayState() { @@ -112,6 +116,8 @@ namespace opengl pointSize = 1.0f; pointStyle = Graphics::POINT_SMOOTH; scissor = false; + caption = ""; + mouseVisible = true; } };