summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa.m24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m
index 7204f89417..8fa9e09c36 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa.m
@@ -115,6 +115,7 @@ _ecore_cocoa_event_key(NSEvent *event,
115 static Eina_Bool compose = EINA_FALSE; 115 static Eina_Bool compose = EINA_FALSE;
116 static NSText *edit; 116 static NSText *edit;
117 unsigned int i; 117 unsigned int i;
118 int kchar = -1;
118 119
119 Ecore_Event_Key *ev; 120 Ecore_Event_Key *ev;
120 121
@@ -143,22 +144,33 @@ _ecore_cocoa_event_key(NSEvent *event,
143 ev->window = (Ecore_Window)window.ecore_window_data; 144 ev->window = (Ecore_Window)window.ecore_window_data;
144 ev->event_window = ev->window; 145 ev->event_window = ev->window;
145 146
147 /*
148 * Try to look for the keychar data if available.
149 * If not, try the raw keychar.
150 */
146 if ([keychar length] > 0) 151 if ([keychar length] > 0)
152 kchar = [keychar characterAtIndex: 0];
153 if ((kchar < 0) && ([keycharRaw length] > 0))
154 kchar = [keycharRaw characterAtIndex: 0];
155
156 if (kchar >= 0)
147 { 157 {
148 for (i = 0; i < EINA_C_ARRAY_LENGTH(keystable); ++i) 158 for (i = 0; i < EINA_C_ARRAY_LENGTH(keystable); ++i)
149 { 159 {
150 if (keystable[i].code == [keychar characterAtIndex:0]) 160 if (keystable[i].code == kchar)
151 { 161 {
152 ev->keyname = keystable[i].name; 162 ev->keyname = keystable[i].name;
153 ev->key = ev->keyname; 163 ev->key = ev->keyname;
154 break; 164 break;
155 } 165 }
156 } 166 }
157 if (ev->keyname == NULL) 167 }
158 { 168
159 ev->keyname = ""; 169 /* Fallback */
160 ev->key = ""; 170 if (!ev->keyname)
161 } 171 {
172 ev->keyname = "";
173 ev->key = "";
162 } 174 }
163 175
164 if (([keycharRaw length] == 0) && (keyType == NSEventTypeKeyDown)) 176 if (([keycharRaw length] == 0) && (keyType == NSEventTypeKeyDown))