Commit 02c66768 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Reorganize copy_display_modes() to clarify that the user's default mode…

winemac: Reorganize copy_display_modes() to clarify that the user's default mode is always included. Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f9860002
......@@ -312,13 +312,18 @@ static CFArrayRef copy_display_modes(CGDirectDisplayID display)
BOOL better = TRUE;
CGDisplayModeRef new_mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i);
uint32_t new_flags = CGDisplayModeGetIOFlags(new_mode);
CFStringRef pixel_encoding;
size_t width_points;
size_t height_points;
CFDictionaryRef key;
CFDictionaryRef key = create_mode_dict(new_mode);
/* If a given mode is the user's default, then always list it in preference to any similar
modes that may exist. */
if (new_flags & kDisplayModeDefaultFlag)
better = TRUE;
else
{
CFStringRef pixel_encoding = CGDisplayModeCopyPixelEncoding(new_mode);
CGDisplayModeRef old_mode;
if (!(new_flags & kDisplayModeDefaultFlag) && (pixel_encoding = CGDisplayModeCopyPixelEncoding(new_mode)))
if (pixel_encoding)
{
BOOL bpp30 = CFEqual(pixel_encoding, CFSTR(kIO30BitDirectPixels));
CFRelease(pixel_encoding);
......@@ -330,29 +335,24 @@ static CFArrayRef copy_display_modes(CGDirectDisplayID display)
bits per component. I think that no Windows program is
likely to need it and they will probably be confused by it.
Skip it. */
CFRelease(key);
continue;
}
}
width_points = CGDisplayModeGetWidth(new_mode);
height_points = CGDisplayModeGetHeight(new_mode);
key = create_mode_dict(new_mode);
old_mode = (CGDisplayModeRef)CFDictionaryGetValue(modes_by_size, key);
if (old_mode)
{
uint32_t old_flags = CGDisplayModeGetIOFlags(old_mode);
/* If a given mode is the user's default, then always list it in preference to any similar
modes that may exist. */
if ((new_flags & kDisplayModeDefaultFlag) && !(old_flags & kDisplayModeDefaultFlag))
better = TRUE;
else if (!(new_flags & kDisplayModeDefaultFlag) && (old_flags & kDisplayModeDefaultFlag))
if (old_flags & kDisplayModeDefaultFlag)
better = FALSE;
else
{
/* Otherwise, prefer a mode whose pixel size equals its point size over one which
is scaled. */
size_t width_points = CGDisplayModeGetWidth(new_mode);
size_t height_points = CGDisplayModeGetHeight(new_mode);
size_t new_width_pixels = CGDisplayModeGetPixelWidth(new_mode);
size_t new_height_pixels = CGDisplayModeGetPixelHeight(new_mode);
size_t old_width_pixels = CGDisplayModeGetPixelWidth(old_mode);
......@@ -372,6 +372,7 @@ static CFArrayRef copy_display_modes(CGDirectDisplayID display)
}
}
}
}
if (better)
CFDictionarySetValue(modes_by_size, key, new_mode);
......
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