removed glw_win.h

This commit is contained in:
myT 2023-11-11 19:38:32 +01:00
parent 35f58c507e
commit 5d9b4ebd13
13 changed files with 18 additions and 82 deletions

View File

@ -1,45 +0,0 @@
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#ifndef _WIN32
# error You should not be including this file on this platform
#endif
#ifndef __GLW_WIN_H__
#define __GLW_WIN_H__
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct {
// @TODO: move this crap out of this file and nuke the file
qbool cdsDevModeValid;
DEVMODE cdsDevMode; // Custom device mode for full-screen with r_mode 1.
} glwstate_t;
extern glwstate_t glw_state;
#if defined(__cplusplus)
};
#endif
#endif

View File

@ -27,7 +27,6 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "../client/client.h"
#endif
#include "win_local.h"
#include "glw_win.h"
#include <DbgHelp.h>
#include <strsafe.h>
@ -543,8 +542,8 @@ static LONG WIN_HandleCrash( EXCEPTION_POINTERS* ep )
#ifndef DEDICATED
__try {
wasDevModeValid = glw_state.cdsDevModeValid;
if (glw_state.cdsDevModeValid)
wasDevModeValid = g_wv.cdsDevModeValid;
if (g_wv.cdsDevModeValid)
WIN_SetDesktopDisplaySettings();
} __except (EXCEPTION_EXECUTE_HANDLER) {}

View File

