Commit 42a7d720 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Restore display mode to original in more cases.

We only care if we have changed the mode and we're changing it back to its original. Even if the current mode matches the target mode, we may still need to release the displays and clear the entry from originalDisplayModes.
parent 9c65d672
......@@ -711,27 +711,7 @@ int macdrv_err_on;
BOOL ret = FALSE;
BOOL active = [NSApp isActive];
NSNumber* displayIDKey = [NSNumber numberWithUnsignedInt:displayID];
CGDisplayModeRef currentMode = NULL, originalMode;
if (!active)
currentMode = CGDisplayModeRetain((CGDisplayModeRef)[latentDisplayModes objectForKey:displayIDKey]);
if (!currentMode)
currentMode = CGDisplayCopyDisplayMode(displayID);
if (!currentMode) // Invalid display ID
return FALSE;
if ([self mode:mode matchesMode:currentMode]) // Already there!
{
CGDisplayModeRelease(currentMode);
return TRUE;
}
CGDisplayModeRelease(currentMode);
currentMode = NULL;
mode = [self modeMatchingMode:mode forDisplay:displayID];
if (!mode)
return FALSE;
CGDisplayModeRef originalMode;
originalMode = (CGDisplayModeRef)[originalDisplayModes objectForKey:displayIDKey];
......@@ -752,7 +732,11 @@ int macdrv_err_on;
else // ... otherwise, try to restore just the one display
{
if (active)
{
mode = [self modeMatchingMode:mode forDisplay:displayID];
if (mode)
ret = (CGDisplaySetDisplayMode(displayID, mode, NULL) == CGDisplayNoErr);
}
else
{
[latentDisplayModes removeObjectForKey:displayIDKey];
......@@ -764,6 +748,28 @@ int macdrv_err_on;
}
else
{
CGDisplayModeRef currentMode = NULL;
if (!active)
currentMode = CGDisplayModeRetain((CGDisplayModeRef)[latentDisplayModes objectForKey:displayIDKey]);
if (!currentMode)
currentMode = CGDisplayCopyDisplayMode(displayID);
if (!currentMode) // Invalid display ID
return FALSE;
if ([self mode:mode matchesMode:currentMode]) // Already there!
{
CGDisplayModeRelease(currentMode);
return TRUE;
}
CGDisplayModeRelease(currentMode);
currentMode = NULL;
mode = [self modeMatchingMode:mode forDisplay:displayID];
if (!mode)
return FALSE;
if ([originalDisplayModes count] || displaysCapturedForFullscreen ||
!active || CGCaptureAllDisplays() == CGDisplayNoErr)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment