Permalink
Browse files

Merge pull request #20 from gonzojive/master

Hide the normal cursor when the app launches.
  • Loading branch information...
2 parents efb6ce2 + 9fdba6d commit 4611ad71d593b201a505464121f590f5b0da2254 @atebits committed Sep 5, 2011
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 0CAB1BBF140A77F600567611 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CAB1BBE140A77F600567611 /* ApplicationServices.framework */; };
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
2B4EC09B10301F3800042E09 /* FadeFrameLandscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 2B4EC09A10301F3800042E09 /* FadeFrameLandscape.png */; };
5E4D86630F45EC4700E02F03 /* FakeAppStore in Resources */ = {isa = PBXBuildFile; fileRef = 5E4D86270F45EC4700E02F03 /* FakeAppStore */; };
@@ -62,6 +63,7 @@
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 0CAB1BBE140A77F600567611 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
@@ -126,6 +128,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 0CAB1BBF140A77F600567611 /* ApplicationServices.framework in Frameworks */,
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
5EA7CEF80F43F1E700DE24FB /* Carbon.framework in Frameworks */,
);
@@ -173,6 +176,7 @@
29B97314FDCFA39411CA2CEA /* FakeFinger */ = {
isa = PBXGroup;
children = (
+ 0CAB1BBE140A77F600567611 /* ApplicationServices.framework */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
@@ -7,6 +7,7 @@
//
#import <Cocoa/Cocoa.h>
+#include <ApplicationServices/ApplicationServices.h>
@interface FakeFingerAppDelegate : NSObject
{
@@ -42,4 +43,6 @@
- (IBAction)installFakeApps:(id)sender;
+-(void) hideTheCursor;
+
@end
@@ -452,7 +452,29 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification
[self registerForSimulatorWindowResizedNotification];
[self positionSimulatorWindow:nil];
+ [self hideTheCursor];
+
NSLog(@"Repositioned simulator window.");
}
+-(void) hideTheCursor
+{
+ // The not so hacky way:
+// CGDirectDisplayID myId = CGMainDisplayID();
+// CGDisplayHideCursor(kCGDirectMainDisplay);
+// BOOL isCursorVisible = CGCursorIsVisible();
+
+ // The hacky way:
+ void CGSSetConnectionProperty(int, int, CFStringRef, CFBooleanRef);
+ int _CGSDefaultConnection();
+ CFStringRef propertyString;
+
+ // Hack to make background cursor setting work
+ propertyString = CFStringCreateWithCString(NULL, "SetsCursorInBackground", kCFStringEncodingUTF8);
+ CGSSetConnectionProperty(_CGSDefaultConnection(), _CGSDefaultConnection(), propertyString, kCFBooleanTrue);
+ CFRelease(propertyString);
+ // Hide the cursor and wait
+ CGDisplayHideCursor(kCGDirectMainDisplay);
+}
+
@end

0 comments on commit 4611ad7

Please sign in to comment.