cc(): fix -x objective-c; ui.focus_app()
parent
f9fb6f0be4
commit
56fbafe03a
|
@ -841,10 +841,14 @@ mut args := ''
|
||||||
if os.dir_exists(v.out_name) {
|
if os.dir_exists(v.out_name) {
|
||||||
panic('\'$v.out_name\' is a directory')
|
panic('\'$v.out_name\' is a directory')
|
||||||
}
|
}
|
||||||
|
if v.os == .mac {
|
||||||
|
a << '-x objective-c'
|
||||||
|
}
|
||||||
// The C file we are compiling
|
// The C file we are compiling
|
||||||
//a << '"$TmpPath/$v.out_name_c"'
|
|
||||||
a << '".$v.out_name_c"'
|
a << '".$v.out_name_c"'
|
||||||
// }
|
if v.os == .mac {
|
||||||
|
a << '-x none'
|
||||||
|
}
|
||||||
// Min macos version is mandatory I think?
|
// Min macos version is mandatory I think?
|
||||||
if v.os == .mac {
|
if v.os == .mac {
|
||||||
a << '-mmacosx-version-min=10.7'
|
a << '-mmacosx-version-min=10.7'
|
||||||
|
@ -852,9 +856,6 @@ mut args := ''
|
||||||
a << flags
|
a << flags
|
||||||
a << libs
|
a << libs
|
||||||
// macOS code can include objective C TODO remove once objective C is replaced with C
|
// macOS code can include objective C TODO remove once objective C is replaced with C
|
||||||
if v.os == .mac {
|
|
||||||
a << '-x objective-c'
|
|
||||||
}
|
|
||||||
// Without these libs compilation will fail on Linux
|
// Without these libs compilation will fail on Linux
|
||||||
// || os.user_os() == 'linux'
|
// || os.user_os() == 'linux'
|
||||||
if v.pref.build_mode != .build && (v.os == .linux || v.os == .freebsd || v.os == .openbsd ||
|
if v.pref.build_mode != .build && (v.os == .linux || v.os == .freebsd || v.os == .openbsd ||
|
||||||
|
|
|
@ -176,7 +176,7 @@ fn (p mut Parser) parse() {
|
||||||
}
|
}
|
||||||
p.fgenln('\n')
|
p.fgenln('\n')
|
||||||
p.builtin_mod = p.mod == 'builtin'
|
p.builtin_mod = p.mod == 'builtin'
|
||||||
p.can_chash = p.mod == 'freetype' || p.mod=='ui' || p.file_path.contains('/focus.v') // TODO tmp remove
|
p.can_chash = p.mod == 'freetype' || p.mod=='ui' // TODO tmp remove
|
||||||
// Import pass - the first and the smallest pass that only analyzes imports
|
// Import pass - the first and the smallest pass that only analyzes imports
|
||||||
// fully qualify the module name, eg base64 to encoding.base64
|
// fully qualify the module name, eg base64 to encoding.base64
|
||||||
fq_mod := p.table.qualify_module(p.mod, p.file_path)
|
fq_mod := p.table.qualify_module(p.mod, p.file_path)
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
module ui
|
||||||
|
|
||||||
|
#flag -framework Carbon
|
||||||
|
#flag -framework Cocoa
|
||||||
|
|
||||||
|
#include <Cocoa/Cocoa.h>
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
#InstallApplicationEventHandler(&focus_app, 1, &eventType, NULL, NULL);
|
||||||
|
#gMyHotKeyID.signature = 'rml1';
|
||||||
|
#gMyHotKeyID.id = 1;
|
||||||
|
#RegisterEventHotKey(kVK_ANSI_1, cmdKey, gMyHotKeyID,
|
||||||
|
#GetApplicationEventTarget(), 0, &gMyHotKeyRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue