From: Thiep Ha Date: Fri, 23 Sep 2016 08:49:34 +0000 (+0900) Subject: ecore_cocoa: quit application with key X-Git-Tag: accepted/tizen/3.0/ivi/20161011.043919~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F90432%2F2;p=platform%2Fupstream%2Fefl.git ecore_cocoa: quit application with key In OS X, cmd-q is used to quit application, this patch adds that feature. Change-Id: I898370f4e0c5d518603fc29f3c6e7e72a51d9485 --- diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index 968a802..599daf3 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m @@ -202,6 +202,18 @@ _ecore_cocoa_feed_events(void *anEvent) case NSKeyDown: { Ecore_Event_Key *ev; + NSUInteger flags = [event modifierFlags]; + + if (flags & NSCommandKeyMask) + { + NSString *keychar = [event charactersIgnoringModifiers]; + if ([keychar characterAtIndex:0] == 'q') + { + [NSApp performSelector:@selector(terminate:) + withObject:nil afterDelay:0.0]; + return EINA_TRUE; + } + } ev = _ecore_cocoa_event_key(event, NSKeyDown, time); if (ev == NULL) return EINA_TRUE;