Module: wine
Branch: master
Commit: 15968690eb541f3eb0c145e538f7dc7bab85f60a
URL: https://gitlab.winehq.org/wine/wine/-/commit/15968690eb541f3eb0c145e538f7dc…
Author: Tim Clem <tclem(a)codeweavers.com>
Date: Tue May 7 14:35:21 2024 -0700
winemac.drv: Do not consider the "valid" and "safe" flags as making a display mode unique.
In the case that unsafe/invalid modes aren't excluded entirely by
the include_unsupported flag to copy_display_modes, we actually want
to compare them to their counterparts with the same resolution, so
that we can prefer the safe and valid alternatives.
---
dlls/winemac.drv/display.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c
index ed27390ac30..fe9e6dcb5bd 100644
--- a/dlls/winemac.drv/display.c
+++ b/dlls/winemac.drv/display.c
@@ -420,8 +420,7 @@ static CFDictionaryRef create_mode_dict(CGDisplayModeRef display_mode, BOOL is_o
height *= 2;
}
- io_flags &= kDisplayModeValidFlag | kDisplayModeSafeFlag | kDisplayModeInterlacedFlag |
- kDisplayModeStretchedFlag | kDisplayModeTelevisionFlag;
+ io_flags &= kDisplayModeInterlacedFlag | kDisplayModeStretchedFlag | kDisplayModeTelevisionFlag;
cf_io_flags = CFNumberCreate(NULL, kCFNumberSInt32Type, &io_flags);
cf_width = CFNumberCreate(NULL, kCFNumberSInt64Type, &width);
cf_height = CFNumberCreate(NULL, kCFNumberSInt64Type, &height);
Module: wine
Branch: master
Commit: 28dfeefccafda17ade9776722367f816fd3539a1
URL: https://gitlab.winehq.org/wine/wine/-/commit/28dfeefccafda17ade9776722367f8…
Author: Tim Clem <tclem(a)codeweavers.com>
Date: Tue May 7 14:33:17 2024 -0700
winemac.drv: Prefer display modes that are marked as usable for desktop.
Some devices, like the Apple Studio Display, have modes that differ
only in this flag, and switching to the ones that are not usable for
desktop results in an error.
---
dlls/winemac.drv/display.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c
index b1a5a4500d2..ed27390ac30 100644
--- a/dlls/winemac.drv/display.c
+++ b/dlls/winemac.drv/display.c
@@ -475,6 +475,7 @@ static BOOL mode_is_preferred(CGDisplayModeRef new_mode, CGDisplayModeRef old_mo
BOOL new_is_supported;
CFStringRef pixel_encoding;
size_t width_points, height_points;
+ BOOL new_usable_for_desktop, old_usable_for_desktop;
size_t old_width_pixels, old_height_pixels, new_width_pixels, new_height_pixels;
BOOL old_size_same, new_size_same;
@@ -516,6 +517,12 @@ static BOOL mode_is_preferred(CGDisplayModeRef new_mode, CGDisplayModeRef old_mo
if (!new_is_supported && display_mode_is_supported(old_mode))
return FALSE;
+ /* Prefer modes that are usable for desktop over ones that aren't. */
+ new_usable_for_desktop = CGDisplayModeIsUsableForDesktopGUI(new_mode);
+ old_usable_for_desktop = CGDisplayModeIsUsableForDesktopGUI(old_mode);
+ if (new_usable_for_desktop && !old_usable_for_desktop)
+ return TRUE;
+
/* Otherwise, prefer a mode whose pixel size equals its point size over one which
is scaled. */
width_points = CGDisplayModeGetWidth(new_mode);
Module: wine
Branch: master
Commit: 64f67f412d807337a85cef63c10648c0ccfad600
URL: https://gitlab.winehq.org/wine/wine/-/commit/64f67f412d807337a85cef63c10648…
Author: Tim Clem <tclem(a)codeweavers.com>
Date: Tue May 7 14:31:25 2024 -0700
winemac.drv: Document mode_is_preferred.
---
dlls/winemac.drv/display.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c
index edf740b260e..b1a5a4500d2 100644
--- a/dlls/winemac.drv/display.c
+++ b/dlls/winemac.drv/display.c
@@ -457,6 +457,17 @@ static CFDictionaryRef create_mode_dict(CGDisplayModeRef display_mode, BOOL is_o
}
+/***********************************************************************
+ * mode_is_preferred
+ *
+ * Returns whether new_mode ought to be preferred over old_mode - that is,
+ * whether new_mode is a better option to expose as a valid mode to switch to.
+ * old_mode may be NULL, in which case the function returns true if the mode
+ * should be considered at all.
+ * old_mode and new_mode are guaranteed to have identical return values from
+ * create_mode_dict. So, they will have the same point dimension and relevant
+ * IO flags, among other properties.
+ */
static BOOL mode_is_preferred(CGDisplayModeRef new_mode, CGDisplayModeRef old_mode,
struct display_mode_descriptor *original_mode_desc,
BOOL include_unsupported)