e_seat: Move function related to seat and rename 44/318444/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Sat, 11 Jan 2025 09:34:36 +0000 (18:34 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 17 Jan 2025 04:42:53 +0000 (04:42 +0000)
Change-Id: I10776639a2ea1eda817295be6bc7f9adba010b1a
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
12 files changed:
src/bin/e_comp_screen.c
src/bin/inputmgr/e_devicemgr_input.c
src/bin/inputmgr/e_seat.c
src/bin/inputmgr/e_seat_intern.h
src/bin/server/e_comp_wl.c
src/bin/server/e_comp_wl_data.c
src/bin/server/e_comp_wl_input.c
src/bin/server/e_comp_wl_input_intern.h
src/bin/server/e_comp_wl_input_thread.c
src/bin/server/e_comp_wl_intern.h
src/bin/server/e_devicemgr_wl.c
src/bin/windowmgr/e_pointer.c

index bc5fd51be65cbfeaf16bb7ab41d2d9c18a9cde77..fccbcbb5ec0e936f8ddd8c136936e8801fb4c349 100644 (file)
@@ -309,7 +309,7 @@ _e_comp_screen_cb_input_device_add(void *data, int type, void *event)
    if (!(e = event)) goto end;
    ELOGF("COMP_SCREEN", "Input Device Add. name:%s(%s), seat:%s", NULL, e->name, e->identifier, e->seatname);
 
-   seat = e_comp_wl_input_seat_get(e->seatname);
+   seat = e_seat_find(e->seatname);
    if (!seat) goto end;
 
    if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
@@ -317,7 +317,7 @@ _e_comp_screen_cb_input_device_add(void *data, int type, void *event)
         if (seat->ptr.num_devices == 0)
           {
              e_pointer_view_set(comp->pointer, NULL, 0, 0);
-             e_comp_wl_input_pointer_enabled_set(seat, EINA_TRUE);
+             e_seat_pointer_enabled_set(seat, EINA_TRUE);
           }
         seat->ptr.num_devices++;
      }
