FROM : Fabian
DATE : Sun Aug 13 17:11:57 2006
Hello!
my app is launched with a global hotkey, using a snippet of code that
I found on the web (can't remember who to credit, sorry). It works
great on PPC but apparently not on Intel Macs. Can someone help me
spot the problem? I don't know too much about cocoa (the actual app
is built in ASS).Thank you very much in advance.
Regards,
Fabian
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import <Foundation/Foundation.h>
#import "Hotkey.h"
const UInt32 kLockUIElementHotKeyIdentifier = 'lUIk';
const UInt32 kLockUIElementHotKey = 36;
EventHotKeyRef gMyHotKeyRef;
EventHotKeyID gMyHotKeyID;
EventHandlerUPP gAppHotKeyFunction;
pascal OSStatus LockUIElementHotKeyHandler(EventHandlerCallRef
nextHandler,EventRef theEvent, void *userData);
@implementation Hotkey
- (void)awakeFromNib
{
EventTypeSpec eventType;
gAppHotKeyFunction = NewEventHandlerUPP(LockUIElementHotKeyHandler);
eventType.eventClass = kEventClassKeyboard;
eventType.eventKind = kEventHotKeyPressed;
InstallApplicationEventHandler(gAppHotKeyFunction,
1,&eventType,NULL,NULL);
gMyHotKeyID.signature = kLockUIElementHotKeyIdentifier;
gMyHotKeyID.id = 1;
UInt32 modifiers;
modifiers = cmdKey;
modifiers |= optionKey;
RegisterEventHotKey(kLockUIElementHotKey, modifiers, gMyHotKeyID,
GetApplicationEventTarget(), 0, &gMyHotKeyRef);
}
@end
pascal OSStatus LockUIElementHotKeyHandler(EventHandlerCallRef
nextHandler,EventRef theEvent, void *userData)
{
NSLog(@"Hotkey pressed"); // We don't get this far...
return noErr;
}
DATE : Sun Aug 13 17:11:57 2006
Hello!
my app is launched with a global hotkey, using a snippet of code that
I found on the web (can't remember who to credit, sorry). It works
great on PPC but apparently not on Intel Macs. Can someone help me
spot the problem? I don't know too much about cocoa (the actual app
is built in ASS).Thank you very much in advance.
Regards,
Fabian
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import <Foundation/Foundation.h>
#import "Hotkey.h"
const UInt32 kLockUIElementHotKeyIdentifier = 'lUIk';
const UInt32 kLockUIElementHotKey = 36;
EventHotKeyRef gMyHotKeyRef;
EventHotKeyID gMyHotKeyID;
EventHandlerUPP gAppHotKeyFunction;
pascal OSStatus LockUIElementHotKeyHandler(EventHandlerCallRef
nextHandler,EventRef theEvent, void *userData);
@implementation Hotkey
- (void)awakeFromNib
{
EventTypeSpec eventType;
gAppHotKeyFunction = NewEventHandlerUPP(LockUIElementHotKeyHandler);
eventType.eventClass = kEventClassKeyboard;
eventType.eventKind = kEventHotKeyPressed;
InstallApplicationEventHandler(gAppHotKeyFunction,
1,&eventType,NULL,NULL);
gMyHotKeyID.signature = kLockUIElementHotKeyIdentifier;
gMyHotKeyID.id = 1;
UInt32 modifiers;
modifiers = cmdKey;
modifiers |= optionKey;
RegisterEventHotKey(kLockUIElementHotKey, modifiers, gMyHotKeyID,
GetApplicationEventTarget(), 0, &gMyHotKeyRef);
}
@end
pascal OSStatus LockUIElementHotKeyHandler(EventHandlerCallRef
nextHandler,EventRef theEvent, void *userData)
{
NSLog(@"Hotkey pressed"); // We don't get this far...
return noErr;
}
| Related mails | Author | Date |
|---|---|---|
| Fabian | Aug 13, 17:11 | |
| Andrew Farmer | Aug 20, 02:30 |






Cocoa mail archive

