Module: wine Branch: master Commit: fe1c0ab952d1b17c6079fef9ca418fafa812a878 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fe1c0ab952d1b17c6079fef9ca...
Author: Ken Thomases ken@codeweavers.com Date: Fri Jan 10 03:11:19 2014 -0600
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.
---
dlls/winemac.drv/cocoa_app.m | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index fea30e3..3521e06 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -770,21 +770,23 @@ int macdrv_err_on; !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(); - } } }