@ -43,10 +43,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../client/client.h"
#include "resource.h"
#include "win_local.h"
#include "glw_win.h"
glwstate_t glw_state;
// responsible for creating the Win32 window and initializing the OpenGL driver.
@ -218,13 +214,13 @@ static qbool GLW_SetDisplaySettings( DEVMODE& dm )
const int ec = ChangeDisplaySettingsExA( deviceName, &dm, NULL, CDS_FULLSCREEN, NULL );
if ( ec == DISP_CHANGE_SUCCESSFUL )
{
glw_state.cdsDevMode = dm;
glw_state.cdsDevModeValid = qtrue;
g_wv.cdsDevMode = dm;
g_wv.cdsDevModeValid = qtrue;
GLW_UpdateMonitorRect( deviceName );
return qtrue;
}
glw_state.cdsDevModeValid = qfalse;
g_wv.cdsDevModeValid = qfalse;
ri.Printf( PRINT_ALL, "...CDS: %ix%i (C%i) failed: ", (int)dm.dmPelsWidth, (int)dm.dmPelsHeight, (int)dm.dmBitsPerPel );
@ -252,20 +248,20 @@ static void GLW_ResetDisplaySettings( qbool invalidate )
ChangeDisplaySettingsEx( deviceName, NULL, NULL, 0, NULL );
GLW_UpdateMonitorRect( deviceName );
if ( invalidate )
glw_state.cdsDevModeValid = qfalse;
g_wv.cdsDevModeValid = qfalse;
}
void WIN_SetGameDisplaySettings()
{
if ( glw_state.cdsDevModeValid )
GLW_SetDisplaySettings( glw_state.cdsDevMode );
if ( g_wv.cdsDevModeValid )
GLW_SetDisplaySettings( g_wv.cdsDevMode );
}
void WIN_SetDesktopDisplaySettings()
{
// We don't invalidate glw_state.cdsDevModeValid so we can
// We don't invalidate g_wv.cdsDevModeValid so we can
// return to the previous mode later.
GLW_ResetDisplaySettings( qfalse );
}
@ -285,7 +281,7 @@ static qbool GLW_SetMode()
ZeroMemory( &dm, sizeof( dm ) );
dm.dmSize = sizeof( dm );
if (glInfo.vidFullscreen != glw_state.cdsDevModeValid) {
if (glInfo.vidFullscreen != g_wv.cdsDevModeValid) {
if (glInfo.vidFullscreen) {
dm.dmPelsWidth = glConfig.vidWidth;
dm.dmPelsHeight = glConfig.vidHeight;
@ -347,7 +343,7 @@ void Sys_V_Shutdown()
}
// reset display settings
if ( glw_state.cdsDevModeValid )
if ( g_wv.cdsDevModeValid )
{
ri.Printf( PRINT_DEVELOPER, "...resetting display\n" );
GLW_ResetDisplaySettings( qtrue );

View File

@ -84,6 +84,9 @@ typedef struct {
qbool inputInitialized;
qbool forceUnmute; // overrides s_autoMute
DEVMODE cdsDevMode; // custom device mode for full-screen with r_mode 1
qbool cdsDevModeValid;
} WinVars_t;
extern WinVars_t g_wv;

View File

@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../client/client.h"
#include "win_local.h"
#include "glw_win.h"
// Console variables that we need to access from this module
@ -303,13 +302,13 @@ LRESULT CALLBACK MainWndProc (
break;
case WM_SETFOCUS:
if ( glw_state.cdsDevModeValid ) // is there a valid mode to restore?
if ( g_wv.cdsDevModeValid ) // is there a valid mode to restore?
{
WIN_SetGameDisplaySettings();
if ( glw_state.cdsDevModeValid ) // was the mode successfully restored?
if ( g_wv.cdsDevModeValid ) // was the mode successfully restored?
{
const RECT& rect = g_wv.monitorRects[g_wv.monitor];
const DEVMODE& dm = glw_state.cdsDevMode;
const DEVMODE& dm = g_wv.cdsDevMode;
SetWindowPos( hWnd, NULL, (int)rect.left, (int)rect.top, (int)dm.dmPelsWidth, (int)dm.dmPelsHeight, SWP_NOZORDER );
}
}
@ -319,7 +318,7 @@ LRESULT CALLBACK MainWndProc (
case WM_KILLFOCUS:
g_wv.activeApp = qfalse;
if ( glw_state.cdsDevModeValid )
if ( g_wv.cdsDevModeValid )
WIN_SetDesktopDisplaySettings();
break;

View File

@ -187,7 +187,6 @@ copy "..\..\.bin\release\cnq3-server.pdb" "$(QUAKE3DIR)"</Command>
<ClInclude Include="..\..\code\qcommon\vm_local.h" />
<ClInclude Include="..\..\code\qcommon\vm_shim.h" />
<ClInclude Include="..\..\code\server\server.h" />
<ClInclude Include="..\..\code\win32\glw_win.h" />
<ClInclude Include="..\..\code\win32\resource.h" />
<ClInclude Include="..\..\code\win32\win_help.h" />
<ClInclude Include="..\..\code\win32\win_local.h" />

View File

@ -204,9 +204,6 @@
<ClInclude Include="..\..\code\server\server.h">
<Filter>server</Filter>
</ClInclude>
<ClInclude Include="..\..\code\win32\glw_win.h">
<Filter>win32</Filter>
</ClInclude>
<ClInclude Include="..\..\code\win32\resource.h">
<Filter>win32</Filter>
</ClInclude>

View File

@ -210,7 +210,6 @@ copy "..\..\.bin\release\cnq3.pdb" "$(QUAKE3DIR)"</Command>
<ClInclude Include="..\..\code\renderer\tr_public.h" />
<ClInclude Include="..\..\code\renderer\uber_shaders.h" />
<ClInclude Include="..\..\code\server\server.h" />
<ClInclude Include="..\..\code\win32\glw_win.h" />
<ClInclude Include="..\..\code\win32\resource.h" />
<ClInclude Include="..\..\code\win32\win_help.h" />
<ClInclude Include="..\..\code\win32\win_local.h" />

View File

@ -276,9 +276,6 @@
<ClInclude Include="..\..\code\server\server.h">
<Filter>server</Filter>
</ClInclude>
<ClInclude Include="..\..\code\win32\glw_win.h">
<Filter>win32</Filter>
</ClInclude>
<ClInclude Include="..\..\code\win32\resource.h">
<Filter>win32</Filter>
</ClInclude>

View File

@ -189,7 +189,6 @@ copy "..\..\.bin\release\cnq3-server.pdb" "$(QUAKE3DIR)"</Command>
<ClInclude Include="..\..\code\qcommon\vm_local.h" />
<ClInclude Include="..\..\code\qcommon\vm_shim.h" />
<ClInclude Include="..\..\code\server\server.h" />
<ClInclude Include="..\..\code\win32\glw_win.h" />
<ClInclude Include="..\..\code\win32\resource.h" />
<ClInclude Include="..\..\code\win32\win_help.h" />
<ClInclude Include="..\..\code\win32\win_local.h" />

View File

@ -204,9 +204,6 @@
<ClInclude Include="..\..\code\server\server.h">
<Filter>server</Filter>
</ClInclude>
<ClInclude Include="..\..\code\win32\glw_win.h">
<Filter>win32</Filter>
</ClInclude>
<ClInclude Include="..\..\code\win32\resource.h">
<Filter>win32</Filter>
</ClInclude>

View File

@ -212,7 +212,6 @@ copy "..\..\.bin\release\cnq3.pdb" "$(QUAKE3DIR)"</Command>
<ClInclude Include="..\..\code\renderer\tr_public.h" />
<ClInclude Include="..\..\code\renderer\uber_shaders.h" />
<ClInclude Include="..\..\code\server\server.h" />
<ClInclude Include="..\..\code\win32\glw_win.h" />
<ClInclude Include="..\..\code\win32\resource.h" />
<ClInclude Include="..\..\code\win32\win_help.h" />
<ClInclude Include="..\..\code\win32\win_local.h" />

View File

@ -276,9 +276,6 @@
<ClInclude Include="..\..\code\server\server.h">
<Filter>server</Filter>
</ClInclude>
<ClInclude Include="..\..\code\win32\glw_win.h">
<Filter>win32</Filter>
</ClInclude>
<ClInclude Include="..\..\code\win32\resource.h">
<Filter>win32</Filter>
</ClInclude>