e_devicemgr_input: reduce duplicated code to handle mouse down and up event 41/325341/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Sat, 7 Jun 2025 09:03:24 +0000 (18:03 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 9 Jun 2025 09:57:20 +0000 (18:57 +0900)
Change-Id: I822fb48c79cf50da236b5bc753601b9044e43d9c
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/inputmgr/e_devicemgr_input.c

index d8796219ede7f7eb14b6097b1610ed2e61942313..c46a4d363eb439b9248cdd2a217da8bb0c8ebb90 100644 (file)
@@ -384,7 +384,7 @@ _e_devicemgr_input_device_update(Ecore_Device *dev)
 }
 
 static Eina_Bool
-_e_devicemgr_input_cb_mouse_button_down(void *data, int type, void *event)
+_e_devicemgr_input_cb_mouse_button_event(void *data, int type, void *event)
 {
    Ecore_Event_Mouse_Button *ev;
    Eina_Bool res = ECORE_CALLBACK_PASS_ON;
@@ -394,37 +394,14 @@ _e_devicemgr_input_cb_mouse_button_down(void *data, int type, void *event)
    ev = (Ecore_Event_Mouse_Button *)event;
 
    if (e_devicemgr->dconfig->conf->input.button_remap_enable)
-     res = _e_devicemgr_input_mouse_button_remap(ev, EINA_TRUE);
+     res = _e_devicemgr_input_mouse_button_remap(ev, (type == ECORE_EVENT_MOUSE_BUTTON_DOWN));
 
    comp_conf = e_comp_config_get();
    if (comp_conf && comp_conf->input_log_enable)
      {
-        ELOGF("DEVMGR", "%s Down (id: %d, button: %d, x: %d, y: %d), res: %d", NULL,
-              ecore_device_class_get(ev->dev) == ECORE_DEVICE_CLASS_TOUCH ? "Touch" : "Mouse",
-              ev->multi.device, ev->buttons, ev->x, ev->y, res);
-     }
-
-   return res;
-}
-
-static Eina_Bool
-_e_devicemgr_input_cb_mouse_button_up(void *data, int type, void *event)
-{
-   Ecore_Event_Mouse_Button *ev;
-   Eina_Bool res = ECORE_CALLBACK_PASS_ON;
-   E_Comp_Config *comp_conf = NULL;
-
-   EINA_SAFETY_ON_NULL_RETURN_VAL(event, res);
-   ev = (Ecore_Event_Mouse_Button *)event;
-
-   if (e_devicemgr->dconfig->conf->input.button_remap_enable)
-     res = _e_devicemgr_input_mouse_button_remap(ev, EINA_FALSE);
-
-   comp_conf = e_comp_config_get();
-   if (comp_conf && comp_conf->input_log_enable)
-     {
-        ELOGF("DEVMGR", "%s Up (id: %d, button: %d, x: %d, y: %d), res: %d", NULL,
+        ELOGF("DEVMGR", "%s %s (id: %d, button: %d, x: %d, y: %d), res: %d", NULL,
               ecore_device_class_get(ev->dev) == ECORE_DEVICE_CLASS_TOUCH ? "Touch" : "Mouse",
+              type == ECORE_EVENT_MOUSE_BUTTON_DOWN? "Down" : "Up",
               ev->multi.device, ev->buttons, ev->x, ev->y, res);
      }
 
@@ -511,8 +488,8 @@ e_devicemgr_input_init(void)
    e_devicemgr->virtual_mouse_device_fd = -1;
    e_devicemgr->virtual_key_device_fd = -1;
 
-   E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_devicemgr_input_cb_mouse_button_down, NULL);
-   E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_devicemgr_input_cb_mouse_button_up, NULL);
+   E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_devicemgr_input_cb_mouse_button_event, NULL);
+   E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_devicemgr_input_cb_mouse_button_event, NULL);
    E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_MOUSE_WHEEL, _e_devicemgr_input_cb_mouse_wheel, NULL);
    E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_DEVICE_ADD, _e_devicemgr_input_cb_device_add, NULL);
    E_LIST_HANDLER_APPEND(e_devicemgr->handlers, ECORE_EVENT_DEVICE_DEL, _e_devicemgr_input_cb_device_del, NULL);