From: xcomputerman Date: Tue, 19 Jan 2010 09:01:48 +0000 (+0000) Subject: Patch to add key modifiers for Ecore_SDL (thanks Ryan Hope) X-Git-Tag: build/2012-07-04.173327~2262 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ed56dc3f6244f7dbbc649ce313745de99e9c927;p=profile%2Fivi%2Fecore.git Patch to add key modifiers for Ecore_SDL (thanks Ryan Hope) git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@45322 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ecore_sdl/ecore_sdl.c b/src/lib/ecore_sdl/ecore_sdl.c index f2d9c4f..fc98c99 100644 --- a/src/lib/ecore_sdl/ecore_sdl.c +++ b/src/lib/ecore_sdl/ecore_sdl.c @@ -108,6 +108,23 @@ ecore_sdl_shutdown(void) return _ecore_sdl_init_count; } +static unsigned int +_ecore_sdl_event_modifiers(int mod) +{ + unsigned int modifiers = 0; + + if(mod & KMOD_LSHIFT) modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if(mod & KMOD_RSHIFT) modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if(mod & KMOD_LCTRL) modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if(mod & KMOD_RCTRL) modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if(mod & KMOD_LALT) modifiers |= ECORE_EVENT_MODIFIER_ALT; + if(mod & KMOD_RALT) modifiers |= ECORE_EVENT_MODIFIER_ALT; + if(mod & KMOD_NUM) modifiers |= ECORE_EVENT_LOCK_NUM; + if(mod & KMOD_CAPS) modifiers |= ECORE_EVENT_LOCK_CAPS; + + return modifiers; +} + static Ecore_Event_Key* _ecore_sdl_event_key(SDL_Event *event, double time) { @@ -119,7 +136,7 @@ _ecore_sdl_event_key(SDL_Event *event, double time) ev->timestamp = time; ev->window = 0; - ev->modifiers = 0; /* FIXME: keep modifier around. */ + ev->modifiers = _ecore_sdl_event_modifiers(SDL_GetModState()); ev->key = NULL; ev->compose = NULL;