From 2b8b17402ed59815019b309051b277ba4de82f3b Mon Sep 17 00:00:00 2001 From: Akemi Date: Thu, 15 Dec 2016 23:06:04 +0100 Subject: cocoa: cosmetic fixes --- osdep/macosx_application.m | 3 ++- osdep/macosx_events.m | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'osdep') diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index 8808caa0a4..d31269279e 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -206,7 +206,8 @@ static void terminate_cocoa_application(void) return [item autorelease]; } -- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)theApp { +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)theApp +{ return NSTerminateNow; } diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index c493c58c96..494c9aa88c 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -142,7 +142,8 @@ static int mk_flags(NSEvent *event) return ([event data1] & 0x0000FFFF); } -static int mk_down(NSEvent *event) { +static int mk_down(NSEvent *event) +{ return (((mk_flags(event) & 0xFF00) >> 8)) == 0xA; } @@ -178,11 +179,13 @@ static CGEventRef tap_event_callback(CGEventTapProxy proxy, CGEventType type, } } -void cocoa_init_media_keys(void) { +void cocoa_init_media_keys(void) +{ [[EventsResponder sharedInstance] startMediaKeys]; } -void cocoa_uninit_media_keys(void) { +void cocoa_uninit_media_keys(void) +{ [[EventsResponder sharedInstance] stopMediaKeys]; } @@ -446,10 +449,11 @@ void cocoa_set_input_context(struct input_ctx *input_context) NSString *chars; - if ([self useAltGr] && RightAltPressed([event modifierFlags])) + if ([self useAltGr] && RightAltPressed([event modifierFlags])) { chars = [event characters]; - else + } else { chars = [event charactersIgnoringModifiers]; + } struct bstr t = bstr0([chars UTF8String]); int key = convert_key([event keyCode], bstr_decode_utf8(t, &t)); -- cgit v1.2.3