@@ -332,7 +332,7 @@ _e_comp_screen_cb_input_device_add(void *data, int type, void *event)
    else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
      {
         E_Comp_Screen *comp_screen = e_comp_screen_get();
-        e_comp_wl_input_touch_enabled_set(seat, EINA_TRUE);
+        e_seat_touch_enabled_set(seat, EINA_TRUE);
         if (comp_screen)
           _e_comp_screen_input_rotation_set(comp_screen->rotation);
         seat->touch.num_devices++;
@@ -388,7 +388,7 @@ _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
    if (!(e = event)) goto end;
    ELOGF("COMP_SCREEN", "Input Device Del. name:%s(%s), seat:%s", NULL, e->name, e->identifier, e->seatname);
 
-   seat = e_comp_wl_input_seat_get(e->seatname);
+   seat = e_seat_find(e->seatname);
    if (!seat) goto end;
 
    if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
@@ -396,7 +396,7 @@ _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
         seat->ptr.num_devices--;
         if (seat->ptr.num_devices == 0)
           {
-             e_comp_wl_input_pointer_enabled_set(seat, EINA_FALSE);
+             e_seat_pointer_enabled_set(seat, EINA_FALSE);
              e_pointer_view_set(comp->pointer, NULL, 0, 0);
              e_pointer_hide(comp->pointer);
 
@@ -408,7 +408,7 @@ _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
         seat->touch.num_devices--;
         if (seat->touch.num_devices == 0)
           {
-             e_comp_wl_input_touch_enabled_set(seat, EINA_FALSE);
+             e_seat_touch_enabled_set(seat, EINA_FALSE);
           }
      }
 
index 10ce5fc4de848762d8a695150336171b6b329d4a..45dec58dde23134b4479cbe28be662e08b447893 100644 (file)
@@ -10,6 +10,7 @@
 #include "e_devicemgr_wl_intern.h"
 #include "e_input_log.h"
 #include "e_client_intern.h"
+#include "e_seat_intern.h"
 
 #include <tizen-extension-server-protocol.h>
 
@@ -78,7 +79,7 @@ e_devicemgr_input_pointer_warp(struct wl_client *client, struct wl_resource *res
         return TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_SURFACE;
      }
 
-   if ((!e_config->show_cursor) || (!e_comp_wl_input_seat_pointer_enabled_get(NULL)))
+   if ((!e_config->show_cursor) || (!e_seat_pointer_enabled_get(NULL)))
      {
         DMERR("Pointer is not available");
         if (!e_comp_wl_input_pointer_constraint_activated_get())
index 0f99c2b3452bbedabf2d320b50f6d4e15ee40a1d..4161e590f2e3c60eeb0ffcdcbeb2a58a877dfedf 100644 (file)
@@ -1,7 +1,9 @@
 #include "e_seat_intern.h"
 #include "e_input_seat_intern.h"
 #include "e_comp_intern.h"
+#include "e_comp_wl_intern.h"
 #include "e_comp_wl_input_intern.h"
+#include "e_comp_input_intern.h"
 
 static Eina_List *_ecore_event_handlers = NULL;
 
@@ -12,7 +14,7 @@ _e_seat_cb_seat_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
    E_Seat *seat = NULL;
    E_Zone *zone = NULL;
 
-   seat = e_comp_wl_input_seat_get(ei->seat_name);
+   seat = e_seat_find(ei->seat_name);
    if (!seat) return ECORE_CALLBACK_PASS_ON;
 
    if (ei->output_name)
@@ -50,3 +52,480 @@ e_seat_zone_get(E_Seat *seat)
 
    return seat->zone;
 }
+
+EINTERN E_Seat *
+e_seat_find(const char *name)
+{
+   Eina_List *l;
+   E_Seat *seat;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+
+   EINA_LIST_FOREACH(comp_wl->seats, l, seat)
+     {
+        if (seat->name && !strcmp(seat->name, name))
+          return seat;
+     }
+
+   return NULL;
+}
+
+EINTERN void
+e_seat_update_seat_caps(E_Seat *seat, struct wl_client *wc)
+{
+   Eina_List *l;
+   struct wl_resource *res;
+   enum wl_seat_capability caps = 0;
+
+   if (!seat)
+     seat = e_seat_find("default");
+
+   if (seat->ptr.enabled)
+     caps |= WL_SEAT_CAPABILITY_POINTER;
+   if (e_comp_input_key->kbd.enabled)
+     caps |= WL_SEAT_CAPABILITY_KEYBOARD;
+   if (seat->touch.enabled)
+     caps |= WL_SEAT_CAPABILITY_TOUCH;
+
+   EINA_LIST_FOREACH(seat->resources, l, res)
+     {
+        /* if a wc is null, send seat capability to all wl_seat resources */
+        if (wc && (wl_resource_get_client(res) != wc)) continue;
+        wl_seat_send_capabilities(res, caps);
+     }
+}
+
+EINTERN void
+e_seat_touch_send_motion(E_Seat *seat, struct wl_client *wc,
+                         int idx, int x, int y, uint32_t timestamp)
+{
+   Eina_List *l, *ll;
+   struct wl_resource *res;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   E_Seat *s;
+
+   if (!seat) goto iterate;
+
+   EINA_LIST_FOREACH(seat->touch.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_touch_check(res)) continue;
+
+        wl_touch_send_motion(res, timestamp, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
+     }
+   return;
+
+iterate:
+   EINA_LIST_FOREACH(comp_wl->seats, l, s)
+     {
+        EINA_LIST_FOREACH(s->touch.resources, ll, res)
+          {
+             if (wl_resource_get_client(res) != wc) continue;
+             if (!e_comp_wl_input_touch_check(res)) continue;
+
+             wl_touch_send_motion(res, timestamp, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
+          }
+     }
+}
+
+EINTERN void
+e_seat_touch_send_downup(E_Seat *seat, struct wl_client *wc,
+                         struct wl_resource *surface, int idx, int x, int y, uint32_t timestamp,
+                         Eina_Bool pressed)
+{
+   Eina_List *l, *ll;
+   struct wl_resource *res;
+   uint32_t serial;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   E_Seat *s;
+
+   serial = wl_display_next_serial(comp_wl->wl.disp);
+
+   if (!seat) goto iterate;
+
+   EINA_LIST_FOREACH(seat->touch.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_touch_check(res)) continue;
+
+        TRACE_INPUT_BEGIN(e_seat_touch_send_downup);
+        if (pressed)
+          {
+             ELOGF("Touch", "Down (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
+             wl_touch_send_down(res, serial, timestamp, surface, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
+          }
+        else
+          {
+             ELOGF("Touch", "Up (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
+             wl_touch_send_up(res, serial, timestamp, idx);
+          }
+        TRACE_INPUT_END();
+     }
+   return;
+
+iterate:
+   EINA_LIST_FOREACH(comp_wl->seats, l, s)
+     {
+        EINA_LIST_FOREACH(s->touch.resources, ll, res)
+          {
+             if (wl_resource_get_client(res) != wc) continue;
+             if (!e_comp_wl_input_touch_check(res)) continue;
+
+             TRACE_INPUT_BEGIN(e_seat_touch_send_downup);
+             if (pressed)
+               {
+                  ELOGF("Touch", "Down (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
+                  wl_touch_send_down(res, serial, timestamp, surface, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
+               }
+             else
+               {
+                  ELOGF("Touch", "Up (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
+                  wl_touch_send_up(res, serial, timestamp, idx);
+               }
+             TRACE_INPUT_END();
+          }
+     }
+}
+
+EINTERN void
+e_seat_touch_send_cancel(E_Seat *seat, struct wl_client *wc, E_Client *ec)
+{
+   Eina_List *l, *ll;
+   struct wl_resource *res;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   E_Seat *s;
+
+   if (!seat) goto iterate;
+
+   EINA_LIST_FOREACH(seat->touch.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_touch_check(res)) continue;
+
+        ELOGF("Touch", "Cancel name:%20s", ec, ec ? e_client_util_name_get(ec) : "Unknown");
+
+        wl_touch_send_cancel(res);
+     }
+   return;
+
+iterate:
+   EINA_LIST_FOREACH(comp_wl->seats, l, s)
+     {
+        EINA_LIST_FOREACH(s->touch.resources, ll, res)
+          {
+             if (wl_resource_get_client(res) != wc) continue;
+             if (!e_comp_wl_input_touch_check(res)) continue;
+
+             ELOGF("Touch", "Cancel name:%20s", ec, ec ? e_client_util_name_get(ec) : "Unknown");
+
+             wl_touch_send_cancel(res);
+          }
+     }
+}
+
+EINTERN void
+e_seat_touch_send_frame(E_Seat *seat, struct wl_client *wc)
+{
+   Eina_List *l, *ll;
+   struct wl_resource *res;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   E_Seat *s;
+
+   if (!seat) goto iterate;
+
+   EINA_LIST_FOREACH(seat->touch.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_touch_check(res)) continue;
+
+        wl_touch_send_frame(res);
+     }
+   return;
+
+iterate:
+   EINA_LIST_FOREACH(comp_wl->seats, l, s)
+     {
+        EINA_LIST_FOREACH(s->touch.resources, ll, res)
+          {
+             if (wl_resource_get_client(res) != wc) continue;
+             if (!e_comp_wl_input_touch_check(res)) continue;
+             wl_touch_send_frame(res);
+          }
+     }
+}
+
+EINTERN void
+e_seat_touch_enabled_set(E_Seat *seat, Eina_Bool enabled)
+{
+   if (!seat) return;
+
+   seat->touch.enabled = !!enabled;
+   e_seat_update_seat_caps(seat, NULL);
+}
+
+EINTERN Eina_Bool
+e_seat_touch_is_empty(E_Seat *seat)
+{
+   if (!seat) goto iterate;
+
+   if (!eina_list_count(seat->ptr.resources)) return EINA_TRUE;
+
+   return EINA_FALSE;
+
+iterate:
+   Eina_List *l;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   EINA_LIST_FOREACH(comp_wl->seats, l, seat)
+     {
+        if (eina_list_count(seat->touch.resources))
+          return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+
+EINTERN void
+e_seat_pointer_send_motion(E_Seat *seat, struct wl_client *wc,
+                           int x, int y, uint32_t timestamp)
+{
+   Eina_List *l, *ll;
+   struct wl_resource *res;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   E_Seat *s;
+
+   if (!seat) goto iterate;
+
+   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_pointer_check(res)) continue;
+
+        wl_pointer_send_motion(res, timestamp,
+                               wl_fixed_from_int(x),
+                               wl_fixed_from_int(y));
+     }
+   return;
+
+iterate:
+   EINA_LIST_FOREACH(comp_wl->seats, l, s)
+     {
+        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+          {
+             if (wl_resource_get_client(res) != wc) continue;
+             if (!e_comp_wl_input_pointer_check(res)) continue;
+
+             wl_pointer_send_motion(res, timestamp,
+                                    wl_fixed_from_int(x),
+                                    wl_fixed_from_int(y));
+          }
+     }
+}
+
+EINTERN void
+e_seat_pointer_send_enter(E_Seat *seat, struct wl_client *wc, E_Client *ec,
+                          struct wl_resource *surface, int x, int y)
+{
+   Eina_List *l, *ll;
+   struct wl_resource *res;
+   uint32_t serial;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   E_Seat *s;
+
+   serial = wl_display_next_serial(comp_wl->wl.disp);
+
+   if (!seat) goto iterate;
+
+   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_pointer_check(res)) continue;
+
+        wl_pointer_send_enter(res, serial, surface,
+                              wl_fixed_from_int(x), wl_fixed_from_int(y));
+
+        if (ec)
+          ec->pointer_enter_sent = EINA_TRUE;
+     }
+   return;
+
+iterate:
+   EINA_LIST_FOREACH(comp_wl->seats, l, s)
+     {
+        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+          {
+             if (wl_resource_get_client(res) != wc) continue;
+             if (!e_comp_wl_input_pointer_check(res)) continue;
+
+             wl_pointer_send_enter(res, serial, surface,
+                                   wl_fixed_from_int(x), wl_fixed_from_int(y));
+
+             if (ec)
+               ec->pointer_enter_sent = EINA_TRUE;
+          }
+     }
+}
+
+EINTERN void
+e_seat_pointer_send_leave(E_Seat *seat, struct wl_client *wc, E_Client *ec,
+                          struct wl_resource *surface)
+{
+   Eina_List *l, *ll;
+   struct wl_resource *res;
+   uint32_t serial;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   E_Seat *s;
+
+   serial = wl_display_next_serial(comp_wl->wl.disp);
+
+   if (!seat) goto iterate;
+
+   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_pointer_check(res)) continue;
+        if (ec && ec->pointer_enter_sent == EINA_FALSE) continue;
+
+        wl_pointer_send_leave(res, serial, surface);
+
+        if (ec)
+          ec->pointer_enter_sent = EINA_FALSE;
+     }
+   return;
+
+iterate:
+   EINA_LIST_FOREACH(comp_wl->seats, l, s)
+     {
+        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+          {
+             if (wl_resource_get_client(res) != wc) continue;
+             if (!e_comp_wl_input_pointer_check(res)) continue;
+             if (ec && ec->pointer_enter_sent == EINA_FALSE) continue;
+
+             wl_pointer_send_leave(res, serial, surface);
+
+             if (ec)
+               ec->pointer_enter_sent = EINA_FALSE;
+          }
+     }
+}
+
+EINTERN void
+e_seat_pointer_send_button(E_Seat *seat, struct wl_client *wc,
+                           uint32_t button, uint32_t state, uint32_t timestamp)
+{
+   Eina_List *l, *ll;
+   struct wl_resource *res;
+   uint32_t serial;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   E_Seat *s;
+
+   serial = wl_display_next_serial(comp_wl->wl.disp);
+
+   if (!seat) goto iterate;
+
+   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_pointer_check(res)) continue;
+
+        TRACE_INPUT_BEGIN(e_comp_wl_surface_mouse_button);
+        ELOGF("Mouse", "Button %s (btn: %d, time: %d)", NULL, (state ? "Down" : "Up"), button, timestamp);
+        wl_pointer_send_button(res, serial, timestamp,
+                               button, state);
+        TRACE_INPUT_END();
+     }
+   return;
+
+iterate:
+   EINA_LIST_FOREACH(comp_wl->seats, l, s)
+     {
+        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+          {
+             if (wl_resource_get_client(res) != wc) continue;
+             if (!e_comp_wl_input_pointer_check(res)) continue;
+
+             wl_pointer_send_button(res, serial, timestamp,
+                                    button, state);
+          }
+     }
+}
+
+EINTERN void
+e_seat_pointer_send_axis(E_Seat *seat, struct wl_client *wc,
+                         uint32_t axis, uint32_t dir, uint32_t timestamp)
+{
+   Eina_List *l, *ll;
+   struct wl_resource *res;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   E_Seat *s;
+
+   if (!seat) goto iterate;
+
+   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_pointer_check(res)) continue;
+
+        wl_pointer_send_axis(res, timestamp, axis, dir);
+     }
+   return;
+
+iterate:
+   EINA_LIST_FOREACH(comp_wl->seats, l, s)
+     {
+        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+          {
+             if (wl_resource_get_client(res) != wc) continue;
+             if (!e_comp_wl_input_pointer_check(res)) continue;
+
+             wl_pointer_send_axis(res, timestamp, axis, dir);
+          }
+     }
+}
+
+EINTERN void
+e_seat_pointer_enabled_set(E_Seat *seat, Eina_Bool enabled)
+{
+   if (!seat) return;
+
+   seat->ptr.enabled = !!enabled;
+   e_seat_update_seat_caps(seat, NULL);
+}
+
+EINTERN Eina_Bool
+e_seat_pointer_enabled_get(E_Seat *seat)
+{
+   if (!seat) goto iterate;
+
+   if (seat->ptr.enabled) return EINA_TRUE;
+
+   return EINA_FALSE;
+
+iterate:
+   Eina_List *l;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   EINA_LIST_FOREACH(comp_wl->seats, l, seat)
+     {
+        if (seat->ptr.enabled) return EINA_TRUE;
+     }
+   return EINA_FALSE;
+}
+
+EINTERN Eina_Bool
+e_seat_pointer_is_empty(E_Seat *seat)
+{
+   if (!seat) goto iterate;
+
+   if (!eina_list_count(seat->ptr.resources)) return EINA_TRUE;
+
+   return EINA_FALSE;
+
+iterate:
+   Eina_List *l;
+   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+   EINA_LIST_FOREACH(comp_wl->seats, l, seat)
+     {
+        if (eina_list_count(seat->ptr.resources))
+          return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+
index 7d2323d15eb183fdfc81e43d1830ad01a98ad1c9..73ad8e8283ae6c3d93638099d57e7a3ae1ec1607 100644 (file)
@@ -14,5 +14,31 @@ struct _E_Seat_Event_Info
 EINTERN void        e_seat_init();
 EINTERN void        e_seat_shutdown();
 EINTERN E_Zone     *e_seat_zone_get(E_Seat *seat);
+EINTERN E_Seat     *e_seat_find(const char *name);
+EINTERN void        e_seat_update_seat_caps(E_Seat *seat, struct wl_client *wc);
+
+EINTERN void        e_seat_touch_send_motion(E_Seat *seat, struct wl_client *wc,
+                                             int idx, int x, int y, uint32_t timestamp);
+EINTERN void        e_seat_touch_send_downup(E_Seat *seat, struct wl_client *wc,
+                                             struct wl_resource *surface, int idx, int x, int y, uint32_t timestamp,
+                                             Eina_Bool pressed);
+EINTERN void        e_seat_touch_send_cancel(E_Seat *seat, struct wl_client *wc, E_Client *ec);
+EINTERN void        e_seat_touch_send_frame(E_Seat *seat, struct wl_client *wc);
+EINTERN void        e_seat_touch_enabled_set(E_Seat *seat, Eina_Bool enabled);
+EINTERN Eina_Bool   e_seat_touch_is_empty(E_Seat *seat);
+
+EINTERN void        e_seat_pointer_send_motion(E_Seat *seat, struct wl_client *wc,
+                                               int x, int y, unsigned int timestamp);
+EINTERN void        e_seat_pointer_send_enter(E_Seat *seat, struct wl_client *wc, E_Client *ec,
+                                              struct wl_resource *surface, int x, int y);
+EINTERN void        e_seat_pointer_send_leave(E_Seat *seat, struct wl_client *wc, E_Client *ec,
+                                              struct wl_resource *surface);
+EINTERN void        e_seat_pointer_send_button(E_Seat *seat, struct wl_client *wc,
+                                               uint32_t button, uint32_t state, uint32_t timestamp);
+EINTERN void        e_seat_pointer_send_axis(E_Seat *seat, struct wl_client *wc,
+                                             uint32_t axis, uint32_t dir, uint32_t timestamp);
+EINTERN void        e_seat_pointer_enabled_set(E_Seat *seat, Eina_Bool enabled);
+EINTERN Eina_Bool   e_seat_pointer_enabled_get(E_Seat *seat);
+EINTERN Eina_Bool   e_seat_pointer_is_empty(E_Seat *seat);
 
 #endif // E_SEAT_INTERN_H
index 6978b72727ba81acea26d15f27d88176bf099254..dabc9d8453b3df18d902ca954506836d137d327f 100644 (file)
@@ -46,6 +46,7 @@
 #include "e_devicemgr_wl_intern.h"
 #include "e_view_client_intern.h"
 #include "e_comp_wl_input_thread_intern.h"
+#include "e_seat_intern.h"
 
 #include <tizen-extension-server-protocol.h>
 #include <relative-pointer-unstable-v1-server-protocol.h>
@@ -86,12 +87,6 @@ struct _E_Comp_Data
 static Eina_Bool _e_comp_wl_cursor_timer_control(Evas_Callback_Type type, E_Comp_Wl_Data *comp_wl, E_Client *ec);
 static void      _e_comp_wl_surface_state_serial_update(E_Client *ec, E_Comp_Wl_Buffer *buffer);
 
-static void      _e_comp_wl_seat_pointer_send_axis(E_Seat *seat, struct wl_client *wc,
-                                                   uint32_t axis, uint32_t dir, uint32_t timestamp);
-
-static void      _e_comp_wl_seat_touch_send_cancel(E_Seat *seat, struct wl_client *wc, E_Client *ec);
-static void      _e_comp_wl_seat_touch_send_frame(E_Seat *seat, struct wl_client *wc);
-
 /* local variables */
 typedef struct _E_Comp_Wl_Key_Data
 {
@@ -810,7 +805,7 @@ _e_comp_wl_send_touch_cancel(E_Client *ec)
 
    wc = wl_resource_get_client(surface);
 
-   _e_comp_wl_seat_touch_send_cancel(NULL, wc, ec);
+   e_seat_touch_send_cancel(NULL, wc, ec);
 }
 
 static void
@@ -1068,7 +1063,7 @@ _e_comp_wl_cursor_reload(E_Comp_Wl_Data *comp_wl, E_Client *ec)
 
    wc = wl_resource_get_client(surface);
 
-   e_comp_wl_seat_pointer_send_enter(NULL, wc, ec, surface, cx, cy);
+   e_seat_pointer_send_enter(NULL, wc, ec, surface, cx, cy);
 
    wl_signal_emit(&comp_wl->ptr_constraints.surface_mousein_signal, ec);
 }
@@ -1352,11 +1347,11 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
           return;
      }
 
-   if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
+   if (e_seat_pointer_is_empty(NULL)) return;
 
    wc = wl_resource_get_client(surface);
    _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, ev->timestamp);
-   e_comp_wl_seat_pointer_send_enter(NULL, wc, ec, surface, ev->canvas.x - ec->client.x, ev->canvas.y - ec->client.y);
+   e_seat_pointer_send_enter(NULL, wc, ec, surface, ev->canvas.x - ec->client.x, ev->canvas.y - ec->client.y);
 
    wl_signal_emit(&comp_wl->ptr_constraints.surface_mousein_signal, ec);
 }
@@ -1399,11 +1394,11 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
           return;
      }
 
-   if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
+   if (e_seat_pointer_is_empty(NULL)) return;
 
    wc = wl_resource_get_client(surface);
    _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, ev->timestamp);
-   e_comp_wl_seat_pointer_send_leave(NULL, wc, ec, surface);
+   e_seat_pointer_send_leave(NULL, wc, ec, surface);
 
    wl_signal_emit(&comp_wl->ptr_constraints.surface_mouseout_signal, ec);
 }
@@ -1419,7 +1414,7 @@ _e_comp_wl_surface_send_touch(E_Comp_Wl_Data *comp_wl, struct wl_resource *surfa
    x = canvas_x - client_x;
    y = canvas_y - client_y;
 
-   e_comp_wl_seat_touch_send_downup(NULL, wc, surface, idx, x, y, timestamp, pressed);
+   e_seat_touch_send_downup(NULL, wc, surface, idx, x, y, timestamp, pressed);
 }
 
 static void
@@ -1471,7 +1466,7 @@ _e_comp_wl_send_touch_move(E_Comp_Wl_Data *comp_wl, E_Client *ec, int idx, int c
    x = canvas_x - ec->client.x;
    y = canvas_y - ec->client.y;
 
-   e_comp_wl_seat_touch_send_motion(NULL, wc, idx, x, y, timestamp);
+   e_seat_touch_send_motion(NULL, wc, idx, x, y, timestamp);
 
    e_comp_wl_touch_frame_send_ec_set(comp_wl, ec);
 }
@@ -1491,7 +1486,7 @@ _e_comp_wl_send_mouse_move(E_Comp_Wl_Data *comp_wl, E_Client *ec, int x, int y,
    sx = x - ec->client.x;
    sy = y - ec->client.y;
 
-   e_comp_wl_seat_pointer_send_motion(NULL, wc, sx, sy, timestamp);
+   e_seat_pointer_send_motion(NULL, wc, sx, sy, timestamp);
 }
 
 static void
@@ -1779,7 +1774,7 @@ e_comp_wl_surface_mouse_wheel_send(E_Comp_Wl_Data *comp_wl, struct wl_resource *
      dir = wl_fixed_from_int(z);
 
    wc = wl_resource_get_client(surface);
-   _e_comp_wl_seat_pointer_send_axis(NULL, wc, axis, dir, timestamp);
+   e_seat_pointer_send_axis(NULL, wc, axis, dir, timestamp);
 }
 
 static void
@@ -1808,7 +1803,7 @@ _e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *
 
    comp_wl = e_comp_wl_get();
 
-   if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
+   if (e_seat_pointer_is_empty(NULL)) return;
 
    if (_e_comp_wl_check_cursor_timer_needed(ec))
       {
@@ -1974,7 +1969,7 @@ _e_comp_wl_cb_touch_frame(void *data, int type, void *event)
 
    if (!(surface = e_comp_wl_client_surface_get(ec))) return ECORE_CALLBACK_PASS_ON;
    wc = wl_resource_get_client(surface);
-   _e_comp_wl_seat_touch_send_frame(NULL, wc);
+   e_seat_touch_send_frame(NULL, wc);
    e_comp_wl_touch_frame_send_ec_set(comp_wl, NULL);
 
    return ECORE_CALLBACK_PASS_ON;
@@ -4134,7 +4129,7 @@ e_comp_wl_surface_mouse_button_send(E_Comp_Wl_Data *comp_wl, struct wl_resource
    comp_wl->ptr.button = btn;
 
    wc = wl_resource_get_client(surface);
-   e_comp_wl_seat_pointer_send_button(NULL, wc, btn, state, timestamp);
+   e_seat_pointer_send_button(NULL, wc, btn, state, timestamp);
 }
 
 EINTERN Eina_Bool
@@ -4152,7 +4147,7 @@ e_comp_wl_evas_handle_mouse_button(E_Comp_Wl_Data *comp_wl, E_Client *ec, uint32
    struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
    if (!surface) return EINA_FALSE;
 
-   if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return EINA_FALSE;
+   if (e_seat_pointer_is_empty(NULL)) return EINA_FALSE;
 
    ELOGF("Mouse", "Button %s (btn: %d, time: %d)", ec, (state ? "Down" : "Up"), button_id, timestamp);
 
@@ -5074,7 +5069,7 @@ e_comp_wl_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t
    EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
    EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), EINA_FALSE);
 
-   if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return EINA_FALSE;
+   if (e_seat_pointer_is_empty(NULL)) return EINA_FALSE;
 
    wc = wl_resource_get_client(surface);
    serial = wl_display_next_serial(comp_wl->wl.disp);
@@ -5082,7 +5077,7 @@ e_comp_wl_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t
    if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial);
    else _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, time);
 
-   e_comp_wl_seat_pointer_send_enter(NULL, wc, ec, surface, x, y);
+   e_seat_pointer_send_enter(NULL, wc, ec, surface, x, y);
    wl_signal_emit(&comp_wl->ptr_constraints.surface_mousein_signal, ec);
 
    return EINA_TRUE;
@@ -5102,7 +5097,7 @@ e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time)
    EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EINA_FALSE);
    EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), EINA_FALSE);
 
-   if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return EINA_FALSE;
+   if (e_seat_pointer_is_empty(NULL)) return EINA_FALSE;
 
    wc = wl_resource_get_client(surface);
    serial = wl_display_next_serial(comp_wl->wl.disp);
@@ -5110,7 +5105,7 @@ e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time)
    if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial);
    else _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, time);
 
-   e_comp_wl_seat_pointer_send_leave(NULL, wc, ec, surface);
+   e_seat_pointer_send_leave(NULL, wc, ec, surface);
    wl_signal_emit(&comp_wl->ptr_constraints.surface_mouseout_signal, ec);
 
    return EINA_TRUE;
@@ -5192,7 +5187,7 @@ e_comp_wl_cursor_hide(E_Client *ec)
    EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EINA_FALSE);
 
    wc = wl_resource_get_client(surface);
-   e_comp_wl_seat_pointer_send_leave(NULL, wc, ec, surface);
+   e_seat_pointer_send_leave(NULL, wc, ec, surface);
 
    return EINA_TRUE;
 }
@@ -6222,360 +6217,3 @@ e_comp_wl_ptr_ec_get(void)
    return comp_wl->ptr.ec;
 }
 
-static void
-_e_comp_wl_seat_touch_send_cancel(E_Seat *seat, struct wl_client *wc, E_Client *ec)
-{
-   Eina_List *l, *ll;
-   struct wl_resource *res;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   E_Seat *s;
-
-   if (!seat) goto iterate;
-
-   EINA_LIST_FOREACH(seat->touch.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_touch_check(res)) continue;
-
-        ELOGF("Touch", "Cancel name:%20s", ec, ec ? e_client_util_name_get(ec) : "Unknown");
-
-        wl_touch_send_cancel(res);
-     }
-   return;
-
-iterate:
-   EINA_LIST_FOREACH(comp_wl->seats, l, s)
-     {
-        EINA_LIST_FOREACH(s->touch.resources, ll, res)
-          {
-             if (wl_resource_get_client(res) != wc) continue;
-             if (!e_comp_wl_input_touch_check(res)) continue;
-
-             ELOGF("Touch", "Cancel name:%20s", ec, ec ? e_client_util_name_get(ec) : "Unknown");
-
-             wl_touch_send_cancel(res);
-          }
-     }
-}
-
-static void
-_e_comp_wl_seat_touch_send_frame(E_Seat *seat, struct wl_client *wc)
-{
-   Eina_List *l, *ll;
-   struct wl_resource *res;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   E_Seat *s;
-
-   if (!seat) goto iterate;
-
-   EINA_LIST_FOREACH(seat->touch.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_touch_check(res)) continue;
-
-        wl_touch_send_frame(res);
-     }
-   return;
-
-iterate:
-   EINA_LIST_FOREACH(comp_wl->seats, l, s)
-   {
-     EINA_LIST_FOREACH(s->touch.resources, ll, res)
-       {
-           if (wl_resource_get_client(res) != wc) continue;
-           if (!e_comp_wl_input_touch_check(res)) continue;
-           wl_touch_send_frame(res);
-       }
-   }
-}
-
-EINTERN void
-e_comp_wl_seat_touch_send_downup(E_Seat *seat, struct wl_client *wc,
-                                  struct wl_resource *surface, int idx, int x, int y, uint32_t timestamp,
-                                  Eina_Bool pressed)
-{
-   Eina_List *l, *ll;
-   struct wl_resource *res;
-   uint32_t serial;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   E_Seat *s;
-
-   serial = wl_display_next_serial(comp_wl->wl.disp);
-
-   if (!seat) goto iterate;
-
-   EINA_LIST_FOREACH(seat->touch.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_touch_check(res)) continue;
-
-        TRACE_INPUT_BEGIN(e_comp_wl_seat_touch_send_downup);
-        if(pressed)
-          {
-             ELOGF("Touch", "Down (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
-             wl_touch_send_down(res, serial, timestamp, surface, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
-          }
-        else
-          {
-             ELOGF("Touch", "Up (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
-             wl_touch_send_up(res, serial, timestamp, idx);
-          }
-        TRACE_INPUT_END();
-     }
-   return;
-
-iterate:
-   EINA_LIST_FOREACH(comp_wl->seats, l, s)
-     {
-        EINA_LIST_FOREACH(s->touch.resources, ll, res)
-          {
-             if (wl_resource_get_client(res) != wc) continue;
-             if (!e_comp_wl_input_touch_check(res)) continue;
-
-             TRACE_INPUT_BEGIN(e_comp_wl_seat_touch_send_downup);
-             if (pressed)
-               {
-                  ELOGF("Touch", "Down (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
-                  wl_touch_send_down(res, serial, timestamp, surface, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
-               }
-             else
-               {
-                  ELOGF("Touch", "Up (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
-                  wl_touch_send_up(res, serial, timestamp, idx);
-               }
-             TRACE_INPUT_END();
-          }
-     }
-}
-
-EINTERN void
-e_comp_wl_seat_touch_send_motion(E_Seat *seat, struct wl_client *wc,
-                                 int idx, int x, int y, uint32_t timestamp)
-{
-   Eina_List *l, *ll;
-   struct wl_resource *res;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   E_Seat *s;
-
-   if (!seat) goto iterate;
-
-   EINA_LIST_FOREACH(seat->touch.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_touch_check(res)) continue;
-
-        wl_touch_send_motion(res, timestamp, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
-     }
-   return;
-
-iterate:
-   EINA_LIST_FOREACH(comp_wl->seats, l, s)
-     {
-        EINA_LIST_FOREACH(s->touch.resources, ll, res)
-          {
-             if (wl_resource_get_client(res) != wc) continue;
-             if (!e_comp_wl_input_touch_check(res)) continue;
-
-             wl_touch_send_motion(res, timestamp, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
-          }
-     }
-}
-
-EINTERN void
-e_comp_wl_seat_pointer_send_enter(E_Seat *seat, struct wl_client *wc, E_Client *ec,
-                                   struct wl_resource *surface, int x, int y)
-{
-   Eina_List *l, *ll;
-   struct wl_resource *res;
-   uint32_t serial;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   E_Seat *s;
-
-   serial = wl_display_next_serial(comp_wl->wl.disp);
-
-   if (!seat) goto iterate;
-
-   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_pointer_check(res)) continue;
-
-        wl_pointer_send_enter(res, serial, surface,
-                              wl_fixed_from_int(x), wl_fixed_from_int(y));
-
-        if (ec)
-          ec->pointer_enter_sent = EINA_TRUE;
-     }
-   return;
-
-iterate:
-   EINA_LIST_FOREACH(comp_wl->seats, l, s)
-     {
-        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
-          {
-             if (wl_resource_get_client(res) != wc) continue;
-             if (!e_comp_wl_input_pointer_check(res)) continue;
-
-             wl_pointer_send_enter(res, serial, surface,
-                                   wl_fixed_from_int(x), wl_fixed_from_int(y));
-
-             if (ec)
-               ec->pointer_enter_sent = EINA_TRUE;
-          }
-     }
-}
-
-EINTERN void
-e_comp_wl_seat_pointer_send_leave(E_Seat *seat, struct wl_client *wc, E_Client *ec,
-                                   struct wl_resource *surface)
-{
-   Eina_List *l, *ll;
-   struct wl_resource *res;
-   uint32_t serial;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   E_Seat *s;
-
-   serial = wl_display_next_serial(comp_wl->wl.disp);
-
-   if (!seat) goto iterate;
-
-   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_pointer_check(res)) continue;
-        if (ec && ec->pointer_enter_sent == EINA_FALSE) continue;
-
-        wl_pointer_send_leave(res, serial, surface);
-
-        if (ec)
-          ec->pointer_enter_sent = EINA_FALSE;
-     }
-   return;
-
-iterate:
-   EINA_LIST_FOREACH(comp_wl->seats, l, s)
-     {
-        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
-          {
-             if (wl_resource_get_client(res) != wc) continue;
-             if (!e_comp_wl_input_pointer_check(res)) continue;
-             if (ec && ec->pointer_enter_sent == EINA_FALSE) continue;
-
-             wl_pointer_send_leave(res, serial, surface);
-
-             if (ec)
-               ec->pointer_enter_sent = EINA_FALSE;
-          }
-     }
-}
-
-EINTERN void
-e_comp_wl_seat_pointer_send_motion(E_Seat *seat, struct wl_client *wc,
-                                   int x, int y, uint32_t timestamp)
-{
-   Eina_List *l, *ll;
-   struct wl_resource *res;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   E_Seat *s;
-
-   if (!seat) goto iterate;
-
-   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_pointer_check(res)) continue;
-
-        wl_pointer_send_motion(res, timestamp,
-                               wl_fixed_from_int(x),
-                               wl_fixed_from_int(y));
-     }
-   return;
-
-iterate:
-   EINA_LIST_FOREACH(comp_wl->seats, l, s)
-     {
-        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
-          {
-             if (wl_resource_get_client(res) != wc) continue;
-             if (!e_comp_wl_input_pointer_check(res)) continue;
-
-             wl_pointer_send_motion(res, timestamp,
-                                    wl_fixed_from_int(x),
-                                    wl_fixed_from_int(y));
-          }
-     }
-}
-
-EINTERN void
-e_comp_wl_seat_pointer_send_button(E_Seat *seat, struct wl_client *wc,
-                                   uint32_t button, uint32_t state, uint32_t timestamp)
-{
-   Eina_List *l, *ll;
-   struct wl_resource *res;
-   uint32_t serial;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   E_Seat *s;
-
-   serial = wl_display_next_serial(comp_wl->wl.disp);
-
-   if (!seat) goto iterate;
-
-   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_pointer_check(res)) continue;
-
-        TRACE_INPUT_BEGIN(e_comp_wl_surface_mouse_button);
-        ELOGF("Mouse", "Button %s (btn: %d, time: %d)", NULL, (state ? "Down" : "Up"), button, timestamp);
-        wl_pointer_send_button(res, serial, timestamp,
-                               button, state);
-        TRACE_INPUT_END();
-     }
-   return;
-
-iterate:
-   EINA_LIST_FOREACH(comp_wl->seats, l, s)
-     {
-        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
-          {
-             if (wl_resource_get_client(res) != wc) continue;
-             if (!e_comp_wl_input_pointer_check(res)) continue;
-
-             wl_pointer_send_button(res, serial, timestamp,
-                                    button, state);
-          }
-     }
-}
-
-static void
-_e_comp_wl_seat_pointer_send_axis(E_Seat *seat, struct wl_client *wc,
-                                  uint32_t axis, uint32_t dir, uint32_t timestamp)
-{
-   Eina_List *l, *ll;
-   struct wl_resource *res;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   E_Seat *s;
-
-   if (!seat) goto iterate;
-
-   EINA_LIST_FOREACH(seat->ptr.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_pointer_check(res)) continue;
-
-        wl_pointer_send_axis(res, timestamp, axis, dir);
-     }
-   return;
-
-iterate:
-   EINA_LIST_FOREACH(comp_wl->seats, l, s)
-     {
-        EINA_LIST_FOREACH(s->ptr.resources, ll, res)
-          {
-             if (wl_resource_get_client(res) != wc) continue;
-             if (!e_comp_wl_input_pointer_check(res)) continue;
-
-             wl_pointer_send_axis(res, timestamp, axis, dir);
-          }
-     }
-}
index c36fa8f1f87d58bbc0fc847b4c9c7eac7288219e..c9995d37f90aed14e89a7304bc67d1e6914e9f6b 100644 (file)
@@ -8,6 +8,7 @@
 #include "e_view_intern.h"
 #include "e_view_client_intern.h"
 #include "e_view_edje_intern.h"
