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:
parent
a1d8886f6a
commit
fe1c0ab952
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue