From: jhyuni.kang Date: Mon, 6 Apr 2015 08:34:45 +0000 (+0900) Subject: Grab hwkeys using a keylayout file X-Git-Tag: submit/tizen/20150422.015951^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0432d31d3fc1dc09939e98dfdd2876e6ba3c5984;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-keyrouter.git Grab hwkeys using a keylayout file Change-Id: I5f3e27e256edb584b212355730cf9e3802fda203 --- diff --git a/configure.ac b/configure.ac index 805655a..81fac40 100644 --- a/configure.ac +++ b/configure.ac @@ -40,6 +40,16 @@ dnl ======================================================================== #AC_HEADER_STDC AC_CHECK_HEADERS([math.h fcntl.h stdlib.h string.h unistd.h]) +dnl ======================================================================== +# checks for input files +dnl ======================================================================== +AC_ARG_WITH(tizen_keylayout_file, + AS_HELP_STRING([--with-tizen-keylayout-file=PATH], + [Tizen key layout file path (default: (/usr/share/X11/xkb/tizen_key_layout.txt))]), + [ KEYLAYOUT_PATH="$withval" ], + [ KEYLAYOUT_PATH="/usr/share/X11/xkb/tizen_key_layout.txt"]) + +AC_DEFINE_UNQUOTED(KEYLAYOUT_PATH, "$KEYLAYOUT_PATH", [Path to tizen keylayout file]) dnl ======================================================================== # checks for typedefs, structures, and compiler characteristics AC_C_CONST diff --git a/packaging/e-mod-tizen-keyrouter.spec b/packaging/e-mod-tizen-keyrouter.spec index a5da5ab..6b2ddf1 100644 --- a/packaging/e-mod-tizen-keyrouter.spec +++ b/packaging/e-mod-tizen-keyrouter.spec @@ -1,7 +1,7 @@ %bcond_with x Name: e-mod-tizen-keyrouter -Version: 0.0.2 +Version: 0.0.3 Release: 1 Summary: The Enlightenment Keyrouter Module for Tizen URL: http://www.enlightenment.org @@ -16,6 +16,7 @@ BuildRequires: pkgconfig(xtst) BuildRequires: pkgconfig(xrandr) BuildRequires: pkgconfig(utilX) BuildRequires: pkgconfig(dlog) +BuildRequires: e-tizen-data %if !%{with x} ExclusiveArch: @@ -34,7 +35,8 @@ export CFLAGS+=" -Wall -g -fPIC -rdynamic ${GC_SECTIONS_FLAGS}" export LDFLAGS+=" -Wl,--hash-style=both -Wl,--as-needed -Wl,--rpath=/usr/lib" %autogen -%configure --prefix=/usr +%configure --prefix=/usr \ + --with-tizen-keylayout-file=/usr/share/X11/xkb/tizen_key_layout.txt make %install diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 20e4f54..3155a61 100755 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1359,6 +1359,7 @@ _e_keyrouter_init(void) _e_keyrouter_x_input_init(); InitGrabKeyDevices(); + _e_keyrouter_query_tizen_key_table(); _e_keyrouter_bindings_init(); krt.atomDeviceStatus = ecore_x_atom_get(STR_ATOM_DEVICE_STATUS); @@ -1489,6 +1490,39 @@ _e_keyrouter_structure_init(void) krt.atomLongPressEnable = None; } +static void _e_keyrouter_query_tizen_key_table(void) +{ + FILE *fp_key_tables = NULL; + char keyname[64] = {0}; + int keycode=0, key_count=0, i=0, key_size=0; + + fp_key_tables = fopen(KEYLAYOUT_PATH, "r"); + if (!fp_key_tables) + { + SLOG(LOG_ERROR, "KEYROUTER", "Failed to read file (%s)\n", KEYLAYOUT_PATH); + return; + } + + SECURE_SLOGD("Support Tizen Keymap\n"); + while ( 0 < fscanf(fp_key_tables, "%s %d", keyname, &keycode)) + { + key_count++; + SECURE_SLOGD(" - [%s\t:%d]\n", keyname, keycode); + } + fseek(fp_key_tables, 0, SEEK_SET); + + krt.TizenKeys = (char**)calloc(key_count, sizeof(char*)); + krt.numTizenKeys = key_count; + for (i=0; ikey_name = HWKeys[i]; + hki->key_name = krt.TizenKeys[i]; hki->key_sym = ksym; hki->keycodes = NULL; @@ -1660,11 +1694,11 @@ _e_keyrouter_bindings_init(void) int i, keycode; KeySym ksym; - for (i = 0; i < NUM_HWKEYS; i++) + for (i = 0; i < krt.numTizenKeys; i++) { - if (HWKeys[i]) + if (krt.TizenKeys[i]) { - ksym = XStringToKeysym(HWKeys[i]); + ksym = XStringToKeysym(krt.TizenKeys[i]); if (ksym) keycode = XKeysymToKeycode(krt.disp, ksym); @@ -1677,12 +1711,12 @@ _e_keyrouter_bindings_init(void) } /* get bound key information */ - krt.HardKeys[keycode].bind = e_bindings_key_find(HWKeys[i], + krt.HardKeys[keycode].bind = e_bindings_key_find(krt.TizenKeys[i], E_BINDING_MODIFIER_NONE, 1); if ((!krt.HardKeys[keycode].bind) || - (strcmp(krt.HardKeys[keycode].bind->key, HWKeys[i]))) + (strcmp(krt.HardKeys[keycode].bind->key, krt.TizenKeys[i]))) { continue; } @@ -2044,6 +2078,17 @@ PrintKeyDeliveryList(void) { int index; + SECURE_SLOGD("Full of grabbed keys\n"); + for (index=0; index