+#include "e_seat_intern.h"
 
 #include <fcntl.h>
 #include <unistd.h>
@@ -1014,7 +1015,7 @@ _e_comp_wl_data_device_cb_drag_start(struct wl_client *client EINA_UNUSED, struc
      {
         wc = wl_resource_get_client(origin_resource);
         //TODO: consider multi-seat
-        e_comp_wl_seat_pointer_send_leave(NULL, wc, ec, e_comp_wl_client_surface_get(ec));
+        e_seat_pointer_send_leave(NULL, wc, ec, e_comp_wl_client_surface_get(ec));
      }
 
    evas_pointer_canvas_xy_get(e_comp_evas_get(), &x, &y);
index 68aa15a0da7548e3a91a30f6de17fdfac349b252..0fd439241ee31f82b92d9c4d1dad98d024c8b284 100644 (file)
@@ -11,6 +11,7 @@
 #include "e_policy_intern.h"
 #include "e_keyrouter_intern.h"
 #include "e_input_thread_client_intern.h"
+#include "e_seat_intern.h"
 
 #include <sys/mman.h>
 #include <fcntl.h>
@@ -87,31 +88,6 @@ _e_comp_wl_input_is_position_inside_constraint_region(E_Comp_Wl_Pointer_Constrai
                                                       wl_fixed_t fx,
                                                       wl_fixed_t fy);
 
-static void
-_e_comp_wl_input_update_seat_caps(E_Seat *seat, struct wl_client *wc)
-{
-   Eina_List *l;
-   struct wl_resource *res;
-   enum wl_seat_capability caps = 0;
-
-   if (!seat)
-     seat = e_comp_wl_input_seat_get("default");
-
-   if (seat->ptr.enabled)
-     caps |= WL_SEAT_CAPABILITY_POINTER;
-   if (e_comp_input_key->kbd.enabled)
-     caps |= WL_SEAT_CAPABILITY_KEYBOARD;
-   if (seat->touch.enabled)
-     caps |= WL_SEAT_CAPABILITY_TOUCH;
-
-   EINA_LIST_FOREACH(seat->resources, l, res)
-     {
-        /* if a wc is null, send seat capability to all wl_seat resources */
-        if (wc && (wl_resource_get_client(res) != wc)) continue;
-        wl_seat_send_capabilities(res, caps);
-     }
-}
-
 static void
 _e_comp_wl_input_pointer_map(struct wl_resource *resource)
 {
@@ -657,7 +633,7 @@ _e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data, uint32_t ver
                                   seat,
                                   _e_comp_wl_input_cb_unbind_seat);
 
-   _e_comp_wl_input_update_seat_caps(seat, client);
+   e_seat_update_seat_caps(seat, client);
    if (seat->version >= WL_SEAT_NAME_SINCE_VERSION)
      wl_seat_send_name(res, seat->name);
 }
@@ -1564,7 +1540,7 @@ _e_comp_wl_input_seat_init(const char *seat_name)
 {
    E_Seat *seat;
    E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   seat = e_comp_wl_input_seat_get(seat_name);
+   seat = e_seat_find(seat_name);
    if (seat) return EINA_FALSE;
 
    if (!(seat = E_NEW(E_Seat, 1))) return EINA_FALSE;
@@ -1889,15 +1865,6 @@ e_comp_wl_input_keyboard_state_update(uint32_t keycode, Eina_Bool pressed)
    e_comp_wl_input_keyboard_modifiers_update();
 }
 
-EINTERN void
-e_comp_wl_input_pointer_enabled_set(E_Seat *seat, Eina_Bool enabled)
-{
-   if (!seat) return;
-
-   seat->ptr.enabled = !!enabled;
-   _e_comp_wl_input_update_seat_caps(seat, NULL);
-}
-
 static void
 _e_comp_wl_input_thread_cb_keyboard_enabled_set(void *data)
 {
@@ -1921,7 +1888,7 @@ e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled)
      }
 
    e_input_backend_thread_safe_call(_e_comp_wl_input_thread_cb_keyboard_enabled_set, &enabled, sizeof(Eina_Bool));
-   _e_comp_wl_input_update_seat_caps(NULL, NULL);
+   e_seat_update_seat_caps(NULL, NULL);
 }
 
 E_API Eina_Bool
@@ -2178,22 +2145,13 @@ e_comp_wl_input_keymap_keycode_repeat_set(uint32_t keycode, Eina_Bool enable)
    g_rec_mutex_unlock(&e_comp_input_key->xkb.keymap_mutex);
 }
 
-EINTERN void
-e_comp_wl_input_touch_enabled_set(E_Seat *seat, Eina_Bool enabled)
-{
-   if (!seat) return;
-
-   seat->touch.enabled = !!enabled;
-   _e_comp_wl_input_update_seat_caps(seat, NULL);
-}
-
 EINTERN void
 e_comp_wl_input_seat_caps_set(unsigned int caps)
 {
    Eina_Bool need_update = EINA_FALSE;
    E_Seat *seat;
 
-   seat = e_comp_wl_input_seat_get("default");
+   seat = e_seat_find("default");
 
    if (caps & E_INPUT_SEAT_POINTER)
      seat->ptr.enabled = need_update = EINA_TRUE;
@@ -2203,7 +2161,7 @@ e_comp_wl_input_seat_caps_set(unsigned int caps)
      seat->touch.enabled = need_update = EINA_TRUE;
 
    if (need_update)
-     _e_comp_wl_input_update_seat_caps(seat, NULL);
+     e_seat_update_seat_caps(seat, NULL);
 }
 
 EINTERN Eina_Bool
@@ -2464,78 +2422,3 @@ e_comp_wl_input_kbd_resource_list_unlock()
   EINA_SAFETY_ON_NULL_RETURN(e_comp_input_key);
   g_rec_mutex_unlock(&e_comp_input_key->kbd.resources_mutex);
 }
