From fdc14ca80549ad5e698e117a60b5112762987e67 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Apr 2020 13:05:58 +0200 Subject: [PATCH] - renamed fullscreen CVar internally to vid_fullscreen to make searching for it easier. The word 'fullscreen' appears a bit too frequently in the source. --- src/console/c_cvars.h | 5 +++++ src/d_main.cpp | 2 +- src/menu/resolutionmenu.cpp | 6 +++--- src/posix/cocoa/i_video.mm | 14 +++++++------- src/posix/sdl/sdlglvideo.cpp | 16 ++++++++-------- src/rendering/gl/system/gl_framebuffer.cpp | 2 +- src/rendering/v_video.cpp | 2 +- src/rendering/v_video.h | 2 +- src/win32/base_sysfb.cpp | 6 +++--- src/win32/i_system.cpp | 4 ++-- src/win32/win32glvideo.cpp | 2 +- src/win32/win32polyvideo.h | 4 ++-- src/win32/win32vulkanvideo.h | 4 ++-- 13 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/console/c_cvars.h b/src/console/c_cvars.h index 1e2f75c89..0a00ccb4f 100644 --- a/src/console/c_cvars.h +++ b/src/console/c_cvars.h @@ -438,6 +438,11 @@ void C_ForgetCVars (void); F##type##CVar name (#name, def, flags, cvarfunc_##name); \ static void cvarfunc_##name(F##type##CVar &self) +#define CUSTOM_CVAR_NAMED(type,name,cname,def,flags) \ + static void cvarfunc_##name(F##type##CVar &); \ + F##type##CVar name (#cname, def, flags, cvarfunc_##name); \ + static void cvarfunc_##name(F##type##CVar &self) + #define CVAR(type,name,def,flags) \ F##type##CVar name (#name, def, flags); diff --git a/src/d_main.cpp b/src/d_main.cpp index 7f980b4cd..5198b4d07 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -781,7 +781,7 @@ void D_Display () if (setmodeneeded) { setmodeneeded = false; - screen->ToggleFullscreen(fullscreen); + screen->ToggleFullscreen(vid_fullscreen); V_OutputResized(screen->GetWidth(), screen->GetHeight()); } diff --git a/src/menu/resolutionmenu.cpp b/src/menu/resolutionmenu.cpp index 39114c8e7..2f5d8d983 100644 --- a/src/menu/resolutionmenu.cpp +++ b/src/menu/resolutionmenu.cpp @@ -42,7 +42,7 @@ CVAR(Int, menu_resolution_custom_width, 640, 0) CVAR(Int, menu_resolution_custom_height, 480, 0) -EXTERN_CVAR(Bool, fullscreen) +EXTERN_CVAR(Bool, vid_fullscreen) EXTERN_CVAR(Bool, win_maximized) EXTERN_CVAR(Float, vid_scale_custompixelaspect) EXTERN_CVAR(Int, vid_scale_customwidth) @@ -66,7 +66,7 @@ CCMD (menu_resolution_set_custom) CCMD (menu_resolution_commit_changes) { - int do_fullscreen = fullscreen; + int do_fullscreen = vid_fullscreen; if (argv.argc() > 1) { do_fullscreen = atoi(argv[1]); @@ -81,7 +81,7 @@ CCMD (menu_resolution_commit_changes) } else { - fullscreen = true; + vid_fullscreen = true; vid_scalemode = 5; vid_scalefactor = 1.; vid_scale_customwidth = menu_resolution_custom_width; diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index e7f7c5fb9..b220609e8 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -430,7 +430,7 @@ public: try { m_vulkanDevice = new VulkanDevice(); - fb = new VulkanFrameBuffer(nullptr, fullscreen, m_vulkanDevice); + fb = new VulkanFrameBuffer(nullptr, vid_fullscreen, m_vulkanDevice); } catch (std::exception const&) { @@ -445,7 +445,7 @@ public: { SetupOpenGLView(ms_window, OpenGLProfile::Legacy); - fb = new PolyFrameBuffer(nullptr, fullscreen); + fb = new PolyFrameBuffer(nullptr, vid_fullscreen); } else { @@ -454,18 +454,18 @@ public: if (fb == nullptr) { - fb = new OpenGLRenderer::OpenGLFrameBuffer(0, fullscreen); + fb = new OpenGLRenderer::OpenGLFrameBuffer(0, vid_fullscreen); } fb->SetWindow(ms_window); - fb->SetMode(fullscreen, vid_hidpi); + fb->SetMode(vid_fullscreen, vid_hidpi); fb->SetSize(fb->GetClientWidth(), fb->GetClientHeight()); // This lame hack is a temporary workaround for strange performance issues // with fullscreen window and Core Animation's Metal layer // It is somehow related to initial window level and flags // Toggling fullscreen -> window -> fullscreen mysteriously solves the problem - if (ms_isVulkanEnabled && fullscreen) + if (ms_isVulkanEnabled && vid_fullscreen) { fb->SetMode(false, vid_hidpi); fb->SetMode(true, vid_hidpi); @@ -542,10 +542,10 @@ void SystemBaseFrameBuffer::SetWindowSize(int width, int height) return; } - if (fullscreen) + if (vid_fullscreen) { // Enter windowed mode in order to calculate title bar height - fullscreen = false; + vid_fullscreen = false; SetMode(false, m_hiDPI); } diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index e8c0969da..9d5e26798 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -468,7 +468,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer () { assert(device == nullptr); device = new VulkanDevice(); - fb = new VulkanFrameBuffer(nullptr, fullscreen, device); + fb = new VulkanFrameBuffer(nullptr, vid_fullscreen, device); } catch (CVulkanError const&) { @@ -484,12 +484,12 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer () if (Priv::softpolyEnabled) { - fb = new PolyFrameBuffer(nullptr, fullscreen); + fb = new PolyFrameBuffer(nullptr, vid_fullscreen); } if (fb == nullptr) { - fb = new OpenGLRenderer::OpenGLFrameBuffer(0, fullscreen); + fb = new OpenGLRenderer::OpenGLFrameBuffer(0, vid_fullscreen); } return fb; @@ -569,7 +569,7 @@ void SystemBaseFrameBuffer::ToggleFullscreen(bool yes) if ( !Priv::fullscreenSwitch ) { Priv::fullscreenSwitch = true; - fullscreen = false; + vid_fullscreen = false; } else { @@ -588,9 +588,9 @@ void SystemBaseFrameBuffer::SetWindowSize(int w, int h) } win_w = w; win_h = h; - if ( fullscreen ) + if (vid_fullscreen ) { - fullscreen = false; + vid_fullscreen = false; } else { @@ -729,7 +729,7 @@ void ProcessSDLWindowEvent(const SDL_WindowEvent &event) break; case SDL_WINDOWEVENT_MOVED: - if (!fullscreen && Priv::GetWindowBordersSize) + if (!vid_fullscreen && Priv::GetWindowBordersSize) { int top = 0, left = 0; Priv::GetWindowBordersSize(Priv::window, &top, &left, nullptr, nullptr); @@ -739,7 +739,7 @@ void ProcessSDLWindowEvent(const SDL_WindowEvent &event) break; case SDL_WINDOWEVENT_RESIZED: - if (!fullscreen && !Priv::fullscreenSwitch) + if (!vid_fullscreen && !Priv::fullscreenSwitch) { win_w = event.data1; win_h = event.data2; diff --git a/src/rendering/gl/system/gl_framebuffer.cpp b/src/rendering/gl/system/gl_framebuffer.cpp index c1bfd9713..48dccc0a3 100644 --- a/src/rendering/gl/system/gl_framebuffer.cpp +++ b/src/rendering/gl/system/gl_framebuffer.cpp @@ -435,7 +435,7 @@ TArray OpenGLFrameBuffer::GetScreenshotBuffer(int &pitch, ESSType &colo // Screenshot should not use gamma correction if it was already applied to rendered image gamma = 1; - if (vid_hdr_active && fullscreen) + if (vid_hdr_active && vid_fullscreen) gamma *= 2.2f; return ScreenshotBuffer; } diff --git a/src/rendering/v_video.cpp b/src/rendering/v_video.cpp index 9b61eb243..7aa3cc1a1 100644 --- a/src/rendering/v_video.cpp +++ b/src/rendering/v_video.cpp @@ -755,7 +755,7 @@ void IVideo::DumpAdapters () Printf("Multi-monitor support unavailable.\n"); } -CUSTOM_CVAR(Bool, fullscreen, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +CUSTOM_CVAR_NAMED(Bool, vid_fullscreen, fullscreen, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { setmodeneeded = true; } diff --git a/src/rendering/v_video.h b/src/rendering/v_video.h index 01745c8d4..3ced85d51 100644 --- a/src/rendering/v_video.h +++ b/src/rendering/v_video.h @@ -122,7 +122,7 @@ void V_OutputResized (int width, int height); void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *cx1=NULL, int *cx2=NULL); EXTERN_CVAR(Int, vid_rendermode) -EXTERN_CVAR(Bool, fullscreen) +EXTERN_CVAR(Bool, vid_fullscreen) EXTERN_CVAR(Int, win_x) EXTERN_CVAR(Int, win_y) EXTERN_CVAR(Int, win_w) diff --git a/src/win32/base_sysfb.cpp b/src/win32/base_sysfb.cpp index c65b0f099..0526e0f09 100644 --- a/src/win32/base_sysfb.cpp +++ b/src/win32/base_sysfb.cpp @@ -251,7 +251,7 @@ void SystemBaseFrameBuffer::SetWindowSize(int w, int h) KeepWindowOnScreen(winx, winy, winw, winh, scrwidth, scrheight); } - if (!fullscreen) + if (!vid_fullscreen) { ShowWindow(Window, SW_SHOWNORMAL); SetWindowPos(Window, nullptr, winx, winy, winw, winh, SWP_NOZORDER | SWP_FRAMECHANGED); @@ -266,7 +266,7 @@ void SystemBaseFrameBuffer::SetWindowSize(int w, int h) win_w = winw; win_h = winh; win_maximized = false; - fullscreen = false; + vid_fullscreen = false; } } } @@ -335,7 +335,7 @@ void SystemBaseFrameBuffer::PositionWindow(bool fullscreen, bool initialcall) // This doesn't restore the window size properly so we must force a set size the next tic. if (m_Fullscreen) { - ::fullscreen = false; + ::vid_fullscreen = false; } } diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 0d03ba680..f96cc7a68 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -547,7 +547,7 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa // Check the current video settings. //SendDlgItemMessage( hDlg, vid_renderer ? IDC_WELCOME_OPENGL : IDC_WELCOME_SOFTWARE, BM_SETCHECK, BST_CHECKED, 0 ); - SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_SETCHECK, fullscreen ? BST_CHECKED : BST_UNCHECKED, 0 ); + SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_SETCHECK, vid_fullscreen ? BST_CHECKED : BST_UNCHECKED, 0 ); switch (vid_preferbackend) { case 1: @@ -605,7 +605,7 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa { SetQueryIWad(hDlg); // [SP] Upstreamed from Zandronum - fullscreen = SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_GETCHECK, 0, 0 ) == BST_CHECKED; + vid_fullscreen = SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_GETCHECK, 0, 0 ) == BST_CHECKED; if (SendDlgItemMessage(hDlg, IDC_WELCOME_VULKAN3, BM_GETCHECK, 0, 0) == BST_CHECKED) vid_preferbackend = 2; else if (SendDlgItemMessage(hDlg, IDC_WELCOME_VULKAN2, BM_GETCHECK, 0, 0) == BST_CHECKED) diff --git a/src/win32/win32glvideo.cpp b/src/win32/win32glvideo.cpp index d17f6b259..25a9db723 100644 --- a/src/win32/win32glvideo.cpp +++ b/src/win32/win32glvideo.cpp @@ -97,7 +97,7 @@ DFrameBuffer *Win32GLVideo::CreateFrameBuffer() { SystemGLFrameBuffer *fb; - fb = new OpenGLRenderer::OpenGLFrameBuffer(m_hMonitor, fullscreen); + fb = new OpenGLRenderer::OpenGLFrameBuffer(m_hMonitor, vid_fullscreen); return fb; } diff --git a/src/win32/win32polyvideo.h b/src/win32/win32polyvideo.h index e1ad6d503..6d1648d0c 100644 --- a/src/win32/win32polyvideo.h +++ b/src/win32/win32polyvideo.h @@ -4,7 +4,7 @@ #include "c_cvars.h" #include "rendering/polyrenderer/backend/poly_framebuffer.h" -EXTERN_CVAR(Bool, fullscreen) +EXTERN_CVAR(Bool, vid_fullscreen) class Win32PolyVideo : public Win32BaseVideo { @@ -15,7 +15,7 @@ public: DFrameBuffer *CreateFrameBuffer() override { - auto fb = new PolyFrameBuffer(m_hMonitor, fullscreen); + auto fb = new PolyFrameBuffer(m_hMonitor, vid_fullscreen); return fb; } }; diff --git a/src/win32/win32vulkanvideo.h b/src/win32/win32vulkanvideo.h index 05e5c2d55..c34c41d72 100644 --- a/src/win32/win32vulkanvideo.h +++ b/src/win32/win32vulkanvideo.h @@ -5,7 +5,7 @@ #include "rendering/vulkan/system/vk_framebuffer.h" -EXTERN_CVAR(Bool, fullscreen) +EXTERN_CVAR(Bool, vid_fullscreen) //========================================================================== // @@ -35,7 +35,7 @@ public: DFrameBuffer *CreateFrameBuffer() override { - auto fb = new VulkanFrameBuffer(m_hMonitor, fullscreen, device); + auto fb = new VulkanFrameBuffer(m_hMonitor, vid_fullscreen, device); return fb; }