mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-11-05 21:07:21 +00:00
Full-screen / resolution change: fix display flicker. (Fixes #965)
This commit is contained in:
parent
0e275f0131
commit
7086ea5208
@ -60,7 +60,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
static bool g_bLoadedSaveState = false;
|
||||
static bool g_bSysClkOK = false;
|
||||
|
||||
bool g_bRestartFullScreen = false;
|
||||
bool g_bRestartFullScreen = false;
|
||||
|
||||
//===========================================================================
|
||||
|
||||
@ -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();
|
||||
|
@ -9,4 +9,4 @@ bool GetLoadedSaveStateFlag(void);
|
||||
bool GetHookAltTab(void);
|
||||
bool GetHookAltGrControl(void);
|
||||
|
||||
extern bool g_bRestartFullScreen;
|
||||
extern bool g_bRestartFullScreen;
|
||||
|
@ -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)
|
||||
{
|
||||
ChangeDisplaySettings(NULL, 0); // restore default resolution
|
||||
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