Use device class and subclass to detect remocon input 53/271853/6
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 2 Mar 2022 11:06:15 +0000 (20:06 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 8 Mar 2022 01:33:07 +0000 (10:33 +0900)
Change-Id: I81ecc80cec9fb372ba7098a322902d90030497fa
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/e_mod_main.c

index 9584907..3539149 100644 (file)
@@ -1181,23 +1181,6 @@ _e_text_input_method_context_cb_resource_destroy(struct wl_resource *resource)
    free(context);
 }
 
-static Eina_Bool is_number_key(const char *str)
- {
-    if (!str) return EINA_FALSE;
-
-    int result = atoi(str);
-
-    if (result == 0)
-      {
-         if (!strcmp(str, "0"))
-           return EINA_TRUE;
-         else
-           return EINA_FALSE;
-      }
-    else
-      return EINA_TRUE;
-}
-
 static Eina_Bool
 _e_mod_ecore_key_down_cb(void *data, int type, void *event)
 {
@@ -1212,6 +1195,12 @@ _e_mod_ecore_key_down_cb(void *data, int type, void *event)
      return ECORE_CALLBACK_PASS_ON;
 
    /* process remote controller key exceptionally */
+   if (ecore_device_class_get(ev->dev) == ECORE_DEVICE_CLASS_KEYBOARD &&
+       ecore_device_subclass_get(ev->dev) == ECORE_DEVICE_SUBCLASS_REMOCON)
+     return ECORE_CALLBACK_PASS_ON;
+
+   /* process up/down/left/right and enter key exceptionally */
+   /* KP_XXX key is used as arrow key and number key in keypad, so ev->string is used for checking whether KP_XXX key is number key or not */
    if (((!strcmp(ev->key, "Down") ||
          !strcmp(ev->key, "KP_Down") ||
          !strcmp(ev->key, "Up") ||
@@ -1220,12 +1209,7 @@ _e_mod_ecore_key_down_cb(void *data, int type, void *event)
          !strcmp(ev->key, "KP_Right") ||
          !strcmp(ev->key, "Left") ||
          !strcmp(ev->key, "KP_Left")) && !ev->string) ||
-       !strcmp(ev->key, "Return") ||
-       !strcmp(ev->key, "Pause") ||
-       !strcmp(ev->key, "NoSymbol") ||
-       !strncmp(ev->key, "XF86", 4) ||
-       !strncmp(ev->key, "Cancel", 5) ||
-       (is_number_key(ev->string) && _TV))
+       !strcmp(ev->key, "Return"))
      return ECORE_CALLBACK_PASS_ON;
 
    SECURE_LOGI("Hide IME (key : %s)", ev->key);