-
-EINTERN E_Seat *
-e_comp_wl_input_seat_get(const char *name)
-{
-   Eina_List *l;
-   E_Seat *seat;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-
-   EINA_LIST_FOREACH(comp_wl->seats, l, seat)
-     {
-        if (seat->name && !strcmp(seat->name, name))
-          return seat;
-     }
-
-   return NULL;
-}
-
-EINTERN Eina_Bool
-e_comp_wl_input_seat_pointer_is_empty(E_Seat *seat)
-{
-   if (!seat) goto iterate;
-
-   if (!eina_list_count(seat->ptr.resources)) return EINA_TRUE;
-
-   return EINA_FALSE;
-
-iterate:
-   Eina_List *l;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   EINA_LIST_FOREACH(comp_wl->seats, l, seat)
-     {
-        if (eina_list_count(seat->ptr.resources))
-          return EINA_FALSE;
-     }
-   return EINA_TRUE;
-}
-
-EINTERN Eina_Bool
-e_comp_wl_input_seat_touch_is_empty(E_Seat *seat)
-{
-   if (!seat) goto iterate;
-
-   if (!eina_list_count(seat->ptr.resources)) return EINA_TRUE;
-
-   return EINA_FALSE;
-
-iterate:
-   Eina_List *l;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   EINA_LIST_FOREACH(comp_wl->seats, l, seat)
-     {
-        if (eina_list_count(seat->touch.resources))
-          return EINA_FALSE;
-     }
-   return EINA_TRUE;
-}
-
-EINTERN Eina_Bool
-e_comp_wl_input_seat_pointer_enabled_get(E_Seat *seat)
-{
-   if (!seat) goto iterate;
-
-   if (seat->ptr.enabled) return EINA_TRUE;
-
-   return EINA_FALSE;
-
-iterate:
-   Eina_List *l;
-   E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
-   EINA_LIST_FOREACH(comp_wl->seats, l, seat)
-     {
-        if (seat->ptr.enabled) return EINA_TRUE;
-     }
-   return EINA_FALSE;
-}
index 35da6417e5bd8e08b9940a919ea87c3ed272d1e4..436195e5909bd0034e4e184683aa4a5f6367e924 100644 (file)
@@ -11,10 +11,8 @@ EINTERN void      e_comp_wl_input_seat_caps_set(unsigned int caps);
 EINTERN Eina_Bool e_comp_wl_input_relative_pointer_check(struct wl_resource *res);
 
 EINTERN Eina_Bool e_comp_wl_input_pointer_check(struct wl_resource *res);
-EINTERN void e_comp_wl_input_pointer_enabled_set(E_Seat *seat, Eina_Bool enabled);
 
 EINTERN Eina_Bool e_comp_wl_input_touch_check(struct wl_resource *res);
-EINTERN void      e_comp_wl_input_touch_enabled_set(E_Seat *seat, Eina_Bool enabled);
 
 EINTERN Eina_Bool e_comp_wl_input_keyboard_check(struct wl_resource *res);
 EINTERN Eina_Bool e_comp_wl_input_keyboard_modifiers_serialize(void);
@@ -33,9 +31,4 @@ EINTERN void               e_comp_wl_input_keymap_keycode_repeat_set(uint32_t ke
 
 EINTERN void e_comp_wl_input_keymap_init(void);
 
-EINTERN E_Seat *e_comp_wl_input_seat_get(const char *name);
-EINTERN Eina_Bool       e_comp_wl_input_seat_pointer_is_empty(E_Seat *seat);
-EINTERN Eina_Bool       e_comp_wl_input_seat_touch_is_empty(E_Seat *seat);
-EINTERN Eina_Bool       e_comp_wl_input_seat_pointer_enabled_get(E_Seat *seat);
-
 #endif
index 0a26408a50ebc681d5a33452a985c118c716b612..1ae13615bf3f00b3eae3b11dbd39d749a4f4393d 100644 (file)
@@ -7,6 +7,7 @@
 #include "e_input_thread_client.h"
 #include "e_pointer_intern.h"
 #include "e_input_backend_intern.h"
+#include "e_seat_intern.h"
 
 #include <tizen-extension-server-protocol.h>
 
@@ -160,10 +161,10 @@ _e_comp_wl_input_thread_send_mouse_in(E_Seat *seat, E_Input_Thread_Client *iec,
          NULL, timestamp, x, y, x, y,
          e_input_thread_client_util_name_get(iec));
 
-   if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
+   if (e_seat_pointer_is_empty(NULL)) return;
 
    wc = wl_resource_get_client(surface);
-   e_comp_wl_seat_pointer_send_enter(seat, wc, NULL, surface, x - client_x, y - client_y);
+   e_seat_pointer_send_enter(seat, wc, NULL, surface, x - client_x, y - client_y);
    e_input_thread_client_pointer_enter_sent_set(iec, EINA_TRUE);
 }
 
@@ -182,10 +183,10 @@ _e_comp_wl_input_thread_send_mouse_out(E_Seat *seat, E_Input_Thread_Client *iec,
          NULL, timestamp,
          e_input_thread_client_util_name_get(iec));
 
-   if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
+   if (e_seat_pointer_is_empty(NULL)) return;
 
    wc = wl_resource_get_client(surface);
-   e_comp_wl_seat_pointer_send_leave(seat, wc, NULL, surface);
+   e_seat_pointer_send_leave(seat, wc, NULL, surface);
    e_input_thread_client_pointer_enter_sent_set(iec, EINA_FALSE);
 }
 
