2020-01-01 13:27:21 +01:00
|
|
|
module uiold
|
2019-08-18 15:58:58 +02:00
|
|
|
|
|
|
|
#flag -framework Carbon
|
|
|
|
#flag -framework Cocoa
|
|
|
|
|
|
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
|
2020-04-21 10:48:52 +02:00
|
|
|
__global default_font &C.NSFont
|
2019-10-30 13:04:25 +01:00
|
|
|
|
2019-08-18 15:58:58 +02:00
|
|
|
|
|
|
|
fn focus_app(next, event, data voidptr) {
|
|
|
|
#NSLog(@"2The hot key was pressed.");
|
|
|
|
#NSApplication *myApp = [NSApplication sharedApplication];
|
|
|
|
#[myApp activateIgnoringOtherApps:YES];
|
|
|
|
//return noErr;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn reg_key_vid() {
|
|
|
|
println('REGISTERING VID KEY')
|
|
|
|
#EventHotKeyRef gMyHotKeyRef;
|
|
|
|
|
|
|
|
#EventHotKeyID gMyHotKeyID;
|
|
|
|
#EventTypeSpec eventType;
|
|
|
|
#eventType.eventClass = kEventClassKeyboard;
|
|
|
|
#eventType.eventKind = kEventHotKeyPressed;
|
2020-01-01 13:27:21 +01:00
|
|
|
#InstallApplicationEventHandler(&uiold__focus_app, 1, &eventType, NULL, NULL);
|
2019-08-18 15:58:58 +02:00
|
|
|
#gMyHotKeyID.signature = 'rml1';
|
|
|
|
#gMyHotKeyID.id = 1;
|
|
|
|
#RegisterEventHotKey(kVK_ANSI_1, cmdKey, gMyHotKeyID,
|
|
|
|
#GetApplicationEventTarget(), 0, &gMyHotKeyRef);
|
|
|
|
}
|