about summary refs log tree commit diff
path: root/src/engine/client
diff options
context:
space:
mode:
authorheinrich5991 <heinrich5991@gmail.com>2012-06-27 11:46:11 +0200
committeroy <Tom_Adams@web.de>2013-02-24 17:38:19 +0100
commit7b545f3ed941d45c3a42016b9de667a08f8d4dc6 (patch)
treea7e6c86753d4daa7c81e041b8480a0ff5b7f53de /src/engine/client
parent56ae76f46574506fa2b28fbf2fdf5672ae5866c6 (diff)
downloadzcatch-7b545f3ed941d45c3a42016b9de667a08f8d4dc6.tar.gz
zcatch-7b545f3ed941d45c3a42016b9de667a08f8d4dc6.zip
Added borderless window functionality
	This might become handy for users with multiple monitors,
	might resolve other issues aswell
Diffstat (limited to 'src/engine/client')
-rw-r--r--src/engine/client/backend_sdl.cpp7
-rw-r--r--src/engine/client/graphics.cpp10
-rw-r--r--src/engine/client/graphics_threaded.cpp9
-rw-r--r--src/engine/client/graphics_threaded.h1
4 files changed, 25 insertions, 2 deletions
diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp
index b04b729e..18f1cee6 100644
--- a/src/engine/client/backend_sdl.cpp
+++ b/src/engine/client/backend_sdl.cpp
@@ -427,6 +427,13 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Width, int *Height
 	if(pInfo->blit_hw) // ignore_convention
 		SdlFlags |= SDL_HWACCEL;
 
+	dbg_assert(!(Flags&IGraphicsBackend::INITFLAG_BORDERLESS)
+		|| !(Flags&IGraphicsBackend::INITFLAG_FULLSCREEN),
+		"only one of borderless and fullscreen may be activated at the same time");
+
+	if(Flags&IGraphicsBackend::INITFLAG_BORDERLESS)
+		SdlFlags |= SDL_NOFRAME;
+
 	if(Flags&IGraphicsBackend::INITFLAG_FULLSCREEN)
 		SdlFlags |= SDL_FULLSCREEN;
 
diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp
index 8816e1ed..314669e2 100644
--- a/src/engine/client/graphics.cpp
+++ b/src/engine/client/graphics.cpp
@@ -801,7 +801,15 @@ int CGraphics_SDL::TryInit()
 	if(pInfo->blit_hw) // ignore_convention
 		Flags |= SDL_HWACCEL;
 
-	if(g_Config.m_GfxFullscreen)
+	if(g_Config.m_GfxBorderless && g_Config.m_GfxFullscreen)
+	{
+		dbg_msg("gfx", "both borderless and fullscreen activated, disabling borderless");
+		g_Config.m_GfxBorderless = 0;
+	}
+
+	if(g_Config.m_GfxBorderless)
+		Flags |= SDL_NOFRAME;
+	else if(g_Config.m_GfxFullscreen)
 		Flags |= SDL_FULLSCREEN;
 
 	// set gl attributes
diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp
index 0c99ebf7..f67753fb 100644
--- a/src/engine/client/graphics_threaded.cpp
+++ b/src/engine/client/graphics_threaded.cpp
@@ -712,7 +712,14 @@ void CGraphics_Threaded::QuadsText(float x, float y, float Size, float r, float
 int CGraphics_Threaded::IssueInit()
 {
 	int Flags = 0;
-	if(g_Config.m_GfxFullscreen) Flags |= IGraphicsBackend::INITFLAG_FULLSCREEN;
+	if(g_Config.m_GfxBorderless && g_Config.m_GfxFullscreen)
+	{
+		dbg_msg("gfx", "both borderless and fullscreen activated, disabling borderless");
+		g_Config.m_GfxBorderless = 0;
+	}
+
+	if(g_Config.m_GfxBorderless) Flags |= IGraphicsBackend::INITFLAG_BORDERLESS;
+	else if(g_Config.m_GfxFullscreen) Flags |= IGraphicsBackend::INITFLAG_FULLSCREEN;
 	if(g_Config.m_GfxVsync) Flags |= IGraphicsBackend::INITFLAG_VSYNC;
 	if(g_Config.m_DbgResizable) Flags |= IGraphicsBackend::INITFLAG_RESIZABLE;
 
diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h
index d3ccc61e..253059ec 100644
--- a/src/engine/client/graphics_threaded.h
+++ b/src/engine/client/graphics_threaded.h
@@ -300,6 +300,7 @@ public:
 		INITFLAG_FULLSCREEN = 1,
 		INITFLAG_VSYNC = 2,
 		INITFLAG_RESIZABLE = 4,
+		INITFLAG_BORDERLESS = 8,
 	};
 
 	virtual int Init(const char *pName, int *Width, int *Height, int FsaaSamples, int Flags) = 0;