e_comp_wl: refactor code to send touch axis 00/325200/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 3 Jun 2025 00:33:14 +0000 (09:33 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Wed, 4 Jun 2025 07:06:55 +0000 (16:06 +0900)
Change-Id: I8a48f84cddc1cf5a630a9759c3b9abb56f302eb1
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/server/e_comp_wl.c

index 6a6d15207159e61d898fb39786adcefe83fe4a12..5a3366ef636d3415082c46f159ac2ea0405f53b2 100644 (file)
@@ -4912,8 +4912,8 @@ e_comp_wl_touch_frame_send_ec_set(E_Comp_Wl_Data *comp_wl, E_Client *ec)
    comp_wl->touch.frame_ec = ec;
 }
 
-EINTERN Eina_Bool
-e_comp_wl_touch_send(E_Client *ec, int idx, int x, int y, Eina_Bool pressed, Ecore_Device *dev, double radius_x, double radius_y, double pressure, double angle, uint32_t time)
+static Eina_Bool
+_e_comp_wl_device_send_event_axis(E_Client *ec, int idx, Ecore_Device *dev, double radius_x, double radius_y, double pressure, double angle, uint32_t time)
 {
    struct wl_client *wc;
    uint32_t serial;
@@ -4945,6 +4945,19 @@ e_comp_wl_touch_send(E_Client *ec, int idx, int x, int y, Eina_Bool pressed, Eco
         _e_comp_wl_device_handle_axes(device->identifier, device->clas, ec, idx, radius_x, radius_y, pressure, angle);
      }
 
+   return EINA_TRUE;
+}
+
+EINTERN Eina_Bool
+e_comp_wl_touch_send(E_Client *ec, int idx, int x, int y, Eina_Bool pressed, Ecore_Device *dev, double radius_x, double radius_y, double pressure, double angle, uint32_t time)
+{
+   E_Comp_Wl_Data *comp_wl;
+   comp_wl = e_comp_wl_get();
+   EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
+
+   if (!_e_comp_wl_device_send_event_axis(ec, idx, dev, radius_x, radius_y, pressure, angle, time))
+     return EINA_FALSE;
+
    x = x + ec->client.x;
    y = y + ec->client.y;
 
@@ -4956,35 +4969,12 @@ e_comp_wl_touch_send(E_Client *ec, int idx, int x, int y, Eina_Bool pressed, Eco
 EINTERN Eina_Bool
 e_comp_wl_touch_update_send(E_Client *ec, int idx, int x, int y, Ecore_Device *dev, double radius_x, double radius_y, double pressure, double angle, uint32_t time)
 {
-   E_Devicemgr_Input_Device *device;
-   uint32_t serial;
-   struct wl_client *wc;
    E_Comp_Wl_Data *comp_wl;
-
-   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
-
    comp_wl = e_comp_wl_get();
    EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
 
-   struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EINA_FALSE);
-
-   if (!dev) device = e_comp_wl_device_last_device_get(ECORE_DEVICE_CLASS_TOUCH);
-
-   wc = wl_resource_get_client(surface);
-   if (!time) time = e_util_timestamp_get();
-   serial = wl_display_next_serial(comp_wl->wl.disp);
-
-   if (dev)
-     {
-        _e_comp_wl_send_event_device(wc, time, dev, serial);
-        _e_comp_wl_device_handle_axes(ecore_device_identifier_get(dev), ECORE_DEVICE_CLASS_TOUCH, ec, idx, radius_x, radius_y, pressure, angle);
-     }
-   else if (device)
-     {
-        _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_TOUCH, time);
-        _e_comp_wl_device_handle_axes(device->identifier, device->clas, ec, idx, radius_x, radius_y, pressure, angle);
-     }
+   if (!_e_comp_wl_device_send_event_axis(ec, idx, dev, radius_x, radius_y, pressure, angle, time))
+     return EINA_FALSE;
 
    x = x + ec->client.x;
    y = y + ec->client.y;