├── .gitignore
├── LICENSE
├── README.md
├── build
└── MoveToRiftPlugin.bundle
│ └── Contents
│ ├── Info.plist
│ └── MacOS
│ └── MoveToRiftPlugin
└── src
├── English.lproj
└── InfoPlist.strings
├── MoveToRiftPlugin-Info.plist
├── MoveToRiftPlugin.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── MoveToRiftPlugin.xccheckout
│ └── xcuserdata
│ │ └── gfodor.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
└── xcuserdata
│ └── gfodor.xcuserdatad
│ └── xcschemes
│ ├── MoveToRiftPlugin-Release.xcscheme
│ └── xcschememanagement.plist
├── Plugin.h
└── Plugin.m
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 AltspaceVR, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MacMoveToRift
2 |
3 | This is a Unity plugin which will let you move your game onto an OS X user's Oculus Rift DK2, if one is attached to their Mac, without any intervention on their part. To install, put the `MoveRiftToMac.bundle` plugin in your Unity `Assets/Plugins` folder. (You can also build it via the XCode project in `src`.)
4 |
5 | To use the plugin, declare a DllImport for it in one of your MonoBehaviors:
6 |
7 | ```
8 | #if UNITY_STANDALONE_OSX
9 | [DllImport ("MoveToRiftPlugin")]
10 | private static extern bool MoveWindowToRift();
11 | #endif
12 | ```
13 |
14 | And then to actually move the app onto the Rift, you'll need to switch the app out of screen mode, call the plugin to move it, and switch it back into full screen mode. This example shows how you'd do it from inside of a coroutine:
15 |
16 | ```
17 | #if UNITY_STANDALONE_OSX
18 | if (Application.platform == RuntimePlatform.OSXPlayer)
19 | {
20 | // Take it out of full screen if it is in full screen on mac so we can move it to the rift.
21 | var wasFullScreen = Screen.fullScreen;
22 |
23 | if (wasFullScreen)
24 | {
25 | // Wait for the OS X full screen animation to complete.
26 | yield return new WaitForSeconds(2.0f);
27 | }
28 |
29 | // Take the app out of full screen.
30 | Screen.fullScreen = false;
31 | Screen.SetResolution (1920, 1080, false);
32 |
33 | if (wasFullScreen)
34 | {
35 | // Wait for the OS X full screen animation to complete.
36 | yield return new WaitForSeconds(2.0f);
37 | }
38 |
39 | // Move it onto the Rift via the plugin.
40 | MoveWindowToRift();
41 |
42 | // Set the app to full screen on the Rift.
43 | Screen.SetResolution (1920, 1080, true);
44 | }
45 | #endif
46 | ```
47 |
--------------------------------------------------------------------------------
/build/MoveToRiftPlugin.bundle/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 13F34
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | MoveToRiftPlugin
11 | CFBundleIdentifier
12 | com.altvr.MoveToRiftPlugin
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1.0
21 | CSResourcesFileMapped
22 | yes
23 | DTCompiler
24 | com.apple.compilers.llvm.clang.1_0
25 | DTPlatformBuild
26 | 6A2008a
27 | DTPlatformVersion
28 | GM
29 | DTSDKBuild
30 | 14A382
31 | DTSDKName
32 | macosx10.10
33 | DTXcode
34 | 0611
35 | DTXcodeBuild
36 | 6A2008a
37 |
38 |
39 |
--------------------------------------------------------------------------------
/build/MoveToRiftPlugin.bundle/Contents/MacOS/MoveToRiftPlugin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AltspaceVR/MacMoveToRift/e909b3ab78fe63fe6b84ef2d8c004f213fb0eaf9/build/MoveToRiftPlugin.bundle/Contents/MacOS/MoveToRiftPlugin
--------------------------------------------------------------------------------
/src/English.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AltspaceVR/MacMoveToRift/e909b3ab78fe63fe6b84ef2d8c004f213fb0eaf9/src/English.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/src/MoveToRiftPlugin-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.altvr.${PRODUCT_NAME:identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleSignature
16 | ????
17 | CFBundleVersion
18 | 1.0
19 | CSResourcesFileMapped
20 | yes
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/MoveToRiftPlugin.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | DD8EF5781A68B26A007CA7AB /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD8EF5771A68B26A007CA7AB /* IOKit.framework */; };
11 | DDFF2A9D1A65ECC100BEF346 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDFF2A9C1A65ECC100BEF346 /* Cocoa.framework */; };
12 | DDFF2A9E1A65ED3100BEF346 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDFF2A9A1A65ECB700BEF346 /* AppKit.framework */; };
13 | DDFF2AA01A65EDCD00BEF346 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDFF2A9F1A65EDCD00BEF346 /* Foundation.framework */; };
14 | DDFF2AB51A65EF7900BEF346 /* Plugin.m in Sources */ = {isa = PBXBuildFile; fileRef = DDFF2AB41A65EF7900BEF346 /* Plugin.m */; };
15 | /* End PBXBuildFile section */
16 |
17 | /* Begin PBXFileReference section */
18 | 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; };
19 | 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; };
20 | 6A3F7F7E10AC146D00948A73 /* MoveToRiftPlugin.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MoveToRiftPlugin.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
21 | 6A3F7F7F10AC146D00948A73 /* MoveToRiftPlugin-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MoveToRiftPlugin-Info.plist"; sourceTree = ""; };
22 | DD8EF5771A68B26A007CA7AB /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOKit.framework; sourceTree = DEVELOPER_DIR; };
23 | DDF0AC2C1A66088E00F35442 /* ASimplePlugin copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "ASimplePlugin copy-Info.plist"; path = "/Users/gfodor/Downloads/SimplestPluginExample/XCodePlugin/ASimplePlugin copy-Info.plist"; sourceTree = ""; };
24 | DDFF2A9A1A65ECB700BEF346 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = DEVELOPER_DIR; };
25 | DDFF2A9C1A65ECC100BEF346 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; };
26 | DDFF2A9F1A65EDCD00BEF346 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
27 | DDFF2AB31A65EF7900BEF346 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = ""; };
28 | DDFF2AB41A65EF7900BEF346 /* Plugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Plugin.m; sourceTree = ""; };
29 | /* End PBXFileReference section */
30 |
31 | /* Begin PBXFrameworksBuildPhase section */
32 | 6A3F7F7C10AC146D00948A73 /* Frameworks */ = {
33 | isa = PBXFrameworksBuildPhase;
34 | buildActionMask = 2147483647;
35 | files = (
36 | DD8EF5781A68B26A007CA7AB /* IOKit.framework in Frameworks */,
37 | DDFF2AA01A65EDCD00BEF346 /* Foundation.framework in Frameworks */,
38 | DDFF2A9E1A65ED3100BEF346 /* AppKit.framework in Frameworks */,
39 | DDFF2A9D1A65ECC100BEF346 /* Cocoa.framework in Frameworks */,
40 | );
41 | runOnlyForDeploymentPostprocessing = 0;
42 | };
43 | /* End PBXFrameworksBuildPhase section */
44 |
45 | /* Begin PBXGroup section */
46 | 089C166AFE841209C02AAC07 /* XCodePlugin */ = {
47 | isa = PBXGroup;
48 | children = (
49 | DD8EF5771A68B26A007CA7AB /* IOKit.framework */,
50 | DDFF2A9F1A65EDCD00BEF346 /* Foundation.framework */,
51 | DDFF2A9C1A65ECC100BEF346 /* Cocoa.framework */,
52 | DDFF2A9A1A65ECB700BEF346 /* AppKit.framework */,
53 | 08FB77ADFE841716C02AAC07 /* Source */,
54 | 089C167CFE841241C02AAC07 /* Resources */,
55 | 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
56 | 19C28FB4FE9D528D11CA2CBB /* Products */,
57 | 6A3F7F7F10AC146D00948A73 /* MoveToRiftPlugin-Info.plist */,
58 | DDF0AC2C1A66088E00F35442 /* ASimplePlugin copy-Info.plist */,
59 | );
60 | name = XCodePlugin;
61 | sourceTree = "";
62 | };
63 | 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
64 | isa = PBXGroup;
65 | children = (
66 | 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */,
67 | );
68 | name = "External Frameworks and Libraries";
69 | sourceTree = "";
70 | };
71 | 089C167CFE841241C02AAC07 /* Resources */ = {
72 | isa = PBXGroup;
73 | children = (
74 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */,
75 | );
76 | name = Resources;
77 | sourceTree = "";
78 | };
79 | 08FB77ADFE841716C02AAC07 /* Source */ = {
80 | isa = PBXGroup;
81 | children = (
82 | DDFF2AB31A65EF7900BEF346 /* Plugin.h */,
83 | DDFF2AB41A65EF7900BEF346 /* Plugin.m */,
84 | );
85 | name = Source;
86 | sourceTree = "";
87 | };
88 | 19C28FB4FE9D528D11CA2CBB /* Products */ = {
89 | isa = PBXGroup;
90 | children = (
91 | 6A3F7F7E10AC146D00948A73 /* MoveToRiftPlugin.bundle */,
92 | );
93 | name = Products;
94 | sourceTree = "";
95 | };
96 | /* End PBXGroup section */
97 |
98 | /* Begin PBXNativeTarget section */
99 | 6A3F7F7D10AC146D00948A73 /* MoveToRiftPlugin */ = {
100 | isa = PBXNativeTarget;
101 | buildConfigurationList = 6A3F7F8210AC146D00948A73 /* Build configuration list for PBXNativeTarget "MoveToRiftPlugin" */;
102 | buildPhases = (
103 | 6A3F7F7A10AC146D00948A73 /* Resources */,
104 | 6A3F7F7B10AC146D00948A73 /* Sources */,
105 | 6A3F7F7C10AC146D00948A73 /* Frameworks */,
106 | );
107 | buildRules = (
108 | );
109 | dependencies = (
110 | );
111 | name = MoveToRiftPlugin;
112 | productName = ASimplePlugin;
113 | productReference = 6A3F7F7E10AC146D00948A73 /* MoveToRiftPlugin.bundle */;
114 | productType = "com.apple.product-type.bundle";
115 | };
116 | /* End PBXNativeTarget section */
117 |
118 | /* Begin PBXProject section */
119 | 089C1669FE841209C02AAC07 /* Project object */ = {
120 | isa = PBXProject;
121 | attributes = {
122 | LastUpgradeCheck = 0610;
123 | };
124 | buildConfigurationList = 4FADC23708B4156C00ABE55E /* Build configuration list for PBXProject "MoveToRiftPlugin" */;
125 | compatibilityVersion = "Xcode 3.2";
126 | developmentRegion = English;
127 | hasScannedForEncodings = 1;
128 | knownRegions = (
129 | en,
130 | English,
131 | );
132 | mainGroup = 089C166AFE841209C02AAC07 /* XCodePlugin */;
133 | projectDirPath = "";
134 | projectRoot = "";
135 | targets = (
136 | 6A3F7F7D10AC146D00948A73 /* MoveToRiftPlugin */,
137 | );
138 | };
139 | /* End PBXProject section */
140 |
141 | /* Begin PBXResourcesBuildPhase section */
142 | 6A3F7F7A10AC146D00948A73 /* Resources */ = {
143 | isa = PBXResourcesBuildPhase;
144 | buildActionMask = 2147483647;
145 | files = (
146 | );
147 | runOnlyForDeploymentPostprocessing = 0;
148 | };
149 | /* End PBXResourcesBuildPhase section */
150 |
151 | /* Begin PBXSourcesBuildPhase section */
152 | 6A3F7F7B10AC146D00948A73 /* Sources */ = {
153 | isa = PBXSourcesBuildPhase;
154 | buildActionMask = 2147483647;
155 | files = (
156 | DDFF2AB51A65EF7900BEF346 /* Plugin.m in Sources */,
157 | );
158 | runOnlyForDeploymentPostprocessing = 0;
159 | };
160 | /* End PBXSourcesBuildPhase section */
161 |
162 | /* Begin PBXVariantGroup section */
163 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
164 | isa = PBXVariantGroup;
165 | children = (
166 | 089C167EFE841241C02AAC07 /* English */,
167 | );
168 | name = InfoPlist.strings;
169 | sourceTree = "";
170 | };
171 | /* End PBXVariantGroup section */
172 |
173 | /* Begin XCBuildConfiguration section */
174 | 4FADC23808B4156C00ABE55E /* Debug */ = {
175 | isa = XCBuildConfiguration;
176 | buildSettings = {
177 | GCC_C_LANGUAGE_STANDARD = c99;
178 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
179 | GCC_WARN_UNUSED_VARIABLE = YES;
180 | ONLY_ACTIVE_ARCH = YES;
181 | PREBINDING = NO;
182 | SDKROOT = macosx;
183 | };
184 | name = Debug;
185 | };
186 | 4FADC23908B4156C00ABE55E /* Release */ = {
187 | isa = XCBuildConfiguration;
188 | buildSettings = {
189 | GCC_C_LANGUAGE_STANDARD = c99;
190 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
191 | GCC_WARN_UNUSED_VARIABLE = YES;
192 | PREBINDING = NO;
193 | SDKROOT = macosx;
194 | };
195 | name = Release;
196 | };
197 | 6A3F7F8010AC146D00948A73 /* Debug */ = {
198 | isa = XCBuildConfiguration;
199 | buildSettings = {
200 | ALWAYS_SEARCH_USER_PATHS = NO;
201 | COMBINE_HIDPI_IMAGES = YES;
202 | COPY_PHASE_STRIP = NO;
203 | GCC_DYNAMIC_NO_PIC = NO;
204 | GCC_ENABLE_FIX_AND_CONTINUE = YES;
205 | GCC_MODEL_TUNING = G5;
206 | GCC_OPTIMIZATION_LEVEL = 0;
207 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
208 | GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
209 | INFOPLIST_FILE = "MoveToRiftPlugin-Info.plist";
210 | INSTALL_PATH = "$(HOME)/Library/Bundles";
211 | OTHER_LDFLAGS = (
212 | "-framework",
213 | Carbon,
214 | );
215 | PREBINDING = NO;
216 | PRODUCT_NAME = MoveToRiftPlugin;
217 | SDKROOT = macosx;
218 | WRAPPER_EXTENSION = bundle;
219 | };
220 | name = Debug;
221 | };
222 | 6A3F7F8110AC146D00948A73 /* Release */ = {
223 | isa = XCBuildConfiguration;
224 | buildSettings = {
225 | ALWAYS_SEARCH_USER_PATHS = NO;
226 | COMBINE_HIDPI_IMAGES = YES;
227 | COPY_PHASE_STRIP = YES;
228 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
229 | GCC_ENABLE_FIX_AND_CONTINUE = NO;
230 | GCC_MODEL_TUNING = G5;
231 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
232 | GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
233 | INFOPLIST_FILE = "MoveToRiftPlugin-Info.plist";
234 | INSTALL_PATH = "$(HOME)/Library/Bundles";
235 | OTHER_LDFLAGS = (
236 | "-framework",
237 | Carbon,
238 | );
239 | PREBINDING = NO;
240 | PRODUCT_NAME = MoveToRiftPlugin;
241 | SDKROOT = macosx;
242 | WRAPPER_EXTENSION = bundle;
243 | ZERO_LINK = NO;
244 | };
245 | name = Release;
246 | };
247 | /* End XCBuildConfiguration section */
248 |
249 | /* Begin XCConfigurationList section */
250 | 4FADC23708B4156C00ABE55E /* Build configuration list for PBXProject "MoveToRiftPlugin" */ = {
251 | isa = XCConfigurationList;
252 | buildConfigurations = (
253 | 4FADC23808B4156C00ABE55E /* Debug */,
254 | 4FADC23908B4156C00ABE55E /* Release */,
255 | );
256 | defaultConfigurationIsVisible = 0;
257 | defaultConfigurationName = Release;
258 | };
259 | 6A3F7F8210AC146D00948A73 /* Build configuration list for PBXNativeTarget "MoveToRiftPlugin" */ = {
260 | isa = XCConfigurationList;
261 | buildConfigurations = (
262 | 6A3F7F8010AC146D00948A73 /* Debug */,
263 | 6A3F7F8110AC146D00948A73 /* Release */,
264 | );
265 | defaultConfigurationIsVisible = 0;
266 | defaultConfigurationName = Release;
267 | };
268 | /* End XCConfigurationList section */
269 | };
270 | rootObject = 089C1669FE841209C02AAC07 /* Project object */;
271 | }
272 |
--------------------------------------------------------------------------------
/src/MoveToRiftPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/MoveToRiftPlugin.xcodeproj/project.xcworkspace/xcshareddata/MoveToRiftPlugin.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | D39BABA2-DA2B-4055-80CC-045A44A1C478
9 | IDESourceControlProjectName
10 | MoveToRiftPlugin
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | F94C4FEDAF63AE6C7030D11E63656456818B3839
14 | github.com:AltspaceVR/MacMoveToRift.git
15 |
16 | IDESourceControlProjectPath
17 | src/MoveToRiftPlugin.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | F94C4FEDAF63AE6C7030D11E63656456818B3839
21 | ../../..
22 |
23 | IDESourceControlProjectURL
24 | github.com:AltspaceVR/MacMoveToRift.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | F94C4FEDAF63AE6C7030D11E63656456818B3839
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | F94C4FEDAF63AE6C7030D11E63656456818B3839
36 | IDESourceControlWCCName
37 | MacMoveToRift
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/MoveToRiftPlugin.xcodeproj/project.xcworkspace/xcuserdata/gfodor.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AltspaceVR/MacMoveToRift/e909b3ab78fe63fe6b84ef2d8c004f213fb0eaf9/src/MoveToRiftPlugin.xcodeproj/project.xcworkspace/xcuserdata/gfodor.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/src/MoveToRiftPlugin.xcodeproj/project.xcworkspace/xcuserdata/gfodor.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/MoveToRiftPlugin.xcodeproj/xcuserdata/gfodor.xcuserdatad/xcschemes/MoveToRiftPlugin-Release.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
60 |
61 |
63 |
64 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/MoveToRiftPlugin.xcodeproj/xcuserdata/gfodor.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | MoveToRiftPlugin-Release.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 6A3F7F7D10AC146D00948A73
16 |
17 | primary
18 |
19 |
20 | DDF0AC201A66088E00F35442
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/Plugin.h:
--------------------------------------------------------------------------------
1 | //
2 | // Plugin.h
3 | // XCodePlugin
4 | //
5 | // Created by Greg Fodor on 1/13/15.
6 | //
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface Plugin : NSObject
13 |
14 | - (BOOL)moveWindowToRift;
15 |
16 | @end
17 |
18 |
19 | BOOL MoveWindowToRift() {
20 | return [[[Plugin alloc] init] moveWindowToRift];
21 | }
--------------------------------------------------------------------------------
/src/Plugin.m:
--------------------------------------------------------------------------------
1 | #import "Plugin.h"
2 | #import
3 |
4 | static void KeyArrayCallback(const void* key, const void* value, void* context) { CFArrayAppendValue(context, key); }
5 |
6 | @implementation Plugin
7 |
8 | - (BOOL)moveWindowToRift {
9 | __block bool sentToRift = NO;
10 |
11 | if ([NSScreen screens].count > 0) {
12 | [[NSScreen screens] enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id screen, NSUInteger idx, BOOL *stop) {
13 | NSRect riftFrame = ((NSScreen *)screen).visibleFrame;
14 |
15 | // Find the rift by looking up the local name of the devices.
16 | NSDictionary* screenDictionary = [screen deviceDescription];
17 | NSNumber* screenID = [screenDictionary objectForKey:@"NSScreenNumber"];
18 | CGDirectDisplayID aID = [screenID unsignedIntValue];
19 | CFStringRef localName = NULL;
20 | io_connect_t displayPort = CGDisplayIOServicePort(aID);
21 | CFDictionaryRef dict = (CFDictionaryRef)IODisplayCreateInfoDictionary(displayPort, 0);
22 | CFDictionaryRef names = CFDictionaryGetValue(dict, CFSTR(kDisplayProductName));
23 | if(names)
24 | {
25 | CFArrayRef langKeys = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks );
26 | CFDictionaryApplyFunction(names, KeyArrayCallback, (void*)langKeys);
27 | CFArrayRef orderLangKeys = CFBundleCopyPreferredLocalizationsFromArray(langKeys);
28 | CFRelease(langKeys);
29 | if(orderLangKeys && CFArrayGetCount(orderLangKeys))
30 | {
31 | CFStringRef langKey = CFArrayGetValueAtIndex(orderLangKeys, 0);
32 | localName = CFDictionaryGetValue(names, langKey);
33 | CFRetain(localName);
34 | }
35 | CFRelease(orderLangKeys);
36 | }
37 | CFRelease(dict);
38 | NSString *localNameString = (__bridge NSString *)localName;
39 |
40 | if ([localNameString isEqualToString:@"Rift DK2"]) {
41 | NSWindow *window = [[NSApplication sharedApplication] mainWindow];
42 |
43 | // Determine if there is a OS X menu bar on the rift. (This is dependent upon user settings.)
44 | BOOL riftHasMenuBar = riftFrame.size.height == 1080.0 ? NO : YES;
45 | CGFloat menuBarHeight = [[NSApplication sharedApplication] mainMenu].menuBarHeight;
46 |
47 | // Target frame is screen nudged upwards if there is a menu bar.
48 | // The height is scaled up slightly larger than necessary, and going full screen corrects the issue.
49 | NSRect targetFrame = NSMakeRect(riftFrame.origin.x,
50 | riftFrame.origin.y + (riftHasMenuBar ? menuBarHeight : 0.0),
51 | 1920.0, 1080.0 + 22.0);
52 |
53 | // The following operations needs to happen in this exact order, otherwise you may get
54 | // a clipped/offset viewport on the rift, or framebuffer flickering/corruption.
55 |
56 | // Hide menubars, etc. and move window.
57 | [NSMenu setMenuBarVisible:NO];
58 | [window setFrame:targetFrame display: YES];
59 | [NSMenu setMenuBarVisible:NO];
60 |
61 | // Focus window and move cursor to center of rift screen so clicks don't end up de-focusing.
62 | [window makeKeyWindow];
63 | [[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
64 | CGWarpMouseCursorPosition(CGPointMake(targetFrame.origin.x + targetFrame.size.width / 2.0f,
65 | targetFrame.origin.y + targetFrame.size.height / 2.0f));
66 | sentToRift = YES;
67 | }
68 | }];
69 | }
70 |
71 | return sentToRift;
72 | }
73 |
74 | @end
75 |
--------------------------------------------------------------------------------