ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.68k stars 623 forks source link

[CS 1.6 - Request] Disable CTRL + <number> shortcut (switches workspace) on OS X #478

Open konschta opened 11 years ago

konschta commented 11 years ago

Really annoying is the fact that on OS X CTRL + <Number> switches your workspace and minimises the game, which I guess happens a lot, e.g. during weapon switching while crouching. So it is perhaps a good solution to prevent CTRL + form working while ingame, if that is possible.

I already mentioned this in issue #229, where I also commented on some CMD + <key> shortcuts.

Hardware: MBP 13" mid 2010, OS X 10.8.2

alfred-valve commented 11 years ago

We have tried to do this on other products but we haven't found an Apple API to allow this. If you know how to programmatically cause this please chime in.

konschta commented 11 years ago

@alfred-valve Not really, I found some workarounds, but I'm not sure if this is helpful.

#import <Carbon/Carbon.h>
    void *oldHotKeyMode = PushSymbolicHotKeyMode(kHIHotKeyModeAllDisabled);
Make sure that you re-enable them with:
    PopSymbolicHotKeyMode(oldHotKeyMode);
#import <Carbon/Carbon.h>
void *oldHotKeyMode;
- (void)windowDidBecomeKey:(NSNotification *)notification{
    oldHotKeyMode = PushSymbolicHotKeyMode(kHIHotKeyModeAllDisabled);
}
- (void)windowDidResignKey:(NSNotification *)notification{
    PopSymbolicHotKeyMode(oldHotKeyMode);
}

and Event Taps: http://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html