Brendan Shanks : winemac.drv: Remove workarounds for Mac OS X 10.6 and earlier.

Alexandre Julliard julliard at winehq.org
Thu Nov 18 16:19:38 CST 2021


Module: wine
Branch: master
Commit: 32fb017d4a22be38ca271bf387e466e958601355
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=32fb017d4a22be38ca271bf387e466e958601355

Author: Brendan Shanks <bshanks at codeweavers.com>
Date:   Thu Nov 18 13:05:04 2021 -0800

winemac.drv: Remove workarounds for Mac OS X 10.6 and earlier.

Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/cocoa_app.m    | 15 +++++------
 dlls/winemac.drv/cocoa_window.m | 59 ++++++++++++-----------------------------
 dlls/winemac.drv/opengl.c       | 20 --------------
 3 files changed, 23 insertions(+), 71 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index c4c745ff732..1bb752d20b7 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -299,15 +299,12 @@ static NSString* WineLocalizedString(unsigned int stringID)
             [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_ZOOM)
                                action:@selector(performZoom:)
                         keyEquivalent:@""];
-            if ([NSWindow instancesRespondToSelector:@selector(toggleFullScreen:)])
-            {
-                item = [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_ENTER_FULL_SCREEN)
-                                          action:@selector(toggleFullScreen:)
-                                   keyEquivalent:@"f"];
-                [item setKeyEquivalentModifierMask:NSEventModifierFlagCommand |
-                                                   NSEventModifierFlagOption |
-                                                   NSEventModifierFlagControl];
-            }
+            item = [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_ENTER_FULL_SCREEN)
+                                      action:@selector(toggleFullScreen:)
+                               keyEquivalent:@"f"];
+            [item setKeyEquivalentModifierMask:NSEventModifierFlagCommand |
+                                               NSEventModifierFlagOption |
+                                               NSEventModifierFlagControl];
             [submenu addItem:[NSMenuItem separatorItem]];
             [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_BRING_ALL_TO_FRONT)
                                action:@selector(arrangeInFront:)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 812b46bee2c..d0672b7fb06 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -36,20 +36,6 @@
 #import "cocoa_opengl.h"
 
 
