Ken Thomases : winemac: Use the display unit number rather than display ID for the initial display mode registry key.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 17 09:57:48 CST 2015


Module: wine
Branch: master
Commit: 66fc13197b6b8eaabd62effcf36d8c27e71c1c97
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=66fc13197b6b8eaabd62effcf36d8c27e71c1c97

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Nov 16 22:11:12 2015 -0600

winemac: Use the display unit number rather than display ID for the initial display mode registry key.

On Macs with dual GPUs that automatically switch, the display ID is not stable.
It changes when the active GPU changes.  The resulted in the lookup of the
initial display mode failing and games not being able to restore it properly.

The display unit number should be more reliable, although still not perfect.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c
index e1357d8..ad01191 100644
--- a/dlls/winemac.drv/display.c
+++ b/dlls/winemac.drv/display.c
@@ -187,7 +187,7 @@ static BOOL write_display_settings(HKEY parent_hkey, CGDirectDisplayID displayID
     size_t len;
     WCHAR* buf = NULL;
 
-    snprintf(display_key_name, sizeof(display_key_name), "Display 0x%08x", displayID);
+    snprintf(display_key_name, sizeof(display_key_name), "Display 0x%08x", CGDisplayUnitNumber(displayID));
     /* @@ Wine registry key: HKLM\Software\Wine\Mac Driver\Initial Display Mode\Display 0xnnnnnnnn */
     if (RegCreateKeyExA(parent_hkey, display_key_name, 0, NULL,
                         REG_OPTION_VOLATILE, KEY_WRITE, NULL, &display_hkey, NULL))
@@ -328,7 +328,7 @@ static struct display_mode_descriptor* create_original_display_mode_descriptor(C
 
     init_original_display_mode();
 
-    snprintf(display_key, sizeof(display_key), display_key_format, displayID);
+    snprintf(display_key, sizeof(display_key), display_key_format, CGDisplayUnitNumber(displayID));
     /* @@ Wine registry key: HKLM\Software\Wine\Mac Driver\Initial Display Mode\Display 0xnnnnnnnn */
     if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, display_key, 0, KEY_READ, &hkey))
         return NULL;




More information about the wine-cvs mailing list