Ticket #2845: fake_fullscreen_option.diff
File fake_fullscreen_option.diff, 5.7 KB (added by , 8 years ago) |
---|
-
binaries/data/config/default.cfg
26 26 ; Enable/disable windowed mode by default. (Use Alt+Enter to toggle in the game.) 27 27 windowed = false 28 28 29 ; Use 'fake' fullscreen mode (SDL_WINDOW_FULLSCREEN_DESKTOP) 30 ; when creating the game window to work around some issues 31 ; with true fullscreen mode (SDL_WINDOW_FULLSCREEN). 32 ; See details in http://trac.wildfiregames.com/ticket/2845 33 fakefullscreen = true 34 29 35 ; Show detailed tooltips (Unit stats) 30 36 showdetailedtooltips = false 31 37 -
source/ps/GameSetup/GameSetup.cpp
Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
396 396 if (!reentering) 397 397 { 398 398 reentering = true; 399 g_VideoMode.SetFullscreen(false );399 g_VideoMode.SetFullscreen(false, false); 400 400 reentering = false; 401 401 } 402 402 } -
source/ps/VideoMode.cpp
49 49 CVideoMode::CVideoMode() : 50 50 m_IsFullscreen(false), m_IsInitialised(false), m_Window(NULL), 51 51 m_PreferredW(0), m_PreferredH(0), m_PreferredBPP(0), m_PreferredFreq(0), 52 m_ConfigW(0), m_ConfigH(0), m_ConfigBPP(0), m_ConfigFullscreen(false), m_ConfigForceS3TCEnable(true), 52 m_ConfigW(0), m_ConfigH(0), m_ConfigBPP(0), 53 m_ConfigFullscreen(false), m_ConfigFakeFullscreen(true), m_ConfigForceS3TCEnable(true), 53 54 m_WindowedW(DEFAULT_WINDOW_W), m_WindowedH(DEFAULT_WINDOW_H), m_WindowedX(0), m_WindowedY(0) 54 55 { 55 56 // (m_ConfigFullscreen defaults to false, so users don't get stuck if … … 62 63 CFG_GET_VAL("windowed", windowed); 63 64 m_ConfigFullscreen = !windowed; 64 65 66 CFG_GET_VAL("fakefullscreen", m_ConfigFakeFullscreen); 67 65 68 CFG_GET_VAL("xres", m_ConfigW); 66 69 CFG_GET_VAL("yres", m_ConfigH); 67 70 CFG_GET_VAL("bpp", m_ConfigBPP); … … 69 72 CFG_GET_VAL("force_s3tc_enable", m_ConfigForceS3TCEnable); 70 73 } 71 74 72 bool CVideoMode::SetVideoMode(int w, int h, int bpp, bool fullscreen )75 bool CVideoMode::SetVideoMode(int w, int h, int bpp, bool fullscreen, bool fakeFullscreen) 73 76 { 74 77 Uint32 flags = 0; 75 78 if (fullscreen) 76 flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;79 flags |= (fakeFullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_FULLSCREEN); 77 80 78 81 if (!m_Window) 79 82 { … … 92 95 w, h, bpp, SDL_GetError()); 93 96 // Using default size for the window for now, as the attempted setting 94 97 // could be as large, or larger than the screen size. 95 return SetVideoMode(DEFAULT_WINDOW_W, DEFAULT_WINDOW_H, bpp, false );98 return SetVideoMode(DEFAULT_WINDOW_W, DEFAULT_WINDOW_H, bpp, false, false); 96 99 } 97 100 else 98 101 { … … 215 218 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); 216 219 #endif 217 220 218 if (!SetVideoMode(w, h, bpp, m_ConfigFullscreen ))221 if (!SetVideoMode(w, h, bpp, m_ConfigFullscreen, m_ConfigFakeFullscreen)) 219 222 { 220 223 // Fall back to a smaller depth buffer 221 224 // (The rendering may be ugly but this helps when running in VMware) 222 225 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 223 226 224 if (!SetVideoMode(w, h, bpp, m_ConfigFullscreen ))227 if (!SetVideoMode(w, h, bpp, m_ConfigFullscreen, m_ConfigFakeFullscreen)) 225 228 return false; 226 229 } 227 230 … … 320 323 321 324 int bpp = GetBestBPP(); 322 325 323 if (!SetVideoMode(w, h, bpp, false ))326 if (!SetVideoMode(w, h, bpp, false, false)) 324 327 return false; 325 328 326 329 m_WindowedW = w; … … 331 334 return true; 332 335 } 333 336 334 bool CVideoMode::SetFullscreen(bool fullscreen )337 bool CVideoMode::SetFullscreen(bool fullscreen, bool fakeFullscreen) 335 338 { 336 339 // This might get called before initialisation by psDisplayError; 337 340 // if so then silently fail … … 367 370 368 371 int bpp = GetBestBPP(); 369 372 370 if (!SetVideoMode(w, h, bpp, fullscreen ))373 if (!SetVideoMode(w, h, bpp, fullscreen, fakeFullscreen)) 371 374 return false; 372 375 373 376 UpdateRenderer(m_CurrentW, m_CurrentH); … … 383 386 384 387 int bpp = GetBestBPP(); 385 388 386 if (!SetVideoMode(w, h, bpp, fullscreen ))389 if (!SetVideoMode(w, h, bpp, fullscreen, fakeFullscreen)) 387 390 return false; 388 391 389 392 UpdateRenderer(w, h); … … 394 397 395 398 bool CVideoMode::ToggleFullscreen() 396 399 { 397 return SetFullscreen(!m_IsFullscreen );400 return SetFullscreen(!m_IsFullscreen, m_ConfigFakeFullscreen); 398 401 } 399 402 400 403 void CVideoMode::UpdatePosition(int x, int y) -
source/ps/VideoMode.h
50 50 /** 51 51 * Switch to fullscreen or windowed mode. 52 52 */ 53 bool SetFullscreen(bool fullscreen );53 bool SetFullscreen(bool fullscreen, bool fakeFullscreen); 54 54 55 55 /** 56 56 * Switch between fullscreen and windowed mode. … … 83 83 private: 84 84 void ReadConfig(); 85 85 int GetBestBPP(); 86 bool SetVideoMode(int w, int h, int bpp, bool fullscreen );86 bool SetVideoMode(int w, int h, int bpp, bool fullscreen, bool fakeFullscreen); 87 87 void EnableS3TC(); 88 88 89 89 /** … … 107 107 int m_ConfigBPP; 108 108 int m_ConfigDisplay; 109 109 bool m_ConfigFullscreen; 110 bool m_ConfigFakeFullscreen; 110 111 bool m_ConfigForceS3TCEnable; 111 112 112 113 // If we're fullscreen, size/position of window when we were last windowed (or the default window