cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=73634580f8949547b0dbd5f072eb57fa1e273401
commit 73634580f8949547b0dbd5f072eb57fa1e273401 Author: Michelle Legrand <michelle.legr...@openwide.fr> Date: Thu Jan 22 11:24:42 2015 +0100 ecore_cocoa: Handle more special characters and capital characters. This improve the situation and only affect Ecore_Cocoa code base by detecting a useful charactere. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h | 1 + src/lib/ecore_cocoa/ecore_cocoa.m | 66 ++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h b/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h index 69a4872..f66ae91 100644 --- a/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h +++ b/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h @@ -242,6 +242,7 @@ static const struct _ecore_cocoa_keys_s keystable[] = { NSEndFunctionKey, "End", "" }, { NSPageUpFunctionKey, "Page_Up", "" }, { NSPageDownFunctionKey, "Page_Down", "" }, +{ NSDeleteFunctionKey, "Delete", "\010"}, { NSF1FunctionKey, "F1", "" }, { NSF2FunctionKey, "F2", "" }, diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index 119e66f..3529df6 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m @@ -291,26 +291,29 @@ ecore_cocoa_feed_events(void *anEvent) compose=EINA_FALSE; } - if ([keychar length] > 0){ - for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i) + if ([keychar length] > 0) { - if (keystable[i].code == [keychar characterAtIndex:0]) - { - DBG("Key pressed : %s\n", keystable[i].name); - ev->keyname = keystable[i].name; - ev->key = keystable[i].name; - ev->string = keystable[i].compose; - ev->window = (Ecore_Window)window.ecore_window_data; - ev->event_window = ev->window; - ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); - return pass; - } + for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i) + { + if (keystable[i].code == [keychar characterAtIndex:0]) + { + DBG("Key pressed: %s %d\n", keystable[i].name, [keychar characterAtIndex:0]); + ev->keyname = keystable[i].name; + ev->key = keystable[i].name; + ev->string = keystable[i].compose; + ev->window = (Ecore_Window)window.ecore_window_data; + ev->event_window = ev->window; + ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); + return pass; + } + } + } + else + { + compose=EINA_TRUE; + edit = [[event window] fieldEditor:YES forObject:nil]; + [edit interpretKeyEvents:[NSArray arrayWithObject:event]]; } - }else{ - compose=EINA_TRUE; - edit = [[event window] fieldEditor:YES forObject:nil]; - [edit interpretKeyEvents:[NSArray arrayWithObject:event]]; - } break; } @@ -328,21 +331,22 @@ ecore_cocoa_feed_events(void *anEvent) ev->timestamp = time; ev->modifiers = _ecore_cocoa_event_modifiers([event modifierFlags]); - if ([keychar length] > 0){ - for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i) + if ([keychar length] > 0) { - if (keystable[i].code == tolower([keychar characterAtIndex:0])) - { - ev->keyname = keystable[i].name; - ev->key = keystable[i].name; - ev->string = keystable[i].compose; - ev->window = (Ecore_Window)window.ecore_window_data; - ev->event_window = ev->window; - ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); - return pass; - } + for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i) + { + if (keystable[i].code == [keychar characterAtIndex:0]) + { + ev->keyname = keystable[i].name; + ev->key = keystable[i].name; + ev->string = keystable[i].compose; + ev->window = (Ecore_Window)window.ecore_window_data; + ev->event_window = ev->window; + ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); + return pass; + } + } } - } break; } --