From ab1242f368c1da053edacb68beaeb1c34dbc8136 Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Thu, 18 Oct 2018 19:03:10 -0700 Subject: [PATCH] fix(cocoa): Move sendEvent implementation to RAWindow Introduced independent Info_Metal.plist and MainMenu_Metal.xib files, to avoid breaking earlier builds. --- pkg/apple/BaseConfig.xcconfig | 1 + pkg/apple/OSX/Info_Metal.plist | 49 +++ pkg/apple/OSX/en.lproj/MainMenu_Metal.xib | 342 ++++++++++++++++++ .../RetroArch_Metal.xcodeproj/project.pbxproj | 26 +- ui/drivers/ui_cocoa.m | 15 +- 5 files changed, 406 insertions(+), 27 deletions(-) create mode 100644 pkg/apple/OSX/Info_Metal.plist create mode 100644 pkg/apple/OSX/en.lproj/MainMenu_Metal.xib diff --git a/pkg/apple/BaseConfig.xcconfig b/pkg/apple/BaseConfig.xcconfig index d1386170a1..0ff10b6737 100644 --- a/pkg/apple/BaseConfig.xcconfig +++ b/pkg/apple/BaseConfig.xcconfig @@ -12,3 +12,4 @@ DEPS_DIR = $(SRCBASE)/deps HEADER_SEARCH_PATHS = $(inherited) $(SRCBASE) $(SRCBASE)/gfx/include $(SRCBASE)/libretro-common/include $(DEPS_DIR)/libFLAC/include $(DEPS_DIR)/7zip $(DEPS_DIR)/stb $(DEPS_DIR) $(DEPS_DIR)/SPIRV-Cross $(DEPS_DIR)/glslang $(DEPS_DIR)/glslang/glslang/glslang/Public $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent $(DEPS_DIR)/glslang/glslang/SPIRV $(DEPS_DIR)/glslang/glslang/glslang/OSDependent/Unix CLANG_CXX_LANGUAGE_STANDARD=c++11 CLANG_ENABLE_OBJC_ARC=YES +INFOPLIST_FILE = $(SRCROOT)/OSX/Info_Metal.plist diff --git a/pkg/apple/OSX/Info_Metal.plist b/pkg/apple/OSX/Info_Metal.plist new file mode 100644 index 0000000000..72c6354868 --- /dev/null +++ b/pkg/apple/OSX/Info_Metal.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + * + + CFBundleTypeName + All Files + CFBundleTypeRole + Viewer + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + retroarch + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.7.5 + CFBundleSignature + ???? + CFBundleVersion + 1.7.5 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSHighResolutionCapable + + NSHumanReadableCopyright + Copyright © 2018 RetroArch. All rights reserved. + NSMainNibFile + MainMenu_Metal + NSPrincipalClass + NSApplication + + diff --git a/pkg/apple/OSX/en.lproj/MainMenu_Metal.xib b/pkg/apple/OSX/en.lproj/MainMenu_Metal.xib new file mode 100644 index 0000000000..934ee76845 --- /dev/null +++ b/pkg/apple/OSX/en.lproj/MainMenu_Metal.xib @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj index e4dcacd08a..471b781c50 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0502387C2179713000789627 /* MainMenu_Metal.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9020F323D5F3C8E120D04AC /* MainMenu_Metal.xib */; }; 05269A6220ABF20500C29F1E /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05269A6120ABF20500C29F1E /* MetalKit.framework */; }; 053FC26521433F2200D98D46 /* QtWidgets.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25721433F1800D98D46 /* QtWidgets.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 053FC270214340F500D98D46 /* QtGui.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25321433F1700D98D46 /* QtGui.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; @@ -14,7 +15,6 @@ 053FC272214341E000D98D46 /* QtConcurrent.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25521433F1700D98D46 /* QtConcurrent.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 053FC275214341F000D98D46 /* QtCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25421433F1700D98D46 /* QtCore.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 05422E3E2140C8DB00F09961 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; - 05422E3F2140C8DB00F09961 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 05422E402140C8DB00F09961 /* retroarch.icns in Resources */ = {isa = PBXBuildFile; fileRef = 84DD5EB71A89F1C7007336C1 /* retroarch.icns */; }; 05422E432140C8DB00F09961 /* griffin_glslang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753420A5678400646447 /* griffin_glslang.cpp */; }; 05422E442140C8DB00F09961 /* menu_pipeline.metal in Sources */ = {isa = PBXBuildFile; fileRef = 05770B9820E805160013DABC /* menu_pipeline.metal */; }; @@ -40,7 +40,6 @@ 05A8E23C20A63CF50084ABDA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05A8E23B20A63CF50084ABDA /* QuartzCore.framework */; }; 05D7753520A567A400646447 /* griffin_cpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753320A5678300646447 /* griffin_cpp.cpp */; }; 05D7753720A567A700646447 /* griffin_glslang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753420A5678400646447 /* griffin_glslang.cpp */; }; - 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 5061C8A41AE47E510080AE14 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5061C8A31AE47E510080AE14 /* libz.dylib */; }; 509F0C9D1AA23AFC00619ECC /* griffin_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 509F0C9C1AA23AFC00619ECC /* griffin_objc.m */; }; 840222FC1A889EE2009AB261 /* griffin.c in Sources */ = {isa = PBXBuildFile; fileRef = 840222FB1A889EE2009AB261 /* griffin.c */; }; @@ -52,6 +51,7 @@ 84DD5EB51A89E737007336C1 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84DD5EB41A89E737007336C1 /* IOKit.framework */; }; 84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */ = {isa = PBXBuildFile; fileRef = 84DD5EB71A89F1C7007336C1 /* retroarch.icns */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + A90209ED44A1161587F10CA4 /* MainMenu_Metal.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9020F323D5F3C8E120D04AC /* MainMenu_Metal.xib */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -534,7 +534,6 @@ 05F2874020F2BEEA00632D47 /* task_http.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_http.c; sourceTree = ""; }; 05F2874120F2BEEA00632D47 /* task_patch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_patch.c; sourceTree = ""; }; 089C165DFE840E0CC02AAC07 /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = OSX/en.lproj/InfoPlist.strings; sourceTree = ""; }; - 1DDD58150DA1D0A300B32029 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = OSX/en.lproj/MainMenu.xib; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 5061C8A31AE47E510080AE14 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 509F0C9C1AA23AFC00619ECC /* griffin_objc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = griffin_objc.m; path = ../../griffin/griffin_objc.m; sourceTree = ""; }; @@ -547,9 +546,10 @@ 84DD5EB21A89E6C0007336C1 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = ""; }; 84DD5EB41A89E737007336C1 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = ../../../../../../System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; 84DD5EB71A89F1C7007336C1 /* retroarch.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = retroarch.icns; path = ../../media/retroarch.icns; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = OSX/Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* RetroArch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RetroArch.app; sourceTree = BUILT_PRODUCTS_DIR; }; A902040DE66D42F9EE47BFE3 /* MenuDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuDisplay.h; sourceTree = ""; }; + A90205FD4D5979BD8B7E4DD6 /* Info_Metal.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.info; name = Info_Metal.plist; path = OSX/Info_Metal.plist; sourceTree = ""; }; + A902065A41AEBECE594908C7 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = OSX/en.lproj/MainMenu_Metal.xib; sourceTree = ""; }; A902070F2C43F222FD56A95A /* MenuDisplay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuDisplay.m; sourceTree = ""; }; A90207489289602F593626D5 /* QTConfig.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = QTConfig.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1445,9 +1445,9 @@ isa = PBXGroup; children = ( 84DD5EB71A89F1C7007336C1 /* retroarch.icns */, - 8D1107310486CEB800E47090 /* Info.plist */, + A90205FD4D5979BD8B7E4DD6 /* Info_Metal.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, - 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + A9020F323D5F3C8E120D04AC /* MainMenu_Metal.xib */, ); name = Resources; sourceTree = ""; @@ -1564,8 +1564,8 @@ buildActionMask = 2147483647; files = ( 05422E3E2140C8DB00F09961 /* InfoPlist.strings in Resources */, - 05422E3F2140C8DB00F09961 /* MainMenu.xib in Resources */, 05422E402140C8DB00F09961 /* retroarch.icns in Resources */, + 0502387C2179713000789627 /* MainMenu_Metal.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1574,8 +1574,8 @@ buildActionMask = 2147483647; files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, - 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, 84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */, + A90209ED44A1161587F10CA4 /* MainMenu_Metal.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1649,12 +1649,12 @@ name = InfoPlist.strings; sourceTree = ""; }; - 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { + A9020F323D5F3C8E120D04AC /* MainMenu_Metal.xib */ = { isa = PBXVariantGroup; children = ( - 1DDD58150DA1D0A300B32029 /* MainMenu.xib */, + A902065A41AEBECE594908C7 /* en */, ); - name = MainMenu.xib; + name = MainMenu_Metal.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ @@ -1671,7 +1671,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "@rpath"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1693,7 +1692,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; - INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "@rpath"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1716,7 +1714,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; @@ -1734,7 +1731,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; - INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_BUNDLE_IDENTIFIER = "libretro.${PRODUCT_NAME:rfc1034identifier}"; diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index b248d5ae9e..2f52f5d06c 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -89,10 +89,10 @@ static void app_terminate(void) [[NSApplication sharedApplication] terminate:nil]; } -@interface RApplication : NSApplication +@interface RAWindow : NSWindow @end -@implementation RApplication +@implementation RAWindow #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 #define NSEventTypeKeyDown NSKeyDown @@ -119,18 +119,9 @@ static void app_terminate(void) #define NSEventModifierFlagNumericPad NSNumericPadKeyMask #endif -- (void)sendEvent:(NSEvent *)event -{ +- (void)sendEvent:(NSEvent *)event { [super sendEvent:event]; - RetroArch_OSX *delegate = (RetroArch_OSX *)self.delegate; - if (event.window != delegate.window) { - // TODO(sgc): this is just a hack for the 1.7.5 release to - // ignore RA processing events that are not for the RA window. - // Ideally, we'de delegate `sendEvent` to the window listener - return; - } - cocoa_input_data_t *apple = NULL; NSEventType event_type = event.type;