winemac: Don't record original display modes when not the active app.

originalDisplayModes should be used when active, empty when inactive.
latentDisplayModes is used when inactive, empty when active.

The count of entries in originalDisplayModes is used to test whether the
process has the displays captured so adding entries when inactive would give
incorrect results.  This could have led us to mistakenly change the display
mode when we don't have the displays captured.
This commit is contained in:
Ken Thomases 2014-01-10 03:11:19 -06:00 committed by Alexandre Julliard
parent a1d8886f6a
commit fe1c0ab952
1 changed files with 11 additions and 9 deletions

View File

@ -770,21 +770,23 @@ - (BOOL) setMode:(CGDisplayModeRef)mode forDisplay:(CGDirectDisplayID)displayID
!active || CGCaptureAllDisplays() == CGDisplayNoErr)
{
if (active)
{
ret = (CGDisplaySetDisplayMode(displayID, mode, NULL) == CGDisplayNoErr);
if (ret)
[originalDisplayModes setObject:(id)originalMode forKey:displayIDKey];
else if (![originalDisplayModes count])
{
CGRestorePermanentDisplayConfiguration();
[latentDisplayModes removeAllObjects];
if (!displaysCapturedForFullscreen)
CGReleaseAllDisplays();
}
}
else
{
[latentDisplayModes setObject:(id)mode forKey:displayIDKey];
ret = TRUE;
}
if (ret)
[originalDisplayModes setObject:(id)originalMode forKey:displayIDKey];
else if (![originalDisplayModes count])
{
CGRestorePermanentDisplayConfiguration();
[latentDisplayModes removeAllObjects];
if (!displaysCapturedForFullscreen)
CGReleaseAllDisplays();
}
}
}