Commit c69f1955 authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

winemac: Remove pre-Mac OS X 10.8 workarounds.

parent 398cb959
......@@ -760,13 +760,8 @@ static NSString* WineLocalizedString(unsigned int stringID)
if (CGDisplayModeGetWidth(mode1) != CGDisplayModeGetWidth(mode2)) return FALSE;
if (CGDisplayModeGetHeight(mode1) != CGDisplayModeGetHeight(mode2)) return FALSE;
#if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
if (&CGDisplayModeGetPixelWidth != NULL &&
CGDisplayModeGetPixelWidth(mode1) != CGDisplayModeGetPixelWidth(mode2)) return FALSE;
if (&CGDisplayModeGetPixelHeight != NULL &&
CGDisplayModeGetPixelHeight(mode1) != CGDisplayModeGetPixelHeight(mode2)) return FALSE;
#endif
if (CGDisplayModeGetPixelWidth(mode1) != CGDisplayModeGetPixelWidth(mode2)) return FALSE;
if (CGDisplayModeGetPixelHeight(mode1) != CGDisplayModeGetPixelHeight(mode2)) return FALSE;
encoding1 = [(NSString*)CGDisplayModeCopyPixelEncoding(mode1) autorelease];
encoding2 = [(NSString*)CGDisplayModeCopyPixelEncoding(mode2) autorelease];
......@@ -791,12 +786,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
- (NSArray*)modesMatchingMode:(CGDisplayModeRef)mode forDisplay:(CGDirectDisplayID)displayID
{
NSMutableArray* ret = [NSMutableArray array];
NSDictionary* options = nil;
#if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:TRUE]
forKey:(NSString*)kCGDisplayShowDuplicateLowResolutionModes];
#endif
NSDictionary* options = @{ (NSString*)kCGDisplayShowDuplicateLowResolutionModes: @YES };
NSArray *modes = [(NSArray*)CGDisplayCopyAllDisplayModes(displayID, (CFDictionaryRef)options) autorelease];
for (id candidateModeObject in modes)
......
......@@ -176,18 +176,12 @@ static BOOL write_display_settings(HKEY parent_hkey, CGDirectDisplayID displayID
val = CGDisplayModeGetIOFlags(display_mode);
if (!set_setting_value(display_hkey, "IOFlags", val))
goto fail;
#if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
if (&CGDisplayModeGetPixelWidth != NULL && &CGDisplayModeGetPixelHeight != NULL)
{
val = CGDisplayModeGetPixelWidth(display_mode);
if (!set_setting_value(display_hkey, "PixelWidth", val))
goto fail;
val = CGDisplayModeGetPixelHeight(display_mode);
if (!set_setting_value(display_hkey, "PixelHeight", val))
goto fail;
}
#endif
val = CGDisplayModeGetPixelWidth(display_mode);
if (!set_setting_value(display_hkey, "PixelWidth", val))
goto fail;
val = CGDisplayModeGetPixelHeight(display_mode);
if (!set_setting_value(display_hkey, "PixelHeight", val))
goto fail;
pixel_encoding = CGDisplayModeCopyPixelEncoding(display_mode);
len = CFStringGetLength(pixel_encoding);
......@@ -370,17 +364,8 @@ static BOOL display_mode_matches_descriptor(CGDisplayModeRef mode, const struct
if (fabs(desc->refresh - mode_refresh) > 0.1)
return FALSE;
#if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
if (&CGDisplayModeGetPixelWidth != NULL && &CGDisplayModeGetPixelHeight != NULL)
{
if (CGDisplayModeGetPixelWidth(mode) != desc->pixel_width ||
CGDisplayModeGetPixelHeight(mode) != desc->pixel_height)
return FALSE;
}
else
#endif
if (CGDisplayModeGetWidth(mode) != desc->pixel_width ||
CGDisplayModeGetHeight(mode) != desc->pixel_height)
if (CGDisplayModeGetPixelWidth(mode) != desc->pixel_width ||
CGDisplayModeGetPixelHeight(mode) != desc->pixel_height)
return FALSE;
mode_pixel_encoding = CGDisplayModeCopyPixelEncoding(mode);
......@@ -420,7 +405,6 @@ static int get_default_bpp(void)
}
#if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
static CFDictionaryRef create_mode_dict(CGDisplayModeRef display_mode, BOOL is_original)
{
CFDictionaryRef ret;
......@@ -542,7 +526,6 @@ static BOOL mode_is_preferred(CGDisplayModeRef new_mode, CGDisplayModeRef old_mo
/* Otherwise, prefer the mode with the smaller pixel size. */
return new_width_pixels < old_width_pixels && new_height_pixels < old_height_pixels;
}
#endif
static CFComparisonResult mode_compare(const void *p1, const void *p2, void *context)
......@@ -605,56 +588,48 @@ static CFComparisonResult mode_compare(const void *p1, const void *p2, void *con
static CFArrayRef copy_display_modes(CGDirectDisplayID display, BOOL include_unsupported)
{
CFArrayRef modes = NULL;
CFDictionaryRef options;
struct display_mode_descriptor* desc;
CFMutableDictionaryRef modes_by_size;
CFIndex i, count;
CGDisplayModeRef* mode_array;
#if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
if (&CGDisplayModeGetPixelWidth != NULL && &CGDisplayModeGetPixelHeight != NULL)
{
CFDictionaryRef options;
struct display_mode_descriptor* desc;
CFMutableDictionaryRef modes_by_size;
CFIndex i, count;
CGDisplayModeRef* mode_array;
options = CFDictionaryCreate(NULL, (const void**)&kCGDisplayShowDuplicateLowResolutionModes,
(const void**)&kCFBooleanTrue, 1, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
modes = CGDisplayCopyAllDisplayModes(display, options);
if (options)
CFRelease(options);
if (!modes)
return NULL;
desc = create_original_display_mode_descriptor(display);
modes_by_size = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
count = CFArrayGetCount(modes);
for (i = 0; i < count; i++)
{
CGDisplayModeRef new_mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i);
BOOL new_is_original = display_mode_matches_descriptor(new_mode, desc);
CFDictionaryRef key = create_mode_dict(new_mode, new_is_original);
CGDisplayModeRef old_mode = (CGDisplayModeRef)CFDictionaryGetValue(modes_by_size, key);
options = CFDictionaryCreate(NULL, (const void**)&kCGDisplayShowDuplicateLowResolutionModes,
(const void**)&kCFBooleanTrue, 1, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
if (mode_is_preferred(new_mode, old_mode, desc, include_unsupported))
CFDictionarySetValue(modes_by_size, key, new_mode);
modes = CGDisplayCopyAllDisplayModes(display, options);
if (options)
CFRelease(options);
if (!modes)
return NULL;
CFRelease(key);
}
desc = create_original_display_mode_descriptor(display);
free_display_mode_descriptor(desc);
CFRelease(modes);
modes_by_size = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
count = CFArrayGetCount(modes);
for (i = 0; i < count; i++)
{
CGDisplayModeRef new_mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i);
BOOL new_is_original = display_mode_matches_descriptor(new_mode, desc);
CFDictionaryRef key = create_mode_dict(new_mode, new_is_original);
CGDisplayModeRef old_mode = (CGDisplayModeRef)CFDictionaryGetValue(modes_by_size, key);
if (mode_is_preferred(new_mode, old_mode, desc, include_unsupported))
CFDictionarySetValue(modes_by_size, key, new_mode);
count = CFDictionaryGetCount(modes_by_size);
mode_array = malloc(count * sizeof(mode_array[0]));
CFDictionaryGetKeysAndValues(modes_by_size, NULL, (const void **)mode_array);
modes = CFArrayCreate(NULL, (const void **)mode_array, count, &kCFTypeArrayCallBacks);
free(mode_array);
CFRelease(modes_by_size);
CFRelease(key);
}
else
#endif
modes = CGDisplayCopyAllDisplayModes(display, NULL);
free_display_mode_descriptor(desc);
CFRelease(modes);
count = CFDictionaryGetCount(modes_by_size);
mode_array = malloc(count * sizeof(mode_array[0]));
CFDictionaryGetKeysAndValues(modes_by_size, NULL, (const void **)mode_array);
modes = CFArrayCreate(NULL, (const void **)mode_array, count, &kCFTypeArrayCallBacks);
free(mode_array);
CFRelease(modes_by_size);
if (modes)
{
......
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