e_devicemgr: send touch max slot count to client 55/250255/5
authorjeon <jhyuni.kang@samsung.com>
Tue, 22 Dec 2020 10:00:12 +0000 (19:00 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Wed, 13 Jan 2021 08:35:11 +0000 (08:35 +0000)
Change-Id: I04555cc88b4840376ec666f97692aa65440db8ed

src/bin/e_devicemgr_input.c
src/bin/e_devicemgr_private.h
src/bin/e_devicemgr_wl.c

index eb55f75..cbc3afb 100644 (file)
@@ -204,10 +204,6 @@ _e_devicemgr_input_device_add(const char *name, const char *identifier, const ch
 
    e_devicemgr->device_list = eina_list_append(e_devicemgr->device_list, dev);
 
-   e_devicemgr_wl_device_add(dev);
-   e_devicemgr_inputgen_get_device_info(dev);
-   _e_devicemgr_detent_set_info(dev);
-
    if (dev->clas == ECORE_DEVICE_CLASS_MOUSE)
      e_devicemgr->last_device_ptr = dev;
 
@@ -230,11 +226,17 @@ _e_devicemgr_input_device_add(const char *name, const char *identifier, const ch
 
              if (!e_devicemgr->multi)
                ELOGF("DEVMGR_TOUCH", "Failed to allocate memory for multi ptr. (finger=%d)\n", NULL, current_touch_count);
+
+             e_devicemgr_wl_touch_max_count_send(e_devicemgr->max_touch_count, NULL, NULL);
           }
      }
 
    if (!e_devicemgr->last_device_kbd && dev->clas == ECORE_DEVICE_CLASS_KEYBOARD)
      e_devicemgr->last_device_kbd = dev;
+
+   e_devicemgr_wl_device_add(dev);
+   e_devicemgr_inputgen_get_device_info(dev);
+   _e_devicemgr_detent_set_info(dev);
 }
 
 static void
index bbaba75..afc29b5 100644 (file)
@@ -176,3 +176,5 @@ void e_devicemgr_wl_detent_send_event(int detent);
 Eina_Bool e_devicemgr_input_init(void);
 void e_devicemgr_input_shutdown(void);
 
+void e_devicemgr_wl_touch_max_count_send(int slot, struct wl_resource *res, struct wl_resource *seat_res);
+
index cf980ff..b6616bd 100644 (file)
@@ -255,6 +255,38 @@ e_devicemgr_wl_block_send_expired(struct wl_resource *resource)
    tizen_input_device_manager_send_block_expired(resource);
 }
 
+void
+e_devicemgr_wl_touch_max_count_send(int slot, struct wl_resource *res, struct wl_resource *seat_res)
+{
+   struct wl_resource *seat_resource, *dev_mgr_resource;
+   Eina_List *l, *ll;
+   uint32_t serial;
+   struct wl_client *wc;
+
+   serial = wl_display_next_serial(e_comp_wl->wl.disp);
+
+   if (res && seat_res)
+     {
+        if (wl_resource_get_version(res) < 4) return;
+        tizen_input_device_manager_send_max_touch_count(res, serial, slot, seat_res);
+     }
+   else
+     {
+        EINA_LIST_FOREACH(e_comp_wl->seat.resources, l, seat_resource)
+          {
+             wc = wl_resource_get_client(seat_resource);
+
+             EINA_LIST_FOREACH(e_devicemgr->wl_data->resources, ll, dev_mgr_resource)
+               {
+                  if (wl_resource_get_client(dev_mgr_resource) != wc) continue;
+                  if (wl_resource_get_version(dev_mgr_resource) < 4) continue;
+                  tizen_input_device_manager_send_max_touch_count(dev_mgr_resource, serial, slot, seat_resource);
+               }
+          }
+     }
+}
+
+
 static void
 _e_devicemgr_wl_cb_block_events(struct wl_client *client, struct wl_resource *resource, uint32_t serial, uint32_t clas, uint32_t duration)
 {
@@ -496,6 +528,11 @@ _e_devicemgr_wl_cb_bind(struct wl_client *client, void *data, uint32_t version,
         wl_array_init(&axes);
         serial = wl_display_next_serial(e_comp_wl->wl.disp);
 
+        if (e_devicemgr->max_touch_count > 0)
+          {
+             e_devicemgr_wl_touch_max_count_send(e_devicemgr->max_touch_count, res, seat_res);
+          }
+
         EINA_LIST_FOREACH(e_devicemgr->device_list, l, dev)
           {
              device_res = wl_resource_create(client, &tizen_input_device_interface, 1, 0);
@@ -538,7 +575,7 @@ e_devicemgr_wl_init(void)
 
    /* try to add tizen_input_device_manager to wayland globals */
    e_devicemgr->wl_data->global = wl_global_create(e_comp_wl->wl.disp,
-                                                   &tizen_input_device_manager_interface, 3,
+                                                   &tizen_input_device_manager_interface, 4,
                                                    NULL, _e_devicemgr_wl_cb_bind);
    if (!e_devicemgr->wl_data->global)
      {