Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Hide the cursor.
  • Loading branch information
gonzojive committed Aug 28, 2011
1 parent efb6ce2 commit 9fdba6d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Fake/SimFinger/FakeFinger.xcodeproj/project.pbxproj
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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>"; };
Expand Down Expand Up @@ -126,6 +128,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0CAB1BBF140A77F600567611 /* ApplicationServices.framework in Frameworks */,
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
5EA7CEF80F43F1E700DE24FB /* Carbon.framework in Frameworks */,
);
Expand Down Expand Up @@ -173,6 +176,7 @@
29B97314FDCFA39411CA2CEA /* FakeFinger */ = {
isa = PBXGroup;
children = (
0CAB1BBE140A77F600567611 /* ApplicationServices.framework */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
Expand Down
3 changes: 3 additions & 0 deletions Fake/SimFinger/FakeFingerAppDelegate.h
Expand Up @@ -7,6 +7,7 @@
//

#import <Cocoa/Cocoa.h>
#include <ApplicationServices/ApplicationServices.h>

@interface FakeFingerAppDelegate : NSObject
{
Expand Down Expand Up @@ -42,4 +43,6 @@

- (IBAction)installFakeApps:(id)sender;

-(void) hideTheCursor;

@end
22 changes: 22 additions & 0 deletions Fake/SimFinger/FakeFingerAppDelegate.m
Expand Up @@ -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 9fdba6d

Please sign in to comment.