-#if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
-enum {
-    NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
-    NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
-    NSWindowFullScreenButton = 7,
-    NSWindowStyleMaskFullScreen = 1 << 14,
-};
-
- at interface NSWindow (WineFullScreenExtensions)
-    - (void) toggleFullScreen:(id)sender;
- at end
-#endif
-
-
 #if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
 /* Additional Mac virtual keycode, to complement those in Carbon's <HIToolbox/Events.h>. */
 enum {
@@ -1091,11 +1077,8 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
             [[self standardWindowButton:NSWindowMiniaturizeButton] setEnabled:!self.disabled];
         if (style & NSWindowStyleMaskResizable)
             [[self standardWindowButton:NSWindowZoomButton] setEnabled:!self.disabled];
-        if ([self respondsToSelector:@selector(toggleFullScreen:)])
-        {
-            if ([self collectionBehavior] & NSWindowCollectionBehaviorFullScreenPrimary)
-                [[self standardWindowButton:NSWindowFullScreenButton] setEnabled:!self.disabled];
-        }
+        if ([self collectionBehavior] & NSWindowCollectionBehaviorFullScreenPrimary)
+            [[self standardWindowButton:NSWindowFullScreenButton] setEnabled:!self.disabled];
 
         if ([self preventResizing])
         {
@@ -1115,24 +1098,21 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
 
     - (void) adjustFullScreenBehavior:(NSWindowCollectionBehavior)behavior
     {
-        if ([self respondsToSelector:@selector(toggleFullScreen:)])
-        {
-            NSUInteger style = [self styleMask];
+        NSUInteger style = [self styleMask];
 
-            if (behavior & NSWindowCollectionBehaviorParticipatesInCycle &&
-                style & NSWindowStyleMaskResizable && !(style & NSWindowStyleMaskUtilityWindow) && !maximized &&
-                !(self.parentWindow || self.latentParentWindow))
-            {
-                behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
-                behavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
-            }
-            else
-            {
-                behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
-                behavior |= NSWindowCollectionBehaviorFullScreenAuxiliary;
-                if (style & NSWindowStyleMaskFullScreen)
-                    [super toggleFullScreen:nil];
-            }
+        if (behavior & NSWindowCollectionBehaviorParticipatesInCycle &&
+            style & NSWindowStyleMaskResizable && !(style & NSWindowStyleMaskUtilityWindow) && !maximized &&
+            !(self.parentWindow || self.latentParentWindow))
+        {
+            behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
+            behavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
+        }
+        else
+        {
+            behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
+            behavior |= NSWindowCollectionBehaviorFullScreenAuxiliary;
+            if (style & NSWindowStyleMaskFullScreen)
+                [super toggleFullScreen:nil];
         }
 
         if (behavior != [self collectionBehavior])
@@ -2480,12 +2460,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
 
                     for (i = 0; i < sizeof(buttons) / sizeof(buttons[0]); i++)
                     {
-                        NSButton* button;
-
-                        if (buttons[i] == NSWindowFullScreenButton && ![self respondsToSelector:@selector(toggleFullScreen:)])
-                            continue;
-
-                        button = [self standardWindowButton:buttons[i]];
+                        NSButton* button = [self standardWindowButton:buttons[i]];
                         if ([button hitTest:[button.superview convertPoint:event.locationInWindow fromView:nil]])
                         {
                             hitButton = YES;
diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index 9f02e93d376..33132de7415 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -1248,7 +1248,6 @@ static BOOL init_gl_info(void)
         kCGLPFADisplayMask, displayMask,
         0
     };
-#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
     CGLPixelFormatAttribute core_attribs[] =
     {
         kCGLPFADisplayMask, displayMask,
@@ -1256,7 +1255,6 @@ static BOOL init_gl_info(void)
         kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute)kCGLOGLPVersion_3_2_Core,
         0
     };
-#endif
     CGLPixelFormatObj pix;
     GLint virtualScreens;
     CGLError err;
@@ -1308,7 +1306,6 @@ static BOOL init_gl_info(void)
     CGLSetCurrentContext(old_context);
     CGLReleaseContext(context);
 
-#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
     err = CGLChoosePixelFormat(core_attribs, &pix, &virtualScreens);
     if (err != kCGLNoError || !pix)
     {
@@ -1340,7 +1337,6 @@ static BOOL init_gl_info(void)
     sscanf(str, "%u.%u", &gl_info.max_major, &gl_info.max_minor);
     CGLSetCurrentContext(old_context);
     CGLReleaseContext(context);
-#endif
 
     return TRUE;
 }
@@ -1397,14 +1393,6 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns
     CGLError err;
     BOOL core = major >= 3;
 
-#if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
-    if (core)
-    {
-        WARN("OS X version >= 10.7 is required to be able to create core contexts\n");
-        return FALSE;
-    }
-#endif
-
     pf = get_pixel_format(context->format, TRUE /* non-displayable */);
     if (!pf)
     {
@@ -1480,7 +1468,6 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns
     if (pf->backing_store)
         attribs[n++] = kCGLPFABackingStore;
 
-#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
     if (core)
     {
         attribs[n++] = kCGLPFAOpenGLProfile;
@@ -1493,7 +1480,6 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns
         attribs[n++] = (int)kCGLOGLPVersion_3_2_Core;
 #endif
     }
-#endif
 
     attribs[n] = 0;
 
@@ -1856,12 +1842,8 @@ static CGLPixelFormatObj create_pixel_format_for_renderer(CGLRendererInfoObj ren
 
     if (core)
     {
-#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
         attrs[3] = kCGLPFAOpenGLProfile;
         attrs[4] = (CGLPixelFormatAttribute)kCGLOGLPVersion_3_2_Core;
-#else
-        return NULL;
-#endif
     }
 
     if (!get_renderer_property(renderer_info, renderer, kCGLRPRendererID, &renderer_id))
@@ -2157,12 +2139,10 @@ static BOOL query_renderer_integer(CGLRendererInfoObj renderer_info, GLint rende
         }
 
         case WGL_RENDERER_VIDEO_MEMORY_WINE:
-#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
             err = CGLDescribeRenderer(renderer_info, renderer, kCGLRPVideoMemoryMegabytes, (GLint*)value);
             if (err != kCGLNoError && err != kCGLBadProperty)
                 WARN("CGLDescribeRenderer(kCGLRPVideoMemoryMegabytes) failed: %d %s\n", err, CGLErrorString(err));
             if (err != kCGLNoError)
-#endif
             {
                 if (get_renderer_property(renderer_info, renderer, kCGLRPVideoMemory, (GLint*)value))
                     *value /= 1024 * 1024;




More information about the wine-cvs mailing list