mmi-keyboard-provider, wayland-input : change indent space to tab about modality_keyboard 88/264088/1
authordyamy-lee <dyamy.lee@samsung.com>
Tue, 7 Sep 2021 03:19:11 +0000 (12:19 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Mon, 13 Sep 2021 11:26:24 +0000 (20:26 +0900)
Change-Id: Idfd1d87f0b9017aac1954ab4ed6894c00538ae3e

src/modules/modality_keyboard/mmi-keyboard-provider.c
src/modules/modality_keyboard/wayland-input.c

index 30662ba..d5d1fa0 100644 (file)
@@ -32,60 +32,60 @@ mmi_provider_op_mode _provider_mode = MODALITY_PROVIDER_MODE_NONE;
 static mmi_provider_module_data *
 keyboard_modality_init(void)
 {
-    mmi_provider_module_data *keyboard_data = NULL;
-    LOGD("keyboard_modality_init \n");
+       mmi_provider_module_data *keyboard_data = NULL;
+       LOGD("keyboard_modality_init \n");
 
-    keyboard_data = (mmi_provider_module_data *)calloc(1, sizeof(mmi_provider_module_data));
-    if(!keyboard_data) {
-        LOGE("Failed alloc keyboard modality provider data\n");
-        return NULL;
-    }
+       keyboard_data = (mmi_provider_module_data *)calloc(1, sizeof(mmi_provider_module_data));
+       if(!keyboard_data) {
+               LOGE("Failed alloc keyboard modality provider data\n");
+               return NULL;
+       }
 
-    keyboard_data->get_mode = keyboard_get_mode;
-    keyboard_data->set_mode = keyboard_set_mode;
+       keyboard_data->get_mode = keyboard_get_mode;
+       keyboard_data->set_mode = keyboard_set_mode;
 
-    wayland_input_init();
-    return keyboard_data;
+       wayland_input_init();
+       return keyboard_data;
 }
 
 bool keyboard_set_mode(mmi_provider_op_mode mode)
 {
-    LOGD("keyboard_set_mode = %d\n", mode);
-    if(!mode)
-        return false;
-    _provider_mode = mode;
-    return true;
+       LOGD("keyboard_set_mode = %d\n", mode);
+       if(!mode)
+               return false;
+       _provider_mode = mode;
+       return true;
 }
 
 mmi_provider_op_mode keyboard_get_mode(void)
 {
-    LOGD("keyboard_get_mode \n");
-    return _provider_mode;
+       LOGD("keyboard_get_mode \n");
+       return _provider_mode;
 }
 
 static void
 keyboard_modality_deinit(mmi_provider_module_data *module_data)
 {
-    if(!module_data) {
-        LOGE("No have module_data\n");
-        return;
-    }
+       if(!module_data) {
+               LOGE("No have module_data\n");
+               return;
+       }
 
-    LOGD("keyboard_modality_deinit \n");
+       LOGD("keyboard_modality_deinit \n");
 
-    module_data->get_mode = NULL;
-    module_data->set_mode = NULL;
+       module_data->get_mode = NULL;
+       module_data->set_mode = NULL;
 
-    free(module_data);
-    module_data = NULL;
-    wayland_input_shutdown();
+       free(module_data);
+       module_data = NULL;
+       wayland_input_shutdown();
 }
 
 MMI_PROVIDER_API mmi_provider_module mmi_provider_module_info = {
-    "keyboard-provider!",
-    "libmmi_modality_keyboard.so",
-    MODALITY_PROVIDER_CAP_KEY_EVENT,
-    MMI_PROVIDER_SET_ABI_VERSION(1,0),
-    keyboard_modality_init,
-    keyboard_modality_deinit
+       "keyboard-provider!",
+       "libmmi_modality_keyboard.so",
+       MODALITY_PROVIDER_CAP_KEY_EVENT,
+       MMI_PROVIDER_SET_ABI_VERSION(1,0),
+       keyboard_modality_init,
+       keyboard_modality_deinit
 };
\ No newline at end of file
index 6979007..74c09e2 100644 (file)
@@ -52,24 +52,24 @@ int MMI_PROVIDER_EVENT_KEY = -1;
 typedef struct tizen_keyrouter_notify tizen_keyrouter_notify_t;
 struct tizen_keyrouter_notify
 {
-    unsigned int keycode;
-    unsigned int mode;
-    unsigned int error;
+       unsigned int keycode;
+       unsigned int mode;
+       unsigned int error;
 };
 
 typedef struct keycode_map keycode_map_t;
 struct keycode_map
 {
-    xkb_keysym_t keysym;
-    xkb_keycode_t *keycodes;
-    int nkeycodes;
+       xkb_keysym_t keysym;
+       xkb_keycode_t *keycodes;
+       int nkeycodes;
 };
 
 typedef struct keymap_info keymap_info_t;
 struct keymap_info
 {
-    const char *keyname;
-    int mode;
+       const char *keyname;
+       int mode;
 };
 
 unsigned int has_keymap = 0;
@@ -101,533 +101,533 @@ static void set_input_config(void *data, struct tizen_keyrouter *tizen_keyrouter
 static void key_cancel(void *data, struct tizen_keyrouter *tizen_keyrouter, uint32_t key);
 
 static const struct wl_registry_listener registry_listener = {
-    handle_global,
-    handle_global_remove,
+       handle_global,
+       handle_global_remove,
 };
 
 static const struct wl_seat_listener seat_listener = {
-    seat_capabilities,
-    seat_name,
+       seat_capabilities,
+       seat_name,
 };
 
 static const struct wl_keyboard_listener keyboard_listener = {
-    keyboard_keymap,
-    keyboard_enter,
-    keyboard_leave,
-    keyboard_key,
-    keyboard_modifiers,
-    keyboard_repeat_setup,
+       keyboard_keymap,
+       keyboard_enter,
+       keyboard_leave,
+       keyboard_key,
+       keyboard_modifiers,
+       keyboard_repeat_setup,
 };
 
 static const struct tizen_keyrouter_listener keyrouter_listener = {
-    keygrab_notify,
-    keygrab_notify_list,
-    getgrab_notify_list,
-    set_register_none_key,
-    keyregister_notify,
-    set_input_config,
-    key_cancel,
+       keygrab_notify,
+       keygrab_notify_list,
+       getgrab_notify_list,
+       set_register_none_key,
+       keyregister_notify,
+       set_input_config,
+       key_cancel,
 };
 
 static void
 handle_global(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version)
 {
-    if (!strcmp("wl_seat", interface))
-    {
-        seat = wl_registry_bind(registry, id, &wl_seat_interface, 4);
-        wl_seat_add_listener(seat, &seat_listener, NULL);
-    }
-    else if (!strcmp("tizen_keyrouter", interface))
-    {
-        tz_keyrouter = wl_registry_bind(registry, id, &tizen_keyrouter_interface, 1);
-        tizen_keyrouter_add_listener(tz_keyrouter, &keyrouter_listener, NULL);
-    }
+       if (!strcmp("wl_seat", interface))
+       {
+               seat = wl_registry_bind(registry, id, &wl_seat_interface, 4);
+               wl_seat_add_listener(seat, &seat_listener, NULL);
+       }
+       else if (!strcmp("tizen_keyrouter", interface))
+       {
+               tz_keyrouter = wl_registry_bind(registry, id, &tizen_keyrouter_interface, 1);
+               tizen_keyrouter_add_listener(tz_keyrouter, &keyrouter_listener, NULL);
+       }
 }
 
 static void
 handle_global_remove(void *data, struct wl_registry *registry, unsigned int id)
 {
-    (void) registry;
-    (void) id;
+       (void) registry;
+       (void) id;
 }
 
 static void
 seat_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps)
 {
-    if ((caps & WL_SEAT_CAPABILITY_KEYBOARD))
-    {
-        if (keyboard)
-        {
-            wl_keyboard_release(keyboard);
-            keyboard = NULL;
-        }
-
-        keyboard = wl_seat_get_keyboard(seat);
-        if(!keyboard)
-        {
-            LOGE("Failed to get wl_keyboard from a seat !\n");
-            return;
-        }
-        wl_keyboard_add_listener(keyboard, &keyboard_listener, NULL);
-        LOGD("seat caps update : keyboard added\n");
-    }
-    else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && (keyboard))
-    {
-        wl_keyboard_release(keyboard);
-        keyboard = NULL;
-    }
+       if ((caps & WL_SEAT_CAPABILITY_KEYBOARD))
+       {
+               if (keyboard)
+               {
+                       wl_keyboard_release(keyboard);
+                       keyboard = NULL;
+               }
+
+               keyboard = wl_seat_get_keyboard(seat);
+               if(!keyboard)
+               {
+                       LOGE("Failed to get wl_keyboard from a seat !\n");
+                       return;
+               }
+               wl_keyboard_add_listener(keyboard, &keyboard_listener, NULL);
+               LOGD("seat caps update : keyboard added\n");
+       }
+       else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && (keyboard))
+       {
+               wl_keyboard_release(keyboard);
+               keyboard = NULL;
+       }
 }
 
 static void
 seat_name(void *data, struct wl_seat *seat, const char *name)
 {
-    (void) seat;
-    (void) name;
+       (void) seat;
+       (void) name;
 }
 
 static void
 keyboard_keymap(void *data, struct wl_keyboard *keyboard, unsigned int format, int fd, unsigned int size)
 {
-    char *map = NULL;
-
-    LOGD("...WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1=%d, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP=%d\n",
-                    WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP);
-    LOGD("... format=%d, fd=%d, size=%d\n",  format, fd, size);
-
-    if (!xkb_context)
-    {
-        LOGE("... This client failed to make xkb context\n");
-        close(fd);
-        return;
-    }
-    if (format == WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP)
-    {
-        has_keymap = 0;
-    }
-    else
-    {
-        LOGD("wl_keyboard has keymap...\n");
-        map = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
-        if(map == MAP_FAILED)
-        {
-            LOGE("... Failed to mmap from fd(%d) size(%d)\n", fd, size);
-            close(fd);
-            return;
-        }
-
-        if(keymap) xkb_map_unref(keymap);
-        keymap = xkb_map_new_from_string(xkb_context, map, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
-        if(!keymap) {
-            LOGE("... Failed to get keymap from fd(%d)\n", fd);
-            munmap(map, size);
-            close(fd);
-            return;
-        }
-
-        munmap(map, size);
-        close(fd);
-        has_keymap = 1;
-    }
-
-    LOGD("has_keymap = %s\n", has_keymap ? "true" : "false");
-    set_keymap = 1;
+       char *map = NULL;
+
+       LOGD("...WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1=%d, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP=%d\n",
+                                       WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP);
+       LOGD("... format=%d, fd=%d, size=%d\n",  format, fd, size);
+
+       if (!xkb_context)
+       {
+               LOGE("... This client failed to make xkb context\n");
+               close(fd);
+               return;
+       }
+       if (format == WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP)
+       {
+               has_keymap = 0;
+       }
+       else
+       {
+               LOGD("wl_keyboard has keymap...\n");
+               map = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
+               if(map == MAP_FAILED)
+               {
+                       LOGE("... Failed to mmap from fd(%d) size(%d)\n", fd, size);
+                       close(fd);
+                       return;
+               }
+
+               if(keymap) xkb_map_unref(keymap);
+               keymap = xkb_map_new_from_string(xkb_context, map, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
+               if(!keymap) {
+                       LOGE("... Failed to get keymap from fd(%d)\n", fd);
+                       munmap(map, size);
+                       close(fd);
+                       return;
+               }
+
+               munmap(map, size);
+               close(fd);
+               has_keymap = 1;
+       }
+
+       LOGD("has_keymap = %s\n", has_keymap ? "true" : "false");
+       set_keymap = 1;
 }
 
 static void
 keyboard_enter(void *data, struct wl_keyboard *keyboard, unsigned int serial, struct wl_surface *surface, struct wl_array *keys)
 {
-    (void) keyboard;
-    (void) serial;
-    (void) surface;
-    (void) keys;
+       (void) keyboard;
+       (void) serial;
+       (void) surface;
+       (void) keys;
 }
 
 static void
 keyboard_leave(void *data, struct wl_keyboard *keyboard, unsigned int serial, struct wl_surface *surface)
 {
-    (void) keyboard;
-    (void) serial;
-    (void) surface;
+       (void) keyboard;
+       (void) serial;
+       (void) surface;
 }
 
 static unsigned int
 _covert_kernel_keycode_to_user_keycode(unsigned int kernel_keycode)
 {
-    LOGD("kernel keycode : %d, user keycode : %d\n", kernel_keycode, kernel_keycode+8);
-    return (kernel_keycode+8);
+       LOGD("kernel keycode : %d, user keycode : %d\n", kernel_keycode, kernel_keycode+8);
+       return (kernel_keycode+8);
 }
 
 static void
 _input_event_key_cb_free(void *data EINA_UNUSED, void *event)
 {
-    mmi_provider_event_key *ev = event;
-    if(ev->keyname)
-        free(ev->keyname);
-    free(ev);
+       mmi_provider_event_key *ev = event;
+       if(ev->keyname)
+               free(ev->keyname);
+       free(ev);
 }
 
 static void
 _input_add_key_event(unsigned int keycode, unsigned int state, unsigned int timestamp)
 {
-    const char * name = NULL;
+       const char * name = NULL;
 
-    if((name = xkb_keymap_key_get_name(keymap, keycode)))
-    {
-        LOGD("key name = %s, keycode = %d\n", name, keycode);
+       if((name = xkb_keymap_key_get_name(keymap, keycode)))
+       {
+               LOGD("key name = %s, keycode = %d\n", name, keycode);
 
-        mmi_provider_event_key *ev = calloc(1, sizeof(mmi_provider_event_key));
+               mmi_provider_event_key *ev = calloc(1, sizeof(mmi_provider_event_key));
 
-        if(state)
-            ev->type = MMI_EVENT_KEY_TYPE_DOWN;
-        else
-            ev->type = MMI_EVENT_KEY_TYPE_UP;
-        ev->timestamp = timestamp;
-        ev->keycode = keycode;
-        ev->key_down = state;
-        ev->keyname = strdup(name);
+               if(state)
+                       ev->type = MMI_EVENT_KEY_TYPE_DOWN;
+               else
+                       ev->type = MMI_EVENT_KEY_TYPE_UP;
+               ev->timestamp = timestamp;
+               ev->keycode = keycode;
+               ev->key_down = state;
+               ev->keyname = strdup(name);
 
-        LOGI("type = %s, keyname = %s, key = %d, time = %d", (ev->type)?"MMI_EVENT_KEY_TYPE_DOWN":"MMI_EVENT_KEY_TYPE_UP", ev->keyname, ev->keycode, ev->timestamp);
-        ecore_event_add(MMI_PROVIDER_EVENT_KEY, ev, _input_event_key_cb_free, NULL);
-    }
-    else
-        LOGD("No matched keyname from keycode = %d\n", keycode);
+               LOGI("type = %s, keyname = %s, key = %d, time = %d", (ev->type)?"MMI_EVENT_KEY_TYPE_DOWN":"MMI_EVENT_KEY_TYPE_UP", ev->keyname, ev->keycode, ev->timestamp);
+               ecore_event_add(MMI_PROVIDER_EVENT_KEY, ev, _input_event_key_cb_free, NULL);
+       }
+       else
+               LOGD("No matched keyname from keycode = %d\n", keycode);
 }
 
 static void
 keyboard_key(void *data, struct wl_keyboard *keyboard, unsigned int serial, unsigned int timestamp, unsigned int keycode, unsigned int state)
 {
-    unsigned int user_keycode = _covert_kernel_keycode_to_user_keycode(keycode);
-
-    LOGD("... serial=%d, time=%d, key=%d, state=%d\n", serial, timestamp, user_keycode, state);
-    if (!has_keymap)
-    {
-        //TODO : do anything with the given keycode
-        //           ex> call application callback(s)
-        LOGD("keycode : %d, state : %d, timestamp : %d\n", user_keycode, state, timestamp);
-    }
-    else
-    {
-        LOGD("has_keymap | keycode : %d, state : %d, timestamp : %d\n", user_keycode, state, timestamp);
-        if(_provider_mode == MODALITY_PROVIDER_MODE_PROPAGATE_EVENT)
-        {
-            _input_add_key_event(user_keycode, state, timestamp);
-        }
-    }
+       unsigned int user_keycode = _covert_kernel_keycode_to_user_keycode(keycode);
+
+       LOGD("... serial=%d, time=%d, key=%d, state=%d\n", serial, timestamp, user_keycode, state);
+       if (!has_keymap)
+       {
+               //TODO : do anything with the given keycode
+               //           ex> call application callback(s)
+               LOGD("keycode : %d, state : %d, timestamp : %d\n", user_keycode, state, timestamp);
+       }
+       else
+       {
+               LOGD("has_keymap | keycode : %d, state : %d, timestamp : %d\n", user_keycode, state, timestamp);
+               if(_provider_mode == MODALITY_PROVIDER_MODE_PROPAGATE_EVENT)
+               {
+                       _input_add_key_event(user_keycode, state, timestamp);
+               }
+       }
 }
 
 static void
 keyboard_modifiers(void *data, struct wl_keyboard *keyboard, unsigned int serial, unsigned int depressed, unsigned int latched, unsigned int locked, unsigned int group)
 {
-    (void) keyboard;
-    (void) serial;
-    (void) depressed;
-    (void) latched;
-    (void) locked;
-    (void) group;
+       (void) keyboard;
+       (void) serial;
+       (void) depressed;
+       (void) latched;
+       (void) locked;
+       (void) group;
 }
 
 static void
 keyboard_repeat_setup(void *data, struct wl_keyboard *keyboard, int32_t rate, int32_t delay)
 {
-    (void) keyboard;
-    (void) rate;
-    (void) delay;
+       (void) keyboard;
+       (void) rate;
+       (void) delay;
 }
 
 static void
 keygrab_notify(void *data, struct tizen_keyrouter *tizen_keyrouter, struct wl_surface *surface, uint32_t key, uint32_t mode, uint32_t error)
 {
-    LOGD("key : %d, mode : %d, error : %d\n", key, mode, error);
+       LOGD("key : %d, mode : %d, error : %d\n", key, mode, error);
 }
 
 static void
 keygrab_notify_list(void *data, struct tizen_keyrouter *tizen_keyrouter, struct wl_surface *surface, struct wl_array *notify_result)
 {
-    tizen_keyrouter_notify_t *tz_keyrouter_notify;
-    struct wl_array array;
+       tizen_keyrouter_notify_t *tz_keyrouter_notify;
+       struct wl_array array;
 
-    wl_array_init(&array);
-    wl_array_copy(&array, notify_result);
+       wl_array_init(&array);
+       wl_array_copy(&array, notify_result);
 
-    wl_array_for_each(tz_keyrouter_notify, &array)
-    {
-        LOGD("... keygrab result ! (keycode : %d, mode : %d, error : %d)\n",
-                tz_keyrouter_notify->keycode, tz_keyrouter_notify->mode, tz_keyrouter_notify->error);
-    }
+       wl_array_for_each(tz_keyrouter_notify, &array)
+       {
+               LOGD("... keygrab result ! (keycode : %d, mode : %d, error : %d)\n",
+                               tz_keyrouter_notify->keycode, tz_keyrouter_notify->mode, tz_keyrouter_notify->error);
+       }
 
-    wl_array_release(&array);
+       wl_array_release(&array);
 }
 
 static void getgrab_notify_list(void *data, struct tizen_keyrouter *tizen_keyrouter, struct wl_surface *surface, struct wl_array *notify_result)
 {
-    (void) tizen_keyrouter;
-    (void) surface;
-    (void) notify_result;
+       (void) tizen_keyrouter;
+       (void) surface;
+       (void) notify_result;
 }
 
 static void set_register_none_key(void *data, struct tizen_keyrouter *tizen_keyrouter, struct wl_surface *surface, uint32_t mode)
 {
-    (void) tizen_keyrouter;
-    (void) surface;
-    (void) mode;
+       (void) tizen_keyrouter;
+       (void) surface;
+       (void) mode;
 }
 
 static void keyregister_notify(void *data, struct tizen_keyrouter *tizen_keyrouter, uint32_t status)
 {
-    (void) tizen_keyrouter;
-    (void) status;
+       (void) tizen_keyrouter;
+       (void) status;
 }
 
 static void set_input_config(void *data, struct tizen_keyrouter *tizen_keyrouter, uint32_t status)
 {
-    (void) tizen_keyrouter;
-    (void) status;
+       (void) tizen_keyrouter;
+       (void) status;
 }
 
 static void key_cancel(void *data, struct tizen_keyrouter *tizen_keyrouter, uint32_t key)
 {
-    (void) tizen_keyrouter;
-    (void) key;
+       (void) tizen_keyrouter;
+       (void) key;
 }
 
 int _xkb_context_init(void)
 {
-    xkb_context = xkb_context_new(0);
-    if(!xkb_context)
-    {
-        LOGE("Failed to get xkb_context!\n");
-        return 0;
-    }
-    return 1;
+       xkb_context = xkb_context_new(0);
+       if(!xkb_context)
+       {
+               LOGE("Failed to get xkb_context!\n");
+               return 0;
+       }
+       return 1;
 }
 
 void _xkb_context_shutdown(void)
 {
-    if(!xkb_context)
-        return;
+       if(!xkb_context)
+               return;
 
-    xkb_context_unref(xkb_context);
+       xkb_context_unref(xkb_context);
 }
 
 static void
 _find_keycode(struct xkb_keymap *keymap, xkb_keycode_t key, void *data)
 {
-    keycode_map_t *found_keycodes = (keycode_map_t *)data;
-    xkb_keysym_t keysym = found_keycodes->keysym;
-    int nsyms = 0;
-    const xkb_keysym_t *syms_out = NULL;
-    xkb_keycode_t *tmp_keycodes = NULL;
+       keycode_map_t *found_keycodes = (keycode_map_t *)data;
+       xkb_keysym_t keysym = found_keycodes->keysym;
+       int nsyms = 0;
+       const xkb_keysym_t *syms_out = NULL;
+       xkb_keycode_t *tmp_keycodes = NULL;
 
-    if(!keymap)
-    {
-        LOGE("Invalied keymap \n");
-        return;
-    }
+       if(!keymap)
+       {
+               LOGE("Invalied keymap \n");
+               return;
+       }
 
-    nsyms = xkb_keymap_key_get_syms_by_level(keymap, key, 0, 0, &syms_out);
+       nsyms = xkb_keymap_key_get_syms_by_level(keymap, key, 0, 0, &syms_out);
 
-    if (nsyms && syms_out)
-    {
-        if (*syms_out == keysym)
-        {
-            tmp_keycodes = calloc(1, sizeof(int)*(found_keycodes->nkeycodes+1));
+       if (nsyms && syms_out)
+       {
+               if (*syms_out == keysym)
+               {
+                       tmp_keycodes = calloc(1, sizeof(int)*(found_keycodes->nkeycodes+1));
 
-            if (tmp_keycodes)
-            {
-                memcpy(tmp_keycodes, found_keycodes->keycodes, sizeof(int)*found_keycodes->nkeycodes);
-                free(found_keycodes->keycodes);
+                       if (tmp_keycodes)
+                       {
+                               memcpy(tmp_keycodes, found_keycodes->keycodes, sizeof(int)*found_keycodes->nkeycodes);
+                               free(found_keycodes->keycodes);
 
-                found_keycodes->nkeycodes++;
-                found_keycodes->keycodes = tmp_keycodes;
-                found_keycodes->keycodes[found_keycodes->nkeycodes-1] = key;
-            }
-        }
-    }
+                               found_keycodes->nkeycodes++;
+                               found_keycodes->keycodes = tmp_keycodes;
+                               found_keycodes->keycodes[found_keycodes->nkeycodes-1] = key;
+                       }
+               }
+       }
 }
 
 int _get_keycode_from_keysym(struct xkb_keymap *keymap, xkb_keysym_t keysym, xkb_keycode_t **keycodes)
 {
-    keycode_map_t found_keycodes = {0,};
-    found_keycodes.keysym = keysym;
+       keycode_map_t found_keycodes = {0,};
+       found_keycodes.keysym = keysym;
 
-    if(!keymap)
-    {
-        LOGE("Invalied keymap \n");
-        return 0;
-    }
+       if(!keymap)
+       {
+               LOGE("Invalied keymap \n");
+               return 0;
+       }
 
-    xkb_keymap_key_for_each(keymap, _find_keycode, &found_keycodes);
+       xkb_keymap_key_for_each(keymap, _find_keycode, &found_keycodes);
 
-    *keycodes = found_keycodes.keycodes;
-    return found_keycodes.nkeycodes;
+       *keycodes = found_keycodes.keycodes;
+       return found_keycodes.nkeycodes;
 }
 
 void _do_keygrab(const char *keyname, uint32_t mode)
 {
-    xkb_keysym_t keysym = 0x0;
-    int nkeycodes = 0;
-    xkb_keycode_t *keycodes = NULL;
-    int i;
+       xkb_keysym_t keysym = 0x0;
+       int nkeycodes = 0;
+       xkb_keycode_t *keycodes = NULL;
+       int i;
 
-    keysym = xkb_keysym_from_name(keyname, XKB_KEYSYM_NO_FLAGS);
-    nkeycodes = _get_keycode_from_keysym(keymap, keysym, &keycodes);
-    if(!nkeycodes)
-    {
-        LOGE("Failed do keygrab on %s(%d)\n", keyname, keysym);
-        free(keycodes);
-        keycodes = NULL;
-        return;
-    }
+       keysym = xkb_keysym_from_name(keyname, XKB_KEYSYM_NO_FLAGS);
+       nkeycodes = _get_keycode_from_keysym(keymap, keysym, &keycodes);
+       if(!nkeycodes)
+       {
+               LOGE("Failed do keygrab on %s(%d)\n", keyname, keysym);
+               free(keycodes);
+               keycodes = NULL;
+               return;
+       }
 
-    for(i=0; i<nkeycodes; i++)
-    {
-        tizen_keyrouter_set_keygrab(tz_keyrouter, NULL, keycodes[i], mode);
-    }
+       for(i=0; i<nkeycodes; i++)
+       {
+               tizen_keyrouter_set_keygrab(tz_keyrouter, NULL, keycodes[i], mode);
+       }
 
 }
 
 static keymap_info_t stored_keymap[] = {
-        { "XF86Back", TIZEN_KEYROUTER_MODE_EXCLUSIVE },
-        { "XF86Info", TIZEN_KEYROUTER_MODE_OVERRIDABLE_EXCLUSIVE}
+               { "XF86Back", TIZEN_KEYROUTER_MODE_EXCLUSIVE },
+               { "XF86Info", TIZEN_KEYROUTER_MODE_OVERRIDABLE_EXCLUSIVE}
 };
 
 void _keygrab_init(void)
 {
-    int i;
-    int size = sizeof(stored_keymap)/sizeof(keymap_info_t);
+       int i;
+       int size = sizeof(stored_keymap)/sizeof(keymap_info_t);
 
-    LOGD("stored keymap size = %d\n", size);
-    for(i=0; i < size; i++)
-    {
-        LOGD("stored keymap %d = %s, %d\n", i, stored_keymap[i].keyname, stored_keymap[i].mode);
-        _do_keygrab(stored_keymap[i].keyname, stored_keymap[i].mode);
-    }
+       LOGD("stored keymap size = %d\n", size);
+       for(i=0; i < size; i++)
+       {
+               LOGD("stored keymap %d = %s, %d\n", i, stored_keymap[i].keyname, stored_keymap[i].mode);
+               _do_keygrab(stored_keymap[i].keyname, stored_keymap[i].mode);
+       }
 }
 
 static Eina_Bool
 _cb_handle_data(void *data, Ecore_Fd_Handler *hdl)
 {
-    int ret = 0;
-    if(ecore_main_fd_handler_active_get(hdl, ECORE_FD_ERROR))
-    {
-        LOGE("Received error on wayland display fd");
-        goto err;
-    }
-
-    if(ecore_main_fd_handler_active_get(hdl, ECORE_FD_READ))
-    {
-        ret = wl_display_dispatch(display);
-    }
-    else if(ecore_main_fd_handler_active_get(hdl, ECORE_FD_WRITE))
-    {
-        ret = wl_display_flush(display);
-        if(ret == 0){
-            ecore_main_fd_handler_active_set(hdl, ECORE_FD_READ);
-        }
-    }
-
-    if((ret < 0) && (errno != EAGAIN) && (errno != EINVAL))
-        goto err;
-
-    return ECORE_CALLBACK_RENEW;
+       int ret = 0;
+       if(ecore_main_fd_handler_active_get(hdl, ECORE_FD_ERROR))
+       {
+               LOGE("Received error on wayland display fd");
+               goto err;
+       }
+
+       if(ecore_main_fd_handler_active_get(hdl, ECORE_FD_READ))
+       {
+               ret = wl_display_dispatch(display);
+       }
+       else if(ecore_main_fd_handler_active_get(hdl, ECORE_FD_WRITE))
+       {
+               ret = wl_display_flush(display);
+               if(ret == 0){
+                       ecore_main_fd_handler_active_set(hdl, ECORE_FD_READ);
+               }
+       }
+
+       if((ret < 0) && (errno != EAGAIN) && (errno != EINVAL))
+               goto err;
+
+       return ECORE_CALLBACK_RENEW;
 
 err:
-    fd_hdl = NULL;
-    LOGE("Wayland Socket Error : %s\n", eina_error_msg_get(errno));
-    return ECORE_CALLBACK_CANCEL;
+       fd_hdl = NULL;
+       LOGE("Wayland Socket Error : %s\n", eina_error_msg_get(errno));
+       return ECORE_CALLBACK_CANCEL;
 }
 
 void _wl_init(void)
 {
-    int res = 0;
-    const char *socket_name = NULL;
-
-    socket_name = getenv("WAYLAND_DISPLAY");
-    LOGD("socket name = %s\n", socket_name);
-    if(!socket_name)
-    {
-        LOGD("NO has socket name\n");
-        socket_name = "wayland-0";
-    }
-    if (!getenv("XDG_RUNTIME_DIR"))
-    {
-        LOGD("no xdg runtime dir\n");
-        setenv("XDG_RUNTIME_DIR", "/run", 1);
-    }
-
-    display = wl_display_connect(socket_name);
-    if(!display)
-    {
-        LOGE("Failed to connect wayland display (socket_name = %s) !\n", socket_name);
-        return;
-    }
-
-    res = _xkb_context_init();
-    if(!res)
-    {
-        LOGE("Failed to init xkb\n");
-    }
-
-    registry = wl_display_get_registry(display);
-    if(!registry)
-    {
-        LOGE("Failed to get registry\n");
-        return;
-    }
-    wl_registry_add_listener(registry, &registry_listener, NULL);
-
-    fd_hdl = ecore_main_fd_handler_add(wl_display_get_fd(display),
-                                (ECORE_FD_READ | ECORE_FD_WRITE | ECORE_FD_ERROR),
-                                _cb_handle_data, NULL, NULL, NULL);
-
-    if(!fd_hdl)
-    {
-        LOGE("Failed to add ecore fd(%d, wl.display) handler\n", wl_display_get_fd(display));
-        wl_registry_destroy(registry);
-        wl_display_disconnect(display);
-        registry = NULL;
-        display = NULL;
-        return;
-    }
-
-    while(!set_keymap)
-        wl_display_roundtrip(display);
+       int res = 0;
+       const char *socket_name = NULL;
+
+       socket_name = getenv("WAYLAND_DISPLAY");
+       LOGD("socket name = %s\n", socket_name);
+       if(!socket_name)
+       {
+               LOGD("NO has socket name\n");
+               socket_name = "wayland-0";
+       }
+       if (!getenv("XDG_RUNTIME_DIR"))
+       {
+               LOGD("no xdg runtime dir\n");
+               setenv("XDG_RUNTIME_DIR", "/run", 1);
+       }
+
+       display = wl_display_connect(socket_name);
+       if(!display)
+       {
+               LOGE("Failed to connect wayland display (socket_name = %s) !\n", socket_name);
+               return;
+       }
+
+       res = _xkb_context_init();
+       if(!res)
+       {
+               LOGE("Failed to init xkb\n");
+       }
+
+       registry = wl_display_get_registry(display);
+       if(!registry)
+       {
+               LOGE("Failed to get registry\n");
+               return;
+       }
+       wl_registry_add_listener(registry, &registry_listener, NULL);
+
+       fd_hdl = ecore_main_fd_handler_add(wl_display_get_fd(display),
+                                                               (ECORE_FD_READ | ECORE_FD_WRITE | ECORE_FD_ERROR),
+                                                               _cb_handle_data, NULL, NULL, NULL);
+
+       if(!fd_hdl)
+       {
+               LOGE("Failed to add ecore fd(%d, wl.display) handler\n", wl_display_get_fd(display));
+               wl_registry_destroy(registry);
+               wl_display_disconnect(display);
+               registry = NULL;
+               display = NULL;
+               return;
+       }
+
+       while(!set_keymap)
+               wl_display_roundtrip(display);
 }
 
 void _wl_shutdown(void)
 {
-    tizen_keyrouter_destroy(tz_keyrouter);
-    wl_keyboard_release(keyboard);
-    wl_seat_destroy(seat);
-    wl_display_disconnect(display);
+       tizen_keyrouter_destroy(tz_keyrouter);
+       wl_keyboard_release(keyboard);
+       wl_seat_destroy(seat);
+       wl_display_disconnect(display);
 }
 
 void _keymap_shutdown(void)
 {
-    if(keymap) xkb_map_unref(keymap);
+       if(keymap) xkb_map_unref(keymap);
 }
 
 void _input_event_init(void)
 {
-    MMI_PROVIDER_EVENT_KEY = ecore_event_type_new();
+       MMI_PROVIDER_EVENT_KEY = ecore_event_type_new();
 }
 
 void _input_event_shutdown(void)
 {
-    MMI_PROVIDER_EVENT_KEY = -1;
+       MMI_PROVIDER_EVENT_KEY = -1;
 }
 
 void wayland_input_init(void)
 {
-    _input_event_init();
-    _wl_init();
-    _keygrab_init();
+       _input_event_init();
+       _wl_init();
+       _keygrab_init();
 }
 
 void wayland_input_shutdown(void)
 {
-    _input_event_shutdown();
-    _wl_shutdown();
-    _keymap_shutdown();
-    _xkb_context_shutdown();
+       _input_event_shutdown();
+       _wl_shutdown();
+       _keymap_shutdown();
+       _xkb_context_shutdown();
 }
\ No newline at end of file