Re: Toddler-proofing an app (disabling spotlight keyboard shortcut)?
Re: Toddler-proofing an app (disabling spotlight keyboard shortcut)?
- Subject: Re: Toddler-proofing an app (disabling spotlight keyboard shortcut)?
- From: Clay Heaton <email@hidden>
- Date: Sun, 23 Sep 2012 20:56:09 -0400
Thank you, Ken. Your tips pointed me in an acceptable direction. I poked around in the cocos2d internals and discovered that your second option worked best. The Kiosk Mode Technical Note was helpful:
<http://developer.apple.com/library/mac/#technotes/KioskMode/Introduction/Introduction.html>
This is the code that did it for me:
NSApplicationPresentationOptions options = NSApplicationPresentationHideDock + NSApplicationPresentationDisableProcessSwitching;
NSNumber *presentationOptions = [NSNumber numberWithUnsignedLong:options];
NSArray *keys = [NSArray arrayWithObjects:@"NSFullScreenModeAllScreens", @"NSFullScreenModeApplicationPresentationOptions", nil];
NSArray *values = [NSArray arrayWithObjects:[NSNumber numberWithBool:YES], presentationOptions, nil];
NSDictionary *fullScreenOptions = [[NSDictionary alloc] initWithObjects:values forKeys:keys];
[glView_ enterFullScreenMode:[NSScreen mainScreen] withOptions:fullScreenOptions];
I'll let my daughter bang on it tomorrow and we'll see what other sorts of secret key commands she discovers!
Cheers,
Clay
On Sep 22, 2012, at 2:59 AM, Ken Thomases <email@hidden> wrote:
>
> If your app is full-screen, you might capture the display. See the Quartz Display Services <https://developer.apple.com/library/mac/#documentation/graphicsimaging/Conceptual/QuartzDisplayServicesConceptual/Articles/DisplayCapture.html>. Capturing the display prevents Command-Tab app switching, Exposé/Mission Control, Spotlight, etc. I believe it will also prevent system keyboard shortcuts (e.g. hiding the Dock with Command-Option-D) from reaching the wider system.
>
> It might also work to set the application presentation options. -[NSApplication setPresentationOptions:] with options including NSApplicationPresentationDisableAppleMenu and NSApplicationPresentationDisableProcessSwitching. Or those options can be included with the options passed to -[NSView enterFullScreenMode:withOptions:] under the NSFullScreenModeApplicationPresentationOptions key.
>
> Finally, you can use a custom subclass of NSApplication, override -sendEvent:, detect events which correspond to hot keys, and don't pass them through to super. Detecting hot keys is kind of hard. There's CopySymbolicHotKeys(), but it can be hard to interpret the output data and it's probably also not available in 64-bit. For a private-use-only app, you can get away with hard-coding keys that actually cause you trouble.
>
> Cheers,
> Ken
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden