Support wl_touch and send wl_touch events to client 09/39509/2 accepted/tizen/common/20150518.075039 accepted/tizen/mobile/20150518.145318 accepted/tizen/tv/20150518.144523 accepted/tizen/wearable/20150519.003205 submit/tizen/20150518.072652
authorjhyuni.kang <jhyuni.kang@samsung.com>
Mon, 18 May 2015 04:01:14 +0000 (13:01 +0900)
committerjhyuni.kang <jhyuni.kang@samsung.com>
Mon, 18 May 2015 06:08:07 +0000 (15:08 +0900)
Change-Id: I74614146b8256dcdac46c380dfcf1f2b601c3ecf

src/bin/e_comp_wl.c
src/bin/e_comp_wl_input.c
src/bin/e_comp_wl_input.h
src/modules/wl_drm/e_mod_main.c
src/modules/wl_x11/e_mod_main.c

index 51d1075391e08fd7b696326d532962f1b4e8fba9..dd21e2bedc8293d909ae9b6dc1203b03d56f8075 100644 (file)
@@ -547,6 +547,82 @@ _e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *
      }
 }
 
+static void
+_e_comp_wl_evas_cb_multi_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
+{
+   Eina_List *l;
+   struct wl_client *wc;
+   uint32_t serial;
+   struct wl_resource *res;
+   E_Client *ec = data;
+   Evas_Event_Multi_Down *ev = event;
+   wl_fixed_t x, y;
+
+   if (!ec->comp_data->surface) return;
+
+   wc = wl_resource_get_client(ec->comp_data->surface);
+   serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp);
+
+   x = wl_fixed_from_int(ev->canvas.x - ec->client.x);
+   y = wl_fixed_from_int(ev->canvas.y - ec->client.y);
+
+   EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_touch_check(res)) continue;
+        wl_touch_send_down(res, serial, ev->timestamp, ec->comp_data->surface, ev->device, x, y);
+     }
+}
+
+static void
+_e_comp_wl_evas_cb_multi_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
+{
+   Eina_List *l;
+   struct wl_client *wc;
+   uint32_t serial;
+   struct wl_resource *res;
+   E_Client *ec = data;
+   Evas_Event_Multi_Up *ev = event;
+
+   if (!ec->comp_data->surface) return;
+
+   wc = wl_resource_get_client(ec->comp_data->surface);
+   serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp);
+
+   EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_touch_check(res)) continue;
+        wl_touch_send_up(res, serial, ev->timestamp, ev->device);
+     }
+}
+
+static void
+_e_comp_wl_evas_cb_multi_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
+{
+   Eina_List *l;
+   struct wl_client *wc;
+   struct wl_resource *res;
+   E_Client *ec = data;
+   Evas_Event_Multi_Move *ev = event;
+   wl_fixed_t x, y;
+
+   if (!ec->comp_data->surface) return;
+
+   wc = wl_resource_get_client(ec->comp_data->surface);
+
+   x = wl_fixed_from_int(ev->cur.canvas.x - ec->client.x);
+   y = wl_fixed_from_int(ev->cur.canvas.y - ec->client.y);
+
+   EINA_LIST_FOREACH(e_comp->wl_comp_data->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, ev->timestamp, ev->device, x, y);
+     }
+}
+
+
 static void
 _e_comp_wl_client_priority_adjust(int pid, int set, int adj, Eina_Bool use_adj, Eina_Bool adj_child, Eina_Bool do_child)
 {
@@ -901,6 +977,13 @@ _e_comp_wl_client_evas_init(E_Client *ec)
    evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOUSE_WHEEL,
                                   _e_comp_wl_evas_cb_mouse_wheel, ec);
 
+   evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MULTI_DOWN, EVAS_CALLBACK_PRIORITY_AFTER,
+                                  _e_comp_wl_evas_cb_multi_down, ec);
+   evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MULTI_UP, EVAS_CALLBACK_PRIORITY_AFTER,
+                                  _e_comp_wl_evas_cb_multi_up, ec);
+   evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MULTI_MOVE, EVAS_CALLBACK_PRIORITY_AFTER,
+                                  _e_comp_wl_evas_cb_multi_move, ec);
+
    evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_FOCUS_IN,
                                   _e_comp_wl_evas_cb_focus_in, ec);
    evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_FOCUS_OUT,
@@ -3016,8 +3099,9 @@ _e_comp_wl_compositor_create(void)
 
    if (comp->comp_type == E_PIXMAP_TYPE_X)
      {
-        e_comp_wl_input_pointer_enabled_set(cdata, EINA_TRUE);
-        e_comp_wl_input_keyboard_enabled_set(cdata, EINA_TRUE);
+        e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
+        e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
+        e_comp_wl_input_touch_enabled_set(EINA_TRUE);
      }
 
    return EINA_TRUE;
index 87338a7558c84e9e55e2cacf44c71aaafc243a2f..d8c9c062a125c714a4cb1912ebf35f8126b3bef7 100644 (file)
@@ -3,7 +3,7 @@
 #include "e.h"
 #include <sys/mman.h>
 
-static void 
+static void
 _e_comp_wl_input_update_seat_caps(E_Comp_Data *cdata)
 {
    Eina_List *l;
@@ -21,13 +21,13 @@ _e_comp_wl_input_update_seat_caps(E_Comp_Data *cdata)
         wl_seat_send_capabilities(res, caps);
 }
 
-static void 
+static void
 _e_comp_wl_input_cb_resource_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
 {
    wl_resource_destroy(resource);
 }
 
-static void 
+static void
 _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resource *resource EINA_UNUSED, uint32_t serial EINA_UNUSED, struct wl_resource *surface_resource, int32_t x, int32_t y)
 {
    E_Comp_Data *cdata;
@@ -81,18 +81,24 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
    e_pointer_object_set(e_comp->pointer, ec->frame, x, y);
 }
 
-static const struct wl_pointer_interface _e_pointer_interface = 
+static const struct wl_pointer_interface _e_pointer_interface =
 {
    _e_comp_wl_input_pointer_cb_cursor_set,
    _e_comp_wl_input_cb_resource_destroy
 };
 
-static const struct wl_keyboard_interface _e_keyboard_interface = 
+static const struct wl_keyboard_interface _e_keyboard_interface =
 {
    _e_comp_wl_input_cb_resource_destroy
 };
 
-static void 
+static const struct wl_touch_interface _e_touch_interface =
+{
+   _e_comp_wl_input_cb_resource_destroy
+};
+
+
+static void
 _e_comp_wl_input_cb_pointer_unbind(struct wl_resource *resource)
 {
    E_Comp_Data *cdata;
@@ -103,7 +109,7 @@ _e_comp_wl_input_cb_pointer_unbind(struct wl_resource *resource)
    cdata->ptr.resources = eina_list_remove(cdata->ptr.resources, resource);
 }
 
