mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-23 00:30:17 +00:00
Full-screen / resolution change: fix display flicker. (Fixes #965)
This commit is contained in:
parent
0e275f0131
commit
7086ea5208
@ -896,7 +896,7 @@ static void RepeatInitialization(void)
|
||||
|
||||
static void Shutdown(void)
|
||||
{
|
||||
ChangeDisplaySettings(NULL, 0); // restore default resolution
|
||||
// NB. WM_CLOSE has already called SetNormalMode() to exit full screen mode & restore default resolution
|
||||
|
||||
// Release COM
|
||||
SysClk_UninitTimer();
|
||||
|
@ -38,6 +38,7 @@ Win32Frame::Win32Frame()
|
||||
g_win_fullscreen_offsety = 0;
|
||||
m_bestWidthForFullScreen = 0;
|
||||
m_bestHeightForFullScreen = 0;
|
||||
m_changedDisplaySettings = false;
|
||||
|
||||
btnfacebrush = (HBRUSH)0;
|
||||
btnfacepen = (HPEN)0;
|
||||
|
@ -134,6 +134,7 @@ private:
|
||||
int g_win_fullscreen_offsety;
|
||||
UINT m_bestWidthForFullScreen;
|
||||
UINT m_bestHeightForFullScreen;
|
||||
bool m_changedDisplaySettings;
|
||||
|
||||
static const UINT MAX_DRAW_DEVICES = 10;
|
||||
char* draw_devices[MAX_DRAW_DEVICES];
|
||||
|
@ -2126,6 +2126,7 @@ void Win32Frame::SetFullScreenMode(void)
|
||||
|
||||
DWORD dwFlags = 0;
|
||||
LONG res = ChangeDisplaySettings(&devMode, dwFlags);
|
||||
m_changedDisplaySettings = true;
|
||||
}
|
||||
|
||||
//
|
||||
@ -2175,7 +2176,12 @@ void Win32Frame::SetFullScreenMode(void)
|
||||
//===========================================================================
|
||||
void Win32Frame::SetNormalMode(void)
|
||||
{
|
||||
if (m_changedDisplaySettings)
|
||||
{
|
||||
// Only call ChangeDisplaySettings() if resolution has changed, otherwise there'll be a display flicker (GH#965)
|
||||
ChangeDisplaySettings(NULL, 0); // restore default resolution
|
||||
m_changedDisplaySettings = false;
|
||||
}
|
||||
|
||||
FullScreenRevealCursor(); // Do before clearing g_bIsFullScreen flag
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user