@@ -247,7 +248,7 @@ _e_comp_wl_cb_mouse_move_thread_mode(void *d EINA_UNUSED, int t EINA_UNUSED, voi
    dev_name = e_device_name_get(dev);
    dev_class = e_device_class_get(dev);
    seat_name = e_device_seatname_get(dev);
-   seat = e_comp_wl_input_seat_get(seat_name);
+   seat = e_seat_find(seat_name);
 
    if (comp_conf && comp_conf->input_log_enable)
      ELOGF("Mouse", "Move (time: %d, x:%d, y:%d), (name:%20s) (dev:%s, class:%d, seat:%s)",
@@ -282,7 +283,7 @@ _e_comp_wl_cb_mouse_move_thread_mode(void *d EINA_UNUSED, int t EINA_UNUSED, voi
                   _e_comp_wl_device_input_thread_send_event_device(iec, dev, ev->timestamp);
 
                   wc = wl_resource_get_client(surface);
-                  e_comp_wl_seat_touch_send_motion(seat, wc, 0, ev->x - client_x, ev->y - client_y, ev->timestamp);
+                  e_seat_touch_send_motion(seat, wc, 0, ev->x - client_x, ev->y - client_y, ev->timestamp);
                }
           }
 
@@ -295,7 +296,7 @@ _e_comp_wl_cb_mouse_move_thread_mode(void *d EINA_UNUSED, int t EINA_UNUSED, voi
              _e_comp_wl_device_input_thread_send_event_device(iec, dev, ev->timestamp);
 
              wc = wl_resource_get_client(surface);
-             e_comp_wl_seat_pointer_send_motion(seat, wc, ev->x - client_x, ev->y - client_y, ev->timestamp);
+             e_seat_pointer_send_motion(seat, wc, ev->x - client_x, ev->y - client_y, ev->timestamp);
           }
 
         e_pointer_mouse_move(e_comp_pointer_get(), ev->x, ev->y);
@@ -356,7 +357,7 @@ _e_comp_wl_cb_mouse_button_down_thread_mode(void *d EINA_UNUSED, int t EINA_UNUS
    dev_name = e_device_name_get(dev);
    dev_class = e_device_class_get(dev);
    seat_name = e_device_seatname_get(dev);
-   seat = e_comp_wl_input_seat_get(seat_name);
+   seat = e_seat_find(seat_name);
 
    ELOGF("Mouse", "Down (button: %d, time: %d, x:%d, y:%d) (name:%20s) (dev:%s, class:%d, seat:%s)",
          NULL, ev->buttons, ev->timestamp, ev->x, ev->y,
@@ -378,7 +379,7 @@ _e_comp_wl_cb_mouse_button_down_thread_mode(void *d EINA_UNUSED, int t EINA_UNUS
 
         comp_wl->ptr.button = BTN_LEFT;
         wc = wl_resource_get_client(surface);
-        e_comp_wl_seat_touch_send_downup(seat, wc, surface, 0, ev->x - client_x, ev->y - client_y, ev->timestamp, EINA_TRUE);
+        e_seat_touch_send_downup(seat, wc, surface, 0, ev->x - client_x, ev->y - client_y, ev->timestamp, EINA_TRUE);
 
         e_pointer_touch_move(e_comp_pointer_get(), ev->x, ev->y);
 
@@ -389,7 +390,7 @@ _e_comp_wl_cb_mouse_button_down_thread_mode(void *d EINA_UNUSED, int t EINA_UNUS
         btn = _e_comp_wl_input_thread_button_convert(ev->buttons);
         comp_wl->ptr.button = btn;
         wc = wl_resource_get_client(surface);
-        e_comp_wl_seat_pointer_send_button(seat, wc, btn, WL_POINTER_BUTTON_STATE_PRESSED, ev->timestamp);
+        e_seat_pointer_send_button(seat, wc, btn, WL_POINTER_BUTTON_STATE_PRESSED, ev->timestamp);
 
         e_pointer_mouse_move(e_comp_pointer_get(), ev->x, ev->y);
      }
@@ -428,7 +429,7 @@ _e_comp_wl_cb_mouse_button_up_thread_mode(void *d EINA_UNUSED, int t EINA_UNUSED
    dev_name = e_device_name_get(dev);
    dev_class = e_device_class_get(dev);
    seat_name = e_device_seatname_get(dev);
-   seat = e_comp_wl_input_seat_get(seat_name);
+   seat = e_seat_find(seat_name);
 
    comp_wl = e_comp_wl_get();
    if (dev && (dev_class == ECORE_DEVICE_CLASS_TOUCH))
@@ -469,14 +470,14 @@ _e_comp_wl_cb_mouse_button_up_thread_mode(void *d EINA_UNUSED, int t EINA_UNUSED
                                                surface, 0, ev->x, ev->y, ev->multi.pressure, ev->multi.angle);
         comp_wl->ptr.button = BTN_LEFT;
         wc = wl_resource_get_client(surface);
-        e_comp_wl_seat_touch_send_downup(seat, wc, surface, 0, ev->x - client_x, ev->y - client_y, ev->timestamp, EINA_FALSE);
+        e_seat_touch_send_downup(seat, wc, surface, 0, ev->x - client_x, ev->y - client_y, ev->timestamp, EINA_FALSE);
      }
    else
      {
         btn = _e_comp_wl_input_thread_button_convert(ev->buttons);
         comp_wl->ptr.button = btn;
         wc = wl_resource_get_client(surface);
-        e_comp_wl_seat_pointer_send_button(seat, wc, btn, WL_POINTER_BUTTON_STATE_RELEASED, ev->timestamp);
+        e_seat_pointer_send_button(seat, wc, btn, WL_POINTER_BUTTON_STATE_RELEASED, ev->timestamp);
 
      }
 
@@ -507,7 +508,7 @@ _e_comp_wl_cb_mouse_wheel_thread_mode(void *d EINA_UNUSED, int t EINA_UNUSED, vo
 
    comp_wl = e_comp_wl_get();
 
-   if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return ECORE_CALLBACK_RENEW;
+   if (e_seat_pointer_is_empty(NULL)) return ECORE_CALLBACK_RENEW;
 
    if (e_input_backend_mouse_printing_needed())
      e_input_backend_mouse_timestamp_append(ev->timestamp);
index 67ded8de3321df629caf9e9def690ccd73841228..cf90ac027fa54ce745298f8f0d7c906c85d11ff1 100644 (file)
@@ -113,18 +113,4 @@ EINTERN void      e_comp_wl_surface_handle_mouse_button_to_touch(E_Comp_Wl_Data
 EINTERN E_Devicemgr_Input_Device *e_comp_wl_device_last_device_get(Ecore_Device_Class dev_class);
 EINTERN void      e_comp_wl_device_last_device_set(Ecore_Device_Class dev_class, E_Devicemgr_Input_Device *device);
 
-EINTERN void      e_comp_wl_seat_touch_send_motion(E_Seat *seat, struct wl_client *wc,
-                                                   int idx, int x, int y, uint32_t timestamp);
-EINTERN void      e_comp_wl_seat_touch_send_downup(E_Seat *seat, struct wl_client *wc,
-                                                   struct wl_resource *surface, int idx, int x, int y, uint32_t timestamp,
-                                                   Eina_Bool pressed);
-
-EINTERN void      e_comp_wl_seat_pointer_send_motion(E_Seat *seat, struct wl_client *wc,
-                                                     int x, int y, unsigned int timestamp);
-EINTERN void      e_comp_wl_seat_pointer_send_enter(E_Seat *seat, struct wl_client *wc, E_Client *ec,
-                                                    struct wl_resource *surface, int x, int y);
-EINTERN void      e_comp_wl_seat_pointer_send_leave(E_Seat *seat, struct wl_client *wc, E_Client *ec,
-                                                    struct wl_resource *surface);
-EINTERN void      e_comp_wl_seat_pointer_send_button(E_Seat *seat, struct wl_client *wc,
-                                                     uint32_t button, uint32_t state, uint32_t timestamp);
 #endif
index 57a61b5321f84215a9a5603292e114534f28c071..bc4ba5f587f31ebfbb9078348ff19d5f55664977 100644 (file)
@@ -7,6 +7,7 @@
 #include "e_privilege_intern.h"
 #include "e_security.h"
 #include "e_input_log.h"
+#include "e_seat_intern.h"
 
 #include <tizen-extension-server-protocol.h>
 
@@ -179,7 +180,7 @@ e_devicemgr_wl_device_add(E_Devicemgr_Input_Device *dev)
    E_Comp_Wl_Data *comp_wl;
    E_Seat *seat;
 
-   seat = e_comp_wl_input_seat_get(dev->seat_name);
+   seat = e_seat_find(dev->seat_name);
    if (!seat)
      {
         DMERR("Could not find seat by seat_name(%s)", dev->seat_name);
@@ -768,7 +769,7 @@ _e_devicemgr_wl_cb_bind(struct wl_client *client, void *data, uint32_t version,
              g_rec_mutex_lock(&e_devicemgr->device_list_mutex);
              EINA_LIST_FOREACH(e_devicemgr->device_list, ll, dev)
                {
-                  seat = e_comp_wl_input_seat_get(dev->seat_name);
+                  seat = e_seat_find(dev->seat_name);
                   if (!seat)
                     {
                       DMWRN("Could not find seat by seat_name(%s)", dev->seat_name);
index 2b9d4ce5447e046359db950deacf353326ef7389..08373724e34ef9d2c9059e1cd07b37c719da2b3e 100644 (file)
@@ -9,6 +9,7 @@
 #include "e_view_client_intern.h"
 #include "e_output_intern.h"
 #include "e_canvas_intern.h"
+#include "e_seat_intern.h"
 
 /* local variables */
 static Eina_List *_ptrs = NULL;
@@ -463,7 +464,7 @@ e_pointer_view_set(E_Pointer *ptr, E_View_Client *view_client, int x, int y)
    EINA_SAFETY_ON_NULL_RETURN(ptr);
 
    /* don't show cursor if in hidden mode */
-   if ((!e_config->show_cursor) || (!e_comp_wl_input_seat_pointer_enabled_get(NULL)))
+   if ((!e_config->show_cursor) || (!e_seat_pointer_enabled_get(NULL)))
      {
         if (ptr->view_client && _e_pointer_view_hide(ptr, ptr->view_client))
           _e_pointer_hook_call(E_POINTER_HOOK_HIDE, ptr);