summaryrefslogtreecommitdiff
path: root/src/lib/ecore_cocoa
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2016-09-23 17:49:34 +0900
committerThiep Ha <thiepha@gmail.com>2016-09-23 17:49:34 +0900
commitdb8b0020ecc761a6729049ceed1d9f68f528dbbb (patch)
treebd818815f20b971943b8b26feb1f2e7512d96ee1 /src/lib/ecore_cocoa
parentd7b9db44f0de6ac15fef6e7bd218a198b4ee0370 (diff)
ecore_cocoa: quit application with key
In OS X, cmd-q is used to quit application, this patch adds that feature.
Diffstat (limited to 'src/lib/ecore_cocoa')
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m
index ee1188d6be..2cf1739e0c 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)
202 case NSKeyDown: 202 case NSKeyDown:
203 { 203 {
204 Ecore_Event_Key *ev; 204 Ecore_Event_Key *ev;
205 NSUInteger flags = [event modifierFlags];
206
207 if (flags & NSCommandKeyMask)
208 {
209 NSString *keychar = [event charactersIgnoringModifiers];
210 if ([keychar characterAtIndex:0] == 'q')
211 {
212 [NSApp performSelector:@selector(terminate:)
213 withObject:nil afterDelay:0.0];
214 return EINA_TRUE;
215 }
216 }
205 217
206 ev = _ecore_cocoa_event_key(event, NSKeyDown, time); 218 ev = _ecore_cocoa_event_key(event, NSKeyDown, time);
207 if (ev == NULL) return EINA_TRUE; 219 if (ev == NULL) return EINA_TRUE;