-static void 
+static void
 _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *resource, uint32_t id)
 {
    E_Comp_Data *cdata;
@@ -116,7 +122,7 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re
    if (!(cdata = wl_resource_get_user_data(resource))) return;
 
    /* try to create pointer resource */
-   res = wl_resource_create(client, &wl_pointer_interface, 
+   res = wl_resource_create(client, &wl_pointer_interface,
                             wl_resource_get_version(resource), id);
    if (!res)
      {
@@ -126,7 +132,7 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re
      }
 
    cdata->ptr.resources = eina_list_append(cdata->ptr.resources, res);
-   wl_resource_set_implementation(res, &_e_pointer_interface, cdata, 
+   wl_resource_set_implementation(res, &_e_pointer_interface, cdata,
                                  _e_comp_wl_input_cb_pointer_unbind);
 
    if (!(ec = e_client_focused_get())) return;
@@ -142,7 +148,7 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re
                          wl_fixed_from_int(cx), wl_fixed_from_int(cy));
 }
 
-static void 
+static void
 _e_comp_wl_input_cb_keyboard_unbind(struct wl_resource *resource)
 {
    E_Comp_Data *cdata;
@@ -153,7 +159,7 @@ _e_comp_wl_input_cb_keyboard_unbind(struct wl_resource *resource)
    cdata->kbd.resources = eina_list_remove(cdata->kbd.resources, resource);
 }
 
-static void 
+static void
 _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *resource, uint32_t id)
 {
    E_Comp_Data *cdata;
@@ -167,7 +173,7 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r
    if (!(cdata = wl_resource_get_user_data(resource))) return;
 
    /* try to create keyboard resource */
-   res = wl_resource_create(client, &wl_keyboard_interface, 
+   res = wl_resource_create(client, &wl_keyboard_interface,
                             wl_resource_get_version(resource), id);
    if (!res)
      {
@@ -177,11 +183,11 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r
      }
 
    cdata->kbd.resources = eina_list_append(cdata->kbd.resources, res);
-   wl_resource_set_implementation(res, &_e_keyboard_interface, cdata, 
+   wl_resource_set_implementation(res, &_e_keyboard_interface, cdata,
                                   _e_comp_wl_input_cb_keyboard_unbind);
 
    /* send current keymap */
-   wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, 
+   wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
                            cdata->xkb.fd, cdata->xkb.size);
 
    /* if client has focus, send keyboard enter */
@@ -211,27 +217,49 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r
      }
 }
 
-static void 
-_e_comp_wl_input_cb_touch_get(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t id EINA_UNUSED)
+static void
+_e_comp_wl_input_cb_touch_unbind(struct wl_resource *resource)
 {
    E_Comp_Data *cdata;
 
-   /* DBG("Input Touch Get"); */
-
-   /* NB: Needs new resource !! */
-
    /* get compositor data */
    if (!(cdata = wl_resource_get_user_data(resource))) return;
+
+   cdata->touch.resources = eina_list_remove(cdata->touch.resources, resource);
 }
 
-static const struct wl_seat_interface _e_seat_interface = 
+static void
+_e_comp_wl_input_cb_touch_get(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t id EINA_UNUSED)
+{
+    E_Comp_Data *cdata;
+    struct wl_resource *res;
+
+    /* get compositor data */
+    if (!(cdata = wl_resource_get_user_data(resource))) return;
+
+    /* try to create pointer resource */
+    res = wl_resource_create(client, &wl_touch_interface,
+                             wl_resource_get_version(resource), id);
+    if (!res)
+      {
+         ERR("Could not create touch on seat %s: %m", cdata->seat.name);
+         wl_client_post_no_memory(client);
+         return;
+      }
+
+    cdata->touch.resources = eina_list_append(cdata->touch.resources, res);
+    wl_resource_set_implementation(res, &_e_touch_interface, cdata,
+                                  _e_comp_wl_input_cb_touch_unbind);
+}
+
+static const struct wl_seat_interface _e_seat_interface =
 {
    _e_comp_wl_input_cb_pointer_get,
    _e_comp_wl_input_cb_keyboard_get,
    _e_comp_wl_input_cb_touch_get,
 };
 
-static void 
+static void
 _e_comp_wl_input_cb_unbind_seat(struct wl_resource *resource)
 {
    E_Comp_Data *cdata;
@@ -241,7 +269,7 @@ _e_comp_wl_input_cb_unbind_seat(struct wl_resource *resource)
    cdata->seat.resources = eina_list_remove(cdata->seat.resources, resource);
 }
 
