From ea4906a20e79524d42960c7637d32358ce7dc765 Mon Sep 17 00:00:00 2001 From: osy <50960678+osy@users.noreply.github.com> Date: Tue, 26 Sep 2023 01:47:32 -0700 Subject: [PATCH] project: patch settings bundle for visionOS --- Platform/Shared/VMConfigInputView.swift | 2 +- Platform/iOS/Settings.bundle/Root.plist | 38 ++++++++++++++++++++ UTM.xcodeproj/project.pbxproj | 47 +++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) diff --git a/Platform/Shared/VMConfigInputView.swift b/Platform/Shared/VMConfigInputView.swift index ddb00c8f3..f244be0f2 100644 --- a/Platform/Shared/VMConfigInputView.swift +++ b/Platform/Shared/VMConfigInputView.swift @@ -74,7 +74,7 @@ fileprivate enum UsbSupport: Int, Identifiable { } } -#if os(macOS) +#if os(macOS) || os(visionOS) @available(macOS 11, *) struct GestureSettingsSection: View { var body: some View { diff --git a/Platform/iOS/Settings.bundle/Root.plist b/Platform/iOS/Settings.bundle/Root.plist index 39b3f5999..d282f587e 100644 --- a/Platform/iOS/Settings.bundle/Root.plist +++ b/Platform/iOS/Settings.bundle/Root.plist @@ -161,6 +161,8 @@ PSGroupSpecifier Title Gestures + Platform + iOS Type @@ -169,6 +171,8 @@ Long Press Key GestureLongPress + Platform + iOS DefaultValue 1 Titles @@ -191,6 +195,8 @@ Two Finger Tap Key GestureTwoTap + Platform + iOS DefaultValue 2 Titles @@ -211,6 +217,8 @@ Two Finger Pan Key GestureTwoPan + Platform + iOS DefaultValue 3 Titles @@ -235,6 +243,8 @@ Two Finger Swipe Key GestureTwoScroll + Platform + iOS DefaultValue 0 Titles @@ -255,6 +265,8 @@ Three Finger Pan Key GestureThreePan + Platform + iOS DefaultValue 0 Titles @@ -285,6 +297,8 @@ Touch Input Key MouseTouchType + Platform + iOS DefaultValue 0 Titles @@ -300,6 +314,28 @@ 2 + + Type + PSMultiValueSpecifier + Title + Visibility + Key + MouseTouchType + Platform + xrOS + DefaultValue + 2 + Titles + + Always show cursor + Try hiding cursor + + Values + + 1 + 2 + + Type PSMultiValueSpecifier @@ -307,6 +343,8 @@ Apple Pencil Input Key MousePencilType + Platform + iOS DefaultValue 2 Titles diff --git a/UTM.xcodeproj/project.pbxproj b/UTM.xcodeproj/project.pbxproj index 290efa09e..8cff7afc3 100644 --- a/UTM.xcodeproj/project.pbxproj +++ b/UTM.xcodeproj/project.pbxproj @@ -2553,6 +2553,7 @@ CE2D926924AD46670059923A /* Sources */, CE2D932B24AD46670059923A /* Frameworks */, CE2D936924AD46670059923A /* Resources */, + CE59A7B12ABCC75F00E5FFBD /* Patch Settings bundle */, CE2D937524AD46670059923A /* Embed Libraries */, ); buildRules = ( @@ -2632,6 +2633,7 @@ CEA45E24263519B5002FA97D /* Sources */, CEA45F23263519B5002FA97D /* Frameworks */, CEA45F63263519B5002FA97D /* Resources */, + CE59A7B22ABCCB7C00E5FFBD /* Patch Settings bundle */, CEA45F71263519B5002FA97D /* Embed Libraries */, ); buildRules = ( @@ -2823,6 +2825,51 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + CE59A7B12ABCC75F00E5FFBD /* Patch Settings bundle */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/Platform/iOS/Settings.bundle", + ); + name = "Patch Settings bundle"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(TARGET_BUILD_DIR)/$(CONTENTS_FOLDER_PATH)/Settings.bundle/Root.plist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#!/bin/sh\n\nPLISTBUDDY=/usr/libexec/PlistBuddy\nROOT_PLIST=\"$SCRIPT_OUTPUT_FILE_0\"\n\nCOUNT=$($PLISTBUDDY -c \"Print :PreferenceSpecifiers\" \"$ROOT_PLIST\" | grep -c '^ }$')\n\nfor ((i = 0; i < COUNT; i++)); do\n platform=$($PLISTBUDDY -c \"Print :PreferenceSpecifiers:$i:Platform\" \"$ROOT_PLIST\" 2> /dev/null)\n if [ ! -z \"$platform\" ]; then\n if [ \"$platform\" == \"$PLATFORM_FAMILY_NAME\" ]; then\n echo \"Found entry $i for $platform\"\n $PLISTBUDDY -c \"Delete :PreferenceSpecifiers:$i:Platform\" \"$ROOT_PLIST\"\n else\n echo \"Found entry $i for $platform, removing entry\"\n $PLISTBUDDY -c \"Delete :PreferenceSpecifiers:$i\" \"$ROOT_PLIST\"\n ((COUNT--))\n ((i--))\n fi\n fi\ndone\n"; + showEnvVarsInLog = 0; + }; + CE59A7B22ABCCB7C00E5FFBD /* Patch Settings bundle */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/Platform/iOS/Settings.bundle", + ); + name = "Patch Settings bundle"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(TARGET_BUILD_DIR)/$(CONTENTS_FOLDER_PATH)/Settings.bundle/Root.plist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#!/bin/sh\n\nPLISTBUDDY=/usr/libexec/PlistBuddy\nROOT_PLIST=\"$SCRIPT_OUTPUT_FILE_0\"\n\nCOUNT=$($PLISTBUDDY -c \"Print :PreferenceSpecifiers\" \"$ROOT_PLIST\" | grep -c '^ }$')\n\nfor ((i = 0; i < COUNT; i++)); do\n platform=$($PLISTBUDDY -c \"Print :PreferenceSpecifiers:$i:Platform\" \"$ROOT_PLIST\" 2> /dev/null)\n if [ ! -z \"$platform\" ]; then\n if [ \"$platform\" == \"$PLATFORM_FAMILY_NAME\" ]; then\n echo \"Found entry $i for $platform\"\n $PLISTBUDDY -c \"Delete :PreferenceSpecifiers:$i:Platform\" \"$ROOT_PLIST\"\n else\n echo \"Found entry $i for $platform, removing entry\"\n $PLISTBUDDY -c \"Delete :PreferenceSpecifiers:$i\" \"$ROOT_PLIST\"\n ((COUNT--))\n ((i--))\n fi\n fi\ndone\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 8401FD5E269BE9C500265F0D /* Sources */ = { isa = PBXSourcesBuildPhase;