Commit c2936f70 authored by Tim Clem's avatar Tim Clem Committed by Alexandre Julliard

winemac.drv: Move synthetic display modes after the real ones.

Also return higher synthesized bitdepths first. Signed-off-by: 's avatarTim Clem <tclem@codeweavers.com> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8a8808e9
...@@ -1049,7 +1049,7 @@ BOOL CDECL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, ...@@ -1049,7 +1049,7 @@ BOOL CDECL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode,
display_mode = NULL; display_mode = NULL;
if (modes) if (modes)
{ {
int default_bpp = get_default_bpp(); int default_bpp;
DWORD seen_modes = 0; DWORD seen_modes = 0;
count = CFArrayGetCount(modes); count = CFArrayGetCount(modes);
...@@ -1064,33 +1064,41 @@ BOOL CDECL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, ...@@ -1064,33 +1064,41 @@ BOOL CDECL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode,
display_mode_bpp = display_mode_bits_per_pixel(display_mode); display_mode_bpp = display_mode_bits_per_pixel(display_mode);
break; break;
} }
}
/* We only synthesize modes from those having the default bpp. */ default_bpp = get_default_bpp();
if (display_mode_bits_per_pixel(candidate) != default_bpp)
continue;
if (!modes_has_8bpp) /* If all the real modes are exhausted, synthesize lower bpp modes. */
if (!display_mode && (!modes_has_16bpp || !modes_has_8bpp))
{
/* We want to synthesize higher depths first. */
int synth_bpps[] = { modes_has_16bpp ? 0 : 16, modes_has_8bpp ? 0 : 8 };
size_t synth_bpp_idx;
for (synth_bpp_idx = 0; synth_bpp_idx < 2; synth_bpp_idx++)
{ {
seen_modes++; int synth_bpp = synth_bpps[synth_bpp_idx];
if (seen_modes > mode) if (synth_bpp == 0)
continue;
for (i = 0; i < count; i++)
{ {
display_mode = (CGDisplayModeRef)CFRetain(candidate); CGDisplayModeRef candidate = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i);
display_mode_bpp = 8; /* We only synthesize modes from those having the default bpp. */
synthesized = TRUE; if (display_mode_bits_per_pixel(candidate) != default_bpp)
break; continue;
seen_modes++;
if (seen_modes > mode)
{
display_mode = (CGDisplayModeRef)CFRetain(candidate);
display_mode_bpp = synth_bpp;
synthesized = TRUE;
break;
}
} }
}
if (!modes_has_16bpp) if (display_mode)
{
seen_modes++;
if (seen_modes > mode)
{
display_mode = (CGDisplayModeRef)CFRetain(candidate);
display_mode_bpp = 16;
synthesized = TRUE;
break; break;
}
} }
} }
} }
......
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