-static void 
+static void
 _e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
 {
    E_Comp_Data *cdata;
@@ -250,7 +278,7 @@ _e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data, uint32_t ver
    /* try to create the seat resource */
    cdata = data;
    res = wl_resource_create(client, &wl_seat_interface, MIN(version, 4), id);
-   if (!res) 
+   if (!res)
      {
         ERR("Could not create seat resource: %m");
         return;
@@ -260,15 +288,15 @@ _e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data, uint32_t ver
    cdata->seat.version = version;
    cdata->seat.resources = eina_list_append(cdata->seat.resources, res);
 
-   wl_resource_set_implementation(res, &_e_seat_interface, cdata, 
+   wl_resource_set_implementation(res, &_e_seat_interface, cdata,
                                   _e_comp_wl_input_cb_unbind_seat);
 
    _e_comp_wl_input_update_seat_caps(cdata);
-   if (cdata->seat.version >= WL_SEAT_NAME_SINCE_VERSION) 
+   if (cdata->seat.version >= WL_SEAT_NAME_SINCE_VERSION)
      wl_seat_send_name(res, cdata->seat.name);
 }
 
-static int 
+static int
 _e_comp_wl_input_keymap_fd_get(off_t size)
 {
    int fd = 0, blen = 0, len = 0;
@@ -315,7 +343,7 @@ _e_comp_wl_input_keymap_fd_get(off_t size)
    return fd;
 }
 
-static void 
+static void
 _e_comp_wl_input_keymap_update(E_Comp_Data *cdata, struct xkb_keymap *keymap)
 {
    char *tmp;
@@ -332,14 +360,14 @@ _e_comp_wl_input_keymap_update(E_Comp_Data *cdata, struct xkb_keymap *keymap)
    if (cdata->xkb.fd >= 0) close(cdata->xkb.fd);
 
    /* unreference any existing keyboard state */
-   if (cdata->xkb.state) 
+   if (cdata->xkb.state)
      {
-        latched = 
+        latched =
           xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_MODS_LATCHED);
-        locked = 
+        locked =
           xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_MODS_LOCKED);
-        group = 
-          xkb_state_serialize_layout(cdata->xkb.state, 
+        group =
+          xkb_state_serialize_layout(cdata->xkb.state,
                                      XKB_STATE_LAYOUT_EFFECTIVE);
         xkb_state_unref(cdata->xkb.state);
      }
@@ -374,8 +402,8 @@ _e_comp_wl_input_keymap_update(E_Comp_Data *cdata, struct xkb_keymap *keymap)
         return;
      }
 
-   cdata->xkb.area = 
-     mmap(NULL, cdata->xkb.size, (PROT_READ | PROT_WRITE), 
+   cdata->xkb.area =
+     mmap(NULL, cdata->xkb.size, (PROT_READ | PROT_WRITE),
           MAP_SHARED, cdata->xkb.fd, 0);
    if (cdata->xkb.area == MAP_FAILED)
      {
@@ -388,7 +416,7 @@ _e_comp_wl_input_keymap_update(E_Comp_Data *cdata, struct xkb_keymap *keymap)
 
    /* send updated keymap */
    EINA_LIST_FOREACH(cdata->kbd.resources, l, res)
-     wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, 
+     wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
                              cdata->xkb.fd, cdata->xkb.size);
 
    /* update modifiers */
@@ -399,16 +427,16 @@ _e_comp_wl_input_keymap_update(E_Comp_Data *cdata, struct xkb_keymap *keymap)
    /* send modifiers */
    serial = wl_display_get_serial(cdata->wl.disp);
    EINA_LIST_FOREACH(cdata->kbd.resources, l, res)
-     wl_keyboard_send_modifiers(res, serial, cdata->kbd.mod_depressed, 
-                                cdata->kbd.mod_latched, cdata->kbd.mod_locked, 
+     wl_keyboard_send_modifiers(res, serial, cdata->kbd.mod_depressed,
+                                cdata->kbd.mod_latched, cdata->kbd.mod_locked,
                                 cdata->kbd.mod_group);
 }
 
-EINTERN Eina_Bool 
+EINTERN Eina_Bool
 e_comp_wl_input_init(E_Comp_Data *cdata)
 {
    /* check for valid compositor data */
-   if (!cdata) 
+   if (!cdata)
      {
         ERR("No compositor data");
         return EINA_FALSE;
@@ -420,10 +448,10 @@ e_comp_wl_input_init(E_Comp_Data *cdata)
    cdata->xkb.fd = -1;
 
    /* create the global resource for input seat */
-   cdata->seat.global = 
-     wl_global_create(cdata->wl.disp, &wl_seat_interface, 4, 
+   cdata->seat.global =
+     wl_global_create(cdata->wl.disp, &wl_seat_interface, 4,
                       cdata, _e_comp_wl_input_cb_bind_seat);
-   if (!cdata->seat.global) 
+   if (!cdata->seat.global)
      {
         ERR("Could not create global for seat: %m");
         return EINA_FALSE;
@@ -434,13 +462,13 @@ e_comp_wl_input_init(E_Comp_Data *cdata)
    return EINA_TRUE;
 }
 
-EINTERN void 
+EINTERN void
 e_comp_wl_input_shutdown(E_Comp_Data *cdata)
 {
    struct wl_resource *res;
 
    /* check for valid compositor data */
-   if (!cdata) 
+   if (!cdata)
      {
         ERR("No compositor data");
         return;
@@ -479,46 +507,46 @@ e_comp_wl_input_shutdown(E_Comp_Data *cdata)
    cdata->seat.global = NULL;
 }
 
-EINTERN Eina_Bool 
+EINTERN Eina_Bool
 e_comp_wl_input_pointer_check(struct wl_resource *res)
 {
-   return wl_resource_instance_of(res, &wl_pointer_interface, 
+   return wl_resource_instance_of(res, &wl_pointer_interface,
                                   &_e_pointer_interface);
 }
 
-EINTERN Eina_Bool 
+EINTERN Eina_Bool
 e_comp_wl_input_keyboard_check(struct wl_resource *res)
 {
-   return wl_resource_instance_of(res, &wl_keyboard_interface, 
+   return wl_resource_instance_of(res, &wl_keyboard_interface,
                                   &_e_keyboard_interface);
 }
 
-EINTERN void 
+EINTERN void
 e_comp_wl_input_keyboard_modifiers_update(E_Comp_Data *cdata)
 {
    uint32_t serial;
    struct wl_resource *res;
    Eina_List *l;
 
-   cdata->kbd.mod_depressed = 
+   cdata->kbd.mod_depressed =
      xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_DEPRESSED);
-   cdata->kbd.mod_latched = 
+   cdata->kbd.mod_latched =
      xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_MODS_LATCHED);
-   cdata->kbd.mod_locked = 
+   cdata->kbd.mod_locked =
      xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_MODS_LOCKED);
-   cdata->kbd.mod_group = 
+   cdata->kbd.mod_group =
      xkb_state_serialize_layout(cdata->xkb.state, XKB_STATE_LAYOUT_EFFECTIVE);
 
    serial = wl_display_next_serial(cdata->wl.disp);
    EINA_LIST_FOREACH(cdata->kbd.resources, l, res)
-     wl_keyboard_send_modifiers(res, serial, 
-                                cdata->kbd.mod_depressed, 
-                                cdata->kbd.mod_latched, 
-                                cdata->kbd.mod_locked, 
+     wl_keyboard_send_modifiers(res, serial,
+                                cdata->kbd.mod_depressed,
+                                cdata->kbd.mod_latched,
+                                cdata->kbd.mod_locked,
                                 cdata->kbd.mod_group);
 }
 
-EINTERN void 
+EINTERN void
 e_comp_wl_input_keyboard_state_update(E_Comp_Data *cdata, uint32_t keycode, Eina_Bool pressed)
 {
    enum xkb_key_direction dir;
@@ -528,46 +556,46 @@ e_comp_wl_input_keyboard_state_update(E_Comp_Data *cdata, uint32_t keycode, Eina
    if (pressed) dir = XKB_KEY_DOWN;
    else dir = XKB_KEY_UP;
 
-   cdata->kbd.mod_changed = 
+   cdata->kbd.mod_changed =
      xkb_state_update_key(cdata->xkb.state, keycode + 8, dir);
 }
 
-EAPI void 
-e_comp_wl_input_pointer_enabled_set(E_Comp_Data *cdata, Eina_Bool enabled)
+EAPI void
+e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled)
 {
    /* check for valid compositor data */
-   if (!cdata) 
+   if (!e_comp->wl_comp_data)
      {
         ERR("No compositor data");
         return;
      }
 
-   cdata->ptr.enabled = enabled;
-   _e_comp_wl_input_update_seat_caps(cdata);
+   e_comp->wl_comp_data->ptr.enabled = !!enabled;
+   _e_comp_wl_input_update_seat_caps(e_comp->wl_comp_data);
 }
 
-EAPI void 
-e_comp_wl_input_keyboard_enabled_set(E_Comp_Data *cdata, Eina_Bool enabled)
+EAPI void
+e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled)
 {
    /* check for valid compositor data */
-   if (!cdata) 
+   if (!e_comp->wl_comp_data)
      {
         ERR("No compositor data");
         return;
      }
 
-   cdata->kbd.enabled = enabled;
-   _e_comp_wl_input_update_seat_caps(cdata);
+   e_comp->wl_comp_data->kbd.enabled = !!enabled;
+   _e_comp_wl_input_update_seat_caps(e_comp->wl_comp_data);
 }
 
-EAPI void 
+EAPI void
 e_comp_wl_input_keymap_set(E_Comp_Data *cdata, const char *rules, const char *model, const char *layout)
 {
    struct xkb_keymap *keymap;
    struct xkb_rule_names names;
 
    /* check for valid compositor data */
-   if (!cdata) 
+   if (!cdata)
      {
         ERR("No compositor data");
         return;
@@ -598,3 +626,24 @@ e_comp_wl_input_keymap_set(E_Comp_Data *cdata, const char *rules, const char *mo
    free((char *)names.model);
    free((char *)names.layout);
 }
+
+EAPI void
+e_comp_wl_input_touch_enabled_set(Eina_Bool enabled)
+{
+   /* check for valid compositor data */
+   if (!e_comp->wl_comp_data)
+     {
+        ERR("No compositor data");
+        return;
+     }
+
+   e_comp->wl_comp_data->touch.enabled = !!enabled;
+   _e_comp_wl_input_update_seat_caps(e_comp->wl_comp_data);
+}
+
+EINTERN Eina_Bool
+e_comp_wl_input_touch_check(struct wl_resource *res)
+{
+   return wl_resource_instance_of(res, &wl_touch_interface,
+                                  &_e_touch_interface);
+}
index 9c0000c9ae13b5f179b2e8fc8bb0259d9dab0fee..f859e1f5258012d6abd04853da0e6fd3423fc78f 100644 (file)
@@ -7,12 +7,14 @@ EINTERN Eina_Bool e_comp_wl_input_init(E_Comp_Data *cdata);
 EINTERN void e_comp_wl_input_shutdown(E_Comp_Data *cdata);
 EINTERN Eina_Bool e_comp_wl_input_pointer_check(struct wl_resource *res);
 EINTERN Eina_Bool e_comp_wl_input_keyboard_check(struct wl_resource *res);
+EINTERN Eina_Bool e_comp_wl_input_touch_check(struct wl_resource *res);
 
 EINTERN void e_comp_wl_input_keyboard_modifiers_update(E_Comp_Data *cdata);
 EINTERN void e_comp_wl_input_keyboard_state_update(E_Comp_Data *cdata, uint32_t keycode, Eina_Bool pressed);
 
-EAPI void e_comp_wl_input_pointer_enabled_set(E_Comp_Data *cdata, Eina_Bool enabled);
-EAPI void e_comp_wl_input_keyboard_enabled_set(E_Comp_Data *cdata, Eina_Bool enabled);
+EAPI void e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled);
+EAPI void e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled);
+EAPI void e_comp_wl_input_touch_enabled_set(Eina_Bool enabled);
 
 EAPI void e_comp_wl_input_keymap_set(E_Comp_Data *cdata, const char *rules, const char *model, const char *layout);
 
index 711772bc99553fb33f689c7e7453aeece7c787c7..692eb3651a41178d3da900e66e18d8f17322fca8 100644 (file)
@@ -65,8 +65,8 @@ _e_mod_drm_cb_output(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
    if (!e->plug) goto end;
 
    snprintf(buff, sizeof(buff), "%d", e->id);
-   e_comp_wl_output_init(buff, e->make, e->model, e->x, e->y, e->w, e->h, 
-                         e->phys_width, e->phys_height, e->refresh, 
+   e_comp_wl_output_init(buff, e->make, e->model, e->x, e->y, e->w, e->h,
+                         e->phys_width, e->phys_height, e->refresh,
                          e->subpixel_order, e->transform);
 
 end:
@@ -181,8 +181,9 @@ e_modapi_init(E_Module *m)
    /* NB: This needs to be called AFTER the comp canvas has been setup */
    if (!e_comp_wl_init()) return NULL;
 
-   e_comp_wl_input_pointer_enabled_set(comp->wl_comp_data, EINA_TRUE);
-   e_comp_wl_input_keyboard_enabled_set(comp->wl_comp_data, EINA_TRUE);
+   e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
+   e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
+   e_comp_wl_input_touch_enabled_set(EINA_TRUE);
 
    /* comp->pointer =  */
    /*   e_pointer_window_new(ecore_evas_window_get(comp->ee), 1); */
index 40c66df02521e385119fc56e8f771ecd9f76756a..6845cc7b8b550c9e9819d04307ececb9df22a4fb 100644 (file)
@@ -11,7 +11,7 @@ _cb_delete_request(Ecore_Evas *ee EINA_UNUSED)
    ecore_main_loop_quit();
 }
 
-static Eina_Bool 
+static Eina_Bool
 _cb_keymap_changed(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
 {
    E_Comp_Data *cdata;
@@ -36,7 +36,7 @@ _cb_keymap_changed(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
    /* NB: we need a 'rules' so fetch from X atoms */
    root = ecore_x_window_root_first_get();
    xkb = ecore_x_atom_get("_XKB_RULES_NAMES");
-   ecore_x_window_prop_property_get(root, xkb, ECORE_X_ATOM_STRING, 
+   ecore_x_window_prop_property_get(root, xkb, ECORE_X_ATOM_STRING,
                                     1024, &dat, &len);
    if ((dat) && (len > 0))
      {
@@ -106,12 +106,13 @@ e_modapi_init(E_Module *m)
    if (!e_comp_canvas_init(comp)) return NULL;
    e_comp_canvas_fake_layers_init(comp);
 
-   /* NB: This needs to be called AFTER comp_canvas has been setup as it 
+   /* NB: This needs to be called AFTER comp_canvas has been setup as it
     * makes reference to the comp->evas */
    if (!e_comp_wl_init()) return NULL;
 
-   e_comp_wl_input_pointer_enabled_set(comp->wl_comp_data, EINA_TRUE);
-   e_comp_wl_input_keyboard_enabled_set(comp->wl_comp_data, EINA_TRUE);
+   e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
+   e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
+   e_comp_wl_input_touch_enabled_set(EINA_TRUE);
 
    /* comp->pointer =  */
    /*   e_pointer_window_new(ecore_evas_window_get(comp->ee), EINA_TRUE); */
@@ -122,14 +123,14 @@ e_modapi_init(E_Module *m)
    _cb_keymap_changed(comp->wl_comp_data, 0, NULL);
 
    /* setup keymap_change event handler */
-   kbd_hdlr = 
-     ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, 
+   kbd_hdlr =
+     ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY,
                              _cb_keymap_changed, comp->wl_comp_data);
 
    return m;
 }
 
-EAPI int 
+EAPI int
 e_modapi_shutdown(E_Module *m EINA_UNUSED)
 {
    /* delete handler for keymap change */