devicemgr: implement input generator (pointer & touch) 27/278227/1
authorduna.oh <duna.oh@samsung.com>
Tue, 28 Jun 2022 04:59:10 +0000 (13:59 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 18 Jul 2022 05:59:02 +0000 (14:59 +0900)
Change-Id: Ia27ed1fd2baa29db0df19ee2b3e18cb7d020cad7

clients/input-generator.c
examples/tinyds-tdm-libinput.c
include/libds-tizen/input-devicemgr.h
src/input-devicemgr/input-devicemgr.c
src/input-devicemgr/input-devicemgr.h

index f61e84b..73b7ab4 100644 (file)
@@ -19,10 +19,10 @@ enum enum_key_type
 
 enum enum_touch_type
 {
-    TOUCH_BEGIN = 0,
-    TOUCH_UPDATE,
-    TOUCH_END,
-    TOUCH_ALL
+    POINTER_BEGIN = 0,
+    POINTER_UPDATE,
+    POINTER_END,
+    POINTER_ALL
 };
 
 struct display
@@ -60,8 +60,7 @@ usage(void)
     printf("init {device type}\n");
     printf("  : device type:\n");
     printf("    - default: all\n");
-    printf("    - key/keyboard: keyboard\n");
-    printf("    - touch: touch screen\n");
+    printf("    - keyboard / touch / mouse\n");
     printf("    - all: all of devices\n");
     printf("  : ex> init keyboard / init\n");
     printf("\n");
@@ -78,15 +77,33 @@ usage(void)
     printf("touch {index} {type} {x} {y}\n");
     printf("  : index:\n");
     printf("    - default: first finger(0)\n");
-    printf("    - first finger is 0\n");
     printf("  : type:\n");
     printf("    - default: generate sample touch events\n");
-    printf("    - touch begin: 1\n");
-    printf("    - touch update: 2\n");
-    printf("    - touch end: 3\n");
+    printf("    - touch down: 0\n");
+    printf("    - touch move: 1\n");
+    printf("    - touch up: 2\n");
     printf("  : x/y:\n");
     printf("    - default: 0\n");
-    printf("  : ex> touch / touch 0 1 100 100\n");
+    printf("  : ex> touch\n");
+    printf("  : ex> touch 0 0 400 400\n");
+    printf("  :     touch 0 1 410 410\n");
+    printf("  :     touch 0 2 0 0\n");
+    printf("mouse {button} {type} {x} {y}\n");
+    printf("  : button:\n");
+    printf("    - default: left button(1)\n");
+    printf("  : type:\n");
+    printf("    - default: generate sample mouse events\n");
+    printf("    - button down: 0\n");
+    printf("    - mouse move: 1\n");
+    printf("    - button up: 2\n");
+    printf("  : x/y:\n");
+    printf("    - default: 0\n");
+    printf("    - relative motion\n");
+    printf("  : ex> mouse\n");
+    printf("  : ex> mouse 1 0 0 0\n");
+    printf("  :     mouse 1 1 10 10\n");
+    printf("  :     mouse 1 1 -10 -10\n");
+    printf("  :     mouse 1 2 0 0\n");
     printf("\n");
 }
 
@@ -162,7 +179,7 @@ key_generate(char *name, int type)
     printf("name: %s, type: %d\n", name, type);
 
     if (!data_wl.init) {
-        printf("Input genrator is not initialized\n");
+        printf("Input generator is not initialized\n");
         return;
     }
 
@@ -180,7 +197,7 @@ key_generate(char *name, int type)
 }
 
 static char *
-touch_type_string_get(int type)
+type_string_get(int type)
 {
     switch (type) {
         case TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN:
@@ -204,10 +221,10 @@ input_generator_touch(int idx, int type, int x, int y)
 
     if (data_wl.request_notified == TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE) {
         if (data_wl.enable_log) {
-            printf("Success to generate touch: %d finger %s on (%d, %d)\n", idx, touch_type_string_get(type), x, y);
+            printf("Success to generate touch: %d finger %s on (%d, %d)\n", idx, type_string_get(type), x, y);
         }
     } else {
-        printf("Failed to generate touch(%d finger %s on (%d, %d)): %d\n", idx, touch_type_string_get(type), x, y, data_wl.request_notified);
+        printf("Failed to generate touch(%d finger %s on (%d, %d)): %d\n", idx, type_string_get(type), x, y, data_wl.request_notified);
     }
 
     data_wl.request_notified = -1;
@@ -217,38 +234,77 @@ static void
 touch_generate(int idx, int type, int x, int y)
 {
     if (!data_wl.init) {
-        printf("Input genrator is not initialized\n");
+        printf("Input generator is not initialized\n");
         return;
     }
 
-    if (type == TOUCH_ALL) {
-        input_generator_touch(0, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN, 100, 100);
-        input_generator_touch(1, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN, 200, 200);
-        input_generator_touch(2, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN, 300, 300);
+    if (type == POINTER_ALL) {
+        input_generator_touch(0, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN, 300, 300);
+        input_generator_touch(1, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN, 400, 400);
+        input_generator_touch(2, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN, 500, 500);
 
-        input_generator_touch(0, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 110, 110);
-        input_generator_touch(1, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 210, 210);
-        input_generator_touch(2, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 310, 310);
+        input_generator_touch(0, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 310, 310);
+        input_generator_touch(1, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 410, 410);
+        input_generator_touch(2, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 510, 510);
 
-        input_generator_touch(0, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 120, 120);
-        input_generator_touch(1, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 220, 220);
-        input_generator_touch(2, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 320, 320);
+        input_generator_touch(0, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 320, 320);
+        input_generator_touch(1, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 420, 420);
+        input_generator_touch(2, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 520, 520);
 
-        input_generator_touch(0, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END, 120, 120);
-        input_generator_touch(1, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END, 220, 220);
-        input_generator_touch(2, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END, 320, 320);
+        input_generator_touch(0, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END, 320, 320);
+        input_generator_touch(1, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END, 420, 420);
+        input_generator_touch(2, TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END, 520, 520);
     } else {
         input_generator_touch(idx, type, x, y);
     }
 }
 
 static void
+input_generator_mouse(int type, int x, int y, int button)
+{
+    tizen_input_device_manager_generate_pointer(data_wl.devicemgr, type, x, y, button);
+
+    while (data_wl.request_notified == -1)
+        wl_display_dispatch_queue(data_wl.display, data_wl.queue);
+
+    if (data_wl.request_notified == TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE) {
+        if (data_wl.enable_log) {
+            printf("Success to generate mouse: %s on (%d, %d)\n", type_string_get(type), x, y);
+        }
+    } else {
+        printf("Failed to generate mouse(%s on (%d, %d)): %d\n", type_string_get(type), x, y, data_wl.request_notified);
+    }
+
+    data_wl.request_notified = -1;
+}
+
+static void
+mouse_generate(int btn, int type, int x, int y)
+{
+    if (!data_wl.init) {
+        printf("Input generator is not initialized\n");
+        return;
+    }
+
+    if (type == POINTER_ALL) {
+        input_generator_mouse(TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN, -1, -1, 1);
+        input_generator_mouse(TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 10, 10, 1);
+        input_generator_mouse(TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 10, 10, 1);
+        input_generator_mouse(TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE, 10, 10, 1);
+        input_generator_mouse(TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END, -1, -1, 1);
+
+    } else {
+        input_generator_mouse(type, x, y, btn);
+    }
+}
+
+static void
 stdin_read(void)
 {
     int c;
     char buf[MAX_STR] = {0, }, *tmp, *buf_ptr, key_name[MAX_STR] = {0, };
     int count = 0;
-    int key_type = KEY_ALL, touch_idx = 0, touch_type = TOUCH_ALL, touch_x = 0, touch_y = 0;
+    int key_type = KEY_ALL, idx = 0, type = POINTER_ALL, x = 0, y = 0;
 
     while ((c = getchar()) != EOF) {
         if (c == '\n') break;
@@ -272,6 +328,8 @@ stdin_read(void)
                             init_input_generator(TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD);
                         else if (!strncmp("touch", tmp, MAX_STR-1))
                             init_input_generator(TIZEN_INPUT_DEVICE_MANAGER_CLAS_TOUCHSCREEN);
+                        else if (!strncmp("mouse", tmp, MAX_STR-1))
+                            init_input_generator(TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE);
                         break;
                     default:
                         break;
@@ -305,16 +363,40 @@ stdin_read(void)
             if (tmp) {
                 switch (count) {
                     case 0:
-                        touch_idx = atoi(tmp);
+                        idx = atoi(tmp);
+                        break;
+                    case 1:
+                        type = atoi(tmp);
+                        break;
+                    case 2:
+                        x = atoi(tmp);
+                        break;
+                    case 3:
+                        y = atoi(tmp);
+                        break;
+                    default:
+                        break;
+                }
+            }
+            count++;
+        }
+        touch_generate(idx, type, x, y);
+    } else if (!strncmp(tmp, "mouse", sizeof("mouse"))) {
+        while (tmp) {
+            tmp = strtok_r(NULL, " ", &buf_ptr);
+            if (tmp) {
+                switch (count) {
+                    case 0:
+                        idx = atoi(tmp);
                         break;
                     case 1:
-                        touch_type = atoi(tmp);
+                        type = atoi(tmp);
                         break;
                     case 2:
-                        touch_x = atoi(tmp);
+                        x = atoi(tmp);
                         break;
                     case 3:
-                        touch_y = atoi(tmp);
+                        y = atoi(tmp);
                         break;
                     default:
                         break;
@@ -322,7 +404,7 @@ stdin_read(void)
             }
             count++;
         }
-        touch_generate(touch_idx, touch_type, touch_x, touch_y);
+        mouse_generate(idx, type, x, y);
     } else if (!strncmp(buf, "q", MAX_STR) || !strncmp(buf, "quit", MAX_STR)) {
         data_wl.run = 0;
     } else if (!strncmp(buf, "help", MAX_STR)) {
index 5634707..3feb932 100644 (file)
@@ -352,6 +352,8 @@ backend_handle_new_output(struct wl_listener *listener, void *data)
     output->output_frame.notify = output_handle_frame;
     ds_output_add_frame_listener(ds_output, &output->output_frame);
 
+    ds_tizen_input_devicemgr_set_output_width_height(server->devicemgr, (uint32_t)output->width, (uint32_t)output->height);
+
     server->output = output;
 
     draw_output(output);
index a9ed808..fc1060e 100644 (file)
@@ -33,6 +33,10 @@ ds_tizen_input_devicemgr_set_keymap_list(
         struct ds_tizen_input_devicemgr *devicemgr,
         struct wl_list *list);
 
+bool
+ds_tizen_input_devicemgr_set_output_width_height(
+        struct ds_tizen_input_devicemgr *devicemgr,
+        uint32_t width, uint32_t height);
 #ifdef __cplusplus
 }
 #endif
index 3e69d0e..c825b4c 100644 (file)
@@ -5,6 +5,8 @@
 #include <libds-tizen/input-devicemgr.h>
 #include <libds/interfaces/backend.h>
 #include <libds/interfaces/keyboard.h>
+#include <libds/interfaces/pointer.h>
+#include <libds/interfaces/touch.h>
 
 #include "util.h"
 #include "input-devicemgr.h"
@@ -12,6 +14,7 @@
 #define TIZEN_INPUT_DEVICEMGR_VERSION 4
 #define TIZEN_PRIV_INPUT_GENERATOR "http://tizen.org/privilege/inputgenerator"
 #define TIZEN_PRIV_INPUT_BLOCK "http://tizen.org/privilege/internal/inputdevice.block"
+#define TIZEN_INPUT_DEVICEMGR_MAX_BTN 16
 
 static const struct ds_keyboard_grab_interface devicemgr_keyboard_grab_iface;
 
@@ -52,6 +55,14 @@ device_manager_handle_generate_key(struct wl_client *client,
         struct wl_resource *resource,
         const char *keyname, uint32_t pressed);
 static void
+device_manager_handle_generate_touch(struct wl_client *client,
+        struct wl_resource *resource, uint32_t type, uint32_t x, uint32_t y,
+        uint32_t finger);
+static void
+device_manager_handle_generate_pointer(struct wl_client *client,
+        struct wl_resource *resource, uint32_t type, uint32_t x, uint32_t y,
+        uint32_t button);
+static void
 device_manager_handle_destroy(struct wl_client *client,
         struct wl_resource *resource);
 
@@ -59,7 +70,7 @@ device_manager_handle_destroy(struct wl_client *client,
 static void tz_devicemgr_destroy(struct ds_tizen_input_devicemgr *tz_devicemgr);
 static int
 tz_devicemgr_init_generator(struct ds_tizen_input_devicemgr *tz_devicemgr,
-        struct wl_resource *resource, const char *name);
+        struct wl_resource *resource, uint32_t clas, const char *name);
 static int
 tz_devicemgr_deinit_generator(struct ds_tizen_input_devicemgr *tz_devicemgr,
         struct wl_resource *resource);
@@ -77,6 +88,19 @@ static int
 tz_devicemgr_keyname_to_keycode(struct wl_list *list, const char *name);
 
 static bool
+tz_devicemgr_generate_touch_move(struct ds_input_device *device, double x, double y,
+        uint32_t finger);
+static bool
+tz_devicemgr_generate_touch_down(struct ds_input_device *device, double x, double y,
+        uint32_t finger);
+static bool
+tz_devicemgr_generate_touch_up(struct ds_input_device *device, uint32_t finger);
+static bool
+tz_devicemgr_generate_mouse_move(struct ds_input_device *device, double x, double y);
+static bool
+tz_devicemgr_generate_mouse_button(struct ds_input_device *device, uint32_t button, bool state);
+
+static bool
 tz_devicemgr_check_privilege(struct ds_tizen_input_devicemgr *tz_devicemgr,
         struct wl_client *client, const char *rule);
 
@@ -125,6 +149,17 @@ ds_tizen_input_devicemgr_create(struct ds_backend *backend,
     if (!tz_devicemgr->devices.kbd) {
         goto err_kbd;
     }
+    tz_devicemgr->devices.ptr = calloc(1,
+            sizeof(struct ds_tizen_input_devicemgr_device));
+    if (!tz_devicemgr->devices.ptr) {
+        goto err_ptr;
+    }
+    tz_devicemgr->devices.touch = calloc(1,
+            sizeof(struct ds_tizen_input_devicemgr_device));
+    if (!tz_devicemgr->devices.touch) {
+        goto err_touch;
+    }
+    tz_devicemgr->touch_max_count = 5;//TODO: make this variable configurable
 
     tz_devicemgr->grab = ds_seat_create_keyboard_grab(
             tz_devicemgr->seat, &devicemgr_keyboard_grab_iface, tz_devicemgr);
@@ -134,7 +169,7 @@ ds_tizen_input_devicemgr_create(struct ds_backend *backend,
 
     wl_signal_init(&tz_devicemgr->events.destroy);
     wl_list_init(&tz_devicemgr->clients);
-    wl_list_init(&tz_devicemgr->pressed_keys);
+    wl_list_init(&tz_devicemgr->devices.kbd->key.pressed);
     wl_list_init(&tz_devicemgr->keymap_list);
     wl_list_init(&tz_devicemgr->blocked_keys);
 
@@ -146,6 +181,10 @@ ds_tizen_input_devicemgr_create(struct ds_backend *backend,
     return tz_devicemgr;
 
 err_grab:
+    free(tz_devicemgr->devices.touch);
+err_touch:
+    free(tz_devicemgr->devices.ptr);
+err_ptr:
     free(tz_devicemgr->devices.kbd);
 err_kbd:
     wl_global_destroy(tz_devicemgr->global);
@@ -192,6 +231,21 @@ ds_tizen_input_devicemgr_set_keymap_list(
     return true;
 }
 
+WL_EXPORT bool
+ds_tizen_input_devicemgr_set_output_width_height(
+        struct ds_tizen_input_devicemgr *tz_devicemgr,
+        uint32_t width, uint32_t height)
+{
+    if (!tz_devicemgr) return false;
+
+    tz_devicemgr->output.width = width;
+    tz_devicemgr->output.height = height;
+
+    ds_inf("output's width: %d, height:%d", width, height);
+
+    return true;
+}
+
 static void
 tz_devicemgr_destroy(struct ds_tizen_input_devicemgr *tz_devicemgr)
 {
@@ -219,6 +273,8 @@ tz_devicemgr_destroy(struct ds_tizen_input_devicemgr *tz_devicemgr)
         free(client_data);
     }
 
+    free(tz_devicemgr->devices.touch);
+    free(tz_devicemgr->devices.ptr);
     free(tz_devicemgr->devices.kbd);
     free(tz_devicemgr);
 }
@@ -248,6 +304,14 @@ seat_handle_destroy(struct wl_listener *listener, void *data)
 }
 
 static void
+tz_devicemgr_device_close(struct ds_tizen_input_devicemgr_device *dev)
+{
+    if (!dev->input_device) return;
+    ds_input_device_destroy(dev->input_device);
+    dev->input_device = NULL;
+}
+
+static void
 backend_handle_input_device_add(struct wl_listener *listener, void *data)
 {
     struct ds_input_device *dev = data;
@@ -259,14 +323,18 @@ backend_handle_input_device_add(struct wl_listener *listener, void *data)
     dev_type = ds_input_device_get_type(dev);
     if (dev_type == DS_INPUT_DEVICE_KEYBOARD) {
         if (tz_devicemgr->devices.kbd->input_device) return;
-        ds_inf("devicemgr's kbd device is set");
+        ds_inf("devicemgr's kbd device is set to dev(%p)", dev);
         tz_devicemgr->devices.kbd->input_device = dev;
     }
     else if (dev_type == DS_INPUT_DEVICE_POINTER) {
-        //TODO: assign input_device 'dev' to devices.ptr
+        if (tz_devicemgr->devices.ptr->input_device) return;
+        ds_inf("devicemgr's ptr device is set to dev(%p)", dev);
+        tz_devicemgr->devices.ptr->input_device = dev;
     }
     else if (dev_type == DS_INPUT_DEVICE_TOUCH) {
-        //TODO: assign input_device 'dev' to devices.ptr
+        if (tz_devicemgr->devices.touch->input_device) return;
+        ds_inf("devicemgr's touch device is set to dev(%p)", dev);
+        tz_devicemgr->devices.touch->input_device = dev;
     }
 }
 
@@ -276,8 +344,8 @@ static const struct tizen_input_device_manager_interface _devicemgr_impl = {
     .init_generator = device_manager_handle_init_generator,
     .deinit_generator = device_manager_handle_deinit_generator,
     .generate_key = device_manager_handle_generate_key,
-    .generate_pointer = NULL,
-    .generate_touch = NULL,
+    .generate_pointer = device_manager_handle_generate_pointer,
+    .generate_touch = device_manager_handle_generate_touch,
     .pointer_warp = NULL,
     .init_generator_with_name =
             device_manager_handle_init_generator_with_name, // v2
@@ -359,13 +427,7 @@ device_manager_handle_init_generator(struct wl_client *client,
         goto finish;
     }
 
-    if (clas != TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD) {
-        ds_err("only support keyboard device. (requested: 0x%x)\n", clas);
-        ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER;
-        goto finish;
-    }
-
-    ret = tz_devicemgr_init_generator(tz_devicemgr, resource,
+    ret = tz_devicemgr_init_generator(tz_devicemgr, resource, clas,
             "Input Generator");
     if (ret != TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE) {
         ds_err("Failed to init input generator\n");
@@ -398,13 +460,7 @@ device_manager_handle_init_generator_with_name(struct wl_client *client,
         goto finish;
     }
 
-    if (clas != TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD) {
-        ds_err("only support keyboard device. (requested: 0x%x)\n", clas);
-        ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER;
-        goto finish;
-    }
-
-    ret = tz_devicemgr_init_generator(tz_devicemgr, resource,
+    ret = tz_devicemgr_init_generator(tz_devicemgr, resource, clas,
             name);
     if (ret != TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE) {
         ds_err("Failed to init input generator\n");
@@ -417,7 +473,7 @@ finish:
 
 static void
 device_manager_handle_deinit_generator(struct wl_client *client,
-        struct wl_resource *resource, uint32_t clas)
+        struct wl_resource *resource, uint32_t clas __attribute__((unused)))
 {
     struct ds_tizen_input_devicemgr *tz_devicemgr;
     int ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_SYSTEM_RESOURCES;
@@ -431,12 +487,6 @@ device_manager_handle_deinit_generator(struct wl_client *client,
         goto finish;
     }
 
-    if (clas != TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD) {
-        ds_err("only support keyboard device. (requested: 0x%x)\n", clas);
-        ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER;
-        goto finish;
-    }
-
     ret = tz_devicemgr_deinit_generator(tz_devicemgr, resource);
     if (ret != TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE) {
         ds_err("Failed to deinit input generator\n");
@@ -498,6 +548,19 @@ tz_devicemgr_xkb_keyname_to_keycode(struct xkb_keymap *keymap,
     return keycode;
 }
 
+static uint32_t
+tz_devicemgr_client_get_device_clas(struct ds_tizen_input_devicemgr *tz_devicemgr,
+        struct wl_resource *resource)
+{
+    struct ds_tizen_input_devicemgr_client *client_data;
+
+    wl_list_for_each(client_data, &tz_devicemgr->clients, link) {
+        if (client_data->resource == resource)
+            return client_data->clas;
+    }
+    return 0;
+}
+
 static void
 device_manager_handle_generate_key(struct wl_client *client,
         struct wl_resource *resource, const char *keyname, uint32_t pressed)
@@ -507,9 +570,17 @@ device_manager_handle_generate_key(struct wl_client *client,
     int keycode = 0;
     bool res;
     struct ds_keyboard *kbd;
+    uint32_t clas;
 
     tz_devicemgr = wl_resource_get_user_data(resource);
 
+    clas = tz_devicemgr_client_get_device_clas(tz_devicemgr, resource);
+    if ((clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD) == 0)
+    {
+        ds_err("Keyboard generator is not initialized by client");
+        goto finish;
+    }
+
     if (!tz_devicemgr->devices.kbd ||
         !tz_devicemgr->devices.kbd->input_device) {
         ds_err("Keyboard device is not initialized\n");
@@ -557,6 +628,144 @@ finish:
 }
 
 static void
+device_manager_handle_generate_pointer(struct wl_client *client,
+        struct wl_resource *resource, uint32_t type, uint32_t x, uint32_t y,
+        uint32_t button)
+{
+    struct ds_tizen_input_devicemgr *tz_devicemgr;
+    int ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_SYSTEM_RESOURCES;
+    bool res;
+    bool state;
+    uint32_t clas;
+
+    tz_devicemgr = wl_resource_get_user_data(resource);
+
+    clas = tz_devicemgr_client_get_device_clas(tz_devicemgr, resource);
+    if ((clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE) == 0)
+    {
+        ds_err("Pointer generator is not initialized by client");
+        goto finish;
+    }
+
+    if (!tz_devicemgr->devices.ptr ||
+        !tz_devicemgr->devices.ptr->input_device) {
+        ds_err("Pointer device is not initialized\n");
+        goto finish;
+    }
+
+    if (!tz_devicemgr_check_privilege(tz_devicemgr, client,
+            TIZEN_PRIV_INPUT_GENERATOR)) {
+        ds_err("No permission to input generate");
+        ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_PERMISSION;
+        goto finish;
+    }
+
+    if (button <= 0 || button >= TIZEN_INPUT_DEVICEMGR_MAX_BTN)
+    {
+        ds_err("Invalid button: %d\n", button);
+        ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER;
+        goto finish;
+    }
+
+    if (type == TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE) {
+        res = tz_devicemgr_generate_mouse_move(
+                    tz_devicemgr->devices.ptr->input_device, (double)x, (double)y);
+        if (!res) goto finish;
+        ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
+    }
+    else {
+        state = (type == TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN) ?
+                true : false;
+        res = tz_devicemgr_generate_mouse_button(
+                    tz_devicemgr->devices.ptr->input_device, button, state);
+        if (!res) goto finish;
+        if (state)  tz_devicemgr->devices.ptr->mouse.pressed |= 1 << (button - 1);
+        else tz_devicemgr->devices.ptr->mouse.pressed &= ~(1 << (button - 1));
+        ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
+    }
+
+finish:
+    tizen_input_device_manager_send_error(resource, ret);
+}
+
+static void
+device_manager_handle_generate_touch(struct wl_client *client,
+        struct wl_resource *resource, uint32_t type, uint32_t x, uint32_t y,
+        uint32_t finger)
+{
+    struct ds_tizen_input_devicemgr *tz_devicemgr;
+    double transformed_x = .0, transformed_y = .0;
+    int ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_SYSTEM_RESOURCES;
+    bool res;
+    uint32_t clas;
+
+    tz_devicemgr = wl_resource_get_user_data(resource);
+
+    clas = tz_devicemgr_client_get_device_clas(tz_devicemgr, resource);
+    if ((clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_TOUCHSCREEN) == 0)
+    {
+        ds_err("Touch generator is not initialized by client");
+        goto finish;
+    }
+
+    if (!tz_devicemgr->devices.touch ||
+        !tz_devicemgr->devices.touch->input_device) {
+        ds_err("Touch device is not initialized\n");
+        goto finish;
+    }
+
+    if (!tz_devicemgr_check_privilege(tz_devicemgr, client,
+            TIZEN_PRIV_INPUT_GENERATOR)) {
+        ds_err("No permission to input generate");
+        ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_PERMISSION;
+        goto finish;
+    }
+
+    if (finger >= tz_devicemgr->touch_max_count)
+    {
+        ds_err("Invalid fingers: %d\n", finger);
+        ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER;
+        goto finish;
+    }
+
+    if (tz_devicemgr->output.width != 0 && tz_devicemgr->output.height != 0) {
+        transformed_x = x / (double)tz_devicemgr->output.width;
+        transformed_y = y / (double)tz_devicemgr->output.height;
+    }
+
+    switch(type) {
+        case TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN: // 0
+            res = tz_devicemgr_generate_touch_move(
+                    tz_devicemgr->devices.touch->input_device, transformed_x, transformed_y, finger);
+            if (!res) break;
+            res= tz_devicemgr_generate_touch_down(
+                tz_devicemgr->devices.touch->input_device, transformed_x, transformed_y, finger);
+            if (!res) break;
+            tz_devicemgr->devices.touch->touch.pressed |= 1 << finger;
+            ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
+            break;
+        case TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END: // 2
+            res = tz_devicemgr_generate_touch_up(
+                tz_devicemgr->devices.touch->input_device, finger);
+            if (!res) break;
+            tz_devicemgr->devices.touch->touch.pressed &= ~(1 << finger);
+            ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
+            break;
+        case TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE: // 1
+            res = tz_devicemgr_generate_touch_move(
+                tz_devicemgr->devices.touch->input_device, transformed_x, transformed_y, finger);
+            if (!res) break;
+            ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
+            break;
+        default:
+            break;
+    }
+
+finish:
+    tizen_input_device_manager_send_error(resource, ret);
+}
+
+static void
 device_manager_handle_destroy(struct wl_client *client,
         struct wl_resource *resource)
 {
@@ -597,58 +806,242 @@ create_ds_keyboard()
     return kbd;
 }
 
+static struct ds_pointer *
+create_ds_pointer()
+{
+    struct ds_pointer *pointer;
+    pointer = calloc(1, sizeof *pointer);
+    if (!pointer) {
+        ds_err("Could not allocate memory");
+        return NULL;
+    }
+    ds_pointer_init(pointer, NULL);
+
+    return pointer;
+}
+
+static struct ds_touch *
+create_ds_touch()
+{
+    struct ds_touch *touch;
+    touch = calloc(1, sizeof *touch);
+    if (!touch) {
+        ds_err("Could not allocate memory");
+        return NULL;
+    }
+    ds_touch_init(touch, NULL);
+
+    return touch;
+}
+
 static int
-tz_devicemgr_init_generator(struct ds_tizen_input_devicemgr *tz_devicemgr,
-        struct wl_resource *resource, const char *name)
+tz_devicemgr_create_device(struct ds_tizen_input_devicemgr_device *dev,
+        uint32_t clas, const char *name)
 {
     int ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_SYSTEM_RESOURCES;
-    struct ds_tizen_input_devicemgr_client *client_data;
-    struct ds_tizen_input_devicemgr_device *kbd;
-
-    ds_inf("Init generator. name:%s", name);
+    const char *dev_name;
 
-    kbd = tz_devicemgr->devices.kbd;
-    if (strlen(kbd->name) > 0) {
-        ds_inf("devices.kbd already has name. name:%s", kbd->name);
+    if (dev->name && strlen(dev->name) > 0) {
+        ds_inf("device already has name. name:%s", dev->name);
         return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
     }
 
-    if (kbd->input_device) {
-        ds_inf("devices.kbd is already set. name:%s",
-                ds_input_device_get_name(kbd->input_device));
+    if (dev->input_device) {
+        dev_name = ds_input_device_get_name(dev->input_device);
+        ds_inf("device was already set. name:%s", dev_name);
+        dev->name = strdup(dev_name);
         return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
     }
 
     //input_device create
-    kbd->input_device = calloc(1, sizeof(struct ds_input_device));
-    if(!kbd->input_device) {
+    dev->input_device = calloc(1, sizeof(struct ds_input_device));
+    if(!dev->input_device) {
         ds_err("Failed to create input device !\n");
         return ret;
     }
 
-    ds_input_device_init(kbd->input_device, DS_INPUT_DEVICE_KEYBOARD,
-            &input_device_iface, name, -1, -1);
-    kbd->input_device->keyboard = create_ds_keyboard();
+    if (clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD)
+    {
+        ds_input_device_init(dev->input_device, DS_INPUT_DEVICE_KEYBOARD,
+                &input_device_iface, name, -1, -1);
+        dev->input_device->keyboard = create_ds_keyboard();
+    }
+    else if (clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE)
+    {
+        ds_input_device_init(dev->input_device, DS_INPUT_DEVICE_POINTER,
+                &input_device_iface, name, -1, -1);
+        dev->input_device->pointer = create_ds_pointer();
+    }
+    else if (clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_TOUCHSCREEN)
+    {
+        ds_input_device_init(dev->input_device, DS_INPUT_DEVICE_TOUCH,
+                &input_device_iface, name, -1, -1);
+        dev->input_device->touch = create_ds_touch();
+    }
 
-    wl_signal_emit(&tz_devicemgr->backend->events.new_input,
-            kbd->input_device);
+    dev->created = true;
+    dev->name = strdup(name);
 
-    kbd->created = true;
-    strncpy(kbd->name, name, UINPUT_MAX_NAME_SIZE);
+    return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
+}
 
+static int
+tz_devicemgr_init_generator(struct ds_tizen_input_devicemgr *tz_devicemgr,
+        struct wl_resource *resource, uint32_t clas, const char *name)
+{
+    int ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_SYSTEM_RESOURCES;
+    struct ds_tizen_input_devicemgr_client *client_data;
+    struct ds_tizen_input_devicemgr_device *dev;
+    bool inited = false;
+
+    ds_inf("Init generator. name:%s", name);
+
+    if (clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD) {
+        dev = tz_devicemgr->devices.kbd;
+        ret = tz_devicemgr_create_device(dev, clas, name);
+        if (ret == TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE) {
+            inited = true;
+            tz_devicemgr->devices.kbd->ref++;
+        }
+        if (dev->created) {
+            wl_signal_emit(&tz_devicemgr->backend->events.new_input,
+                    dev->input_device);
+        }
+    }
+    if (clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE) {
+        dev = tz_devicemgr->devices.ptr;
+        ret = tz_devicemgr_create_device(dev, clas, name);
+        if (ret == TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE) {
+            inited = true;
+            tz_devicemgr->devices.ptr->ref++;
+        }
+        if (dev->created) {
+            wl_signal_emit(&tz_devicemgr->backend->events.new_input,
+                    dev->input_device);
+        }
+    }
+    if (clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_TOUCHSCREEN) {
+        dev = tz_devicemgr->devices.touch;
+        ret = tz_devicemgr_create_device(dev, clas, name);
+        if (ret == TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE) {
+            inited = true;
+            tz_devicemgr->devices.touch->ref++;
+        }
+        if (dev->created) {
+            wl_signal_emit(&tz_devicemgr->backend->events.new_input,
+                    dev->input_device);
+        }
+    }
+
+    if (inited) {
+        wl_list_for_each(client_data, &tz_devicemgr->clients, link) {
+            if (client_data->resource == resource) {
+                if (client_data->init == false) {
+                    client_data->init = true;
+                    client_data->clas = clas;
+                }
+                break;
+            }
+        }
+    }
+
+    return ret;
+}
+
+static int
+tz_devicemgr_deinit_generator(struct ds_tizen_input_devicemgr *tz_devicemgr,
+        struct wl_resource *resource)
+{
+    int ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_SYSTEM_RESOURCES;
+    struct ds_tizen_input_devicemgr_client *client_data;
+    struct ds_tizen_input_devicemgr_device *dev;
+    uint32_t clas = 0;
+    int i = 0;
+    bool res;
+
+    ds_inf("Deinit generator.");
     wl_list_for_each(client_data, &tz_devicemgr->clients, link) {
         if (client_data->resource == resource) {
-            if (client_data->init == false) {
-                client_data->init = true;
-                tz_devicemgr->ref++;
+            if (client_data->init == true) {
+                client_data->init = false;
+                clas = client_data->clas;
+                break;
+            } else {
+                return ret;
             }
-            break;
         }
     }
+    if (clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD) {
+        dev = tz_devicemgr->devices.kbd;
+        dev->ref--;
+        if (dev->ref<= 0) {
+            dev->ref = 0;
+            tz_devicemgr_pressed_keys_cleanup(tz_devicemgr);
+
+            if (dev->created) {
+                tz_devicemgr_device_close(dev);
+                dev->created = false;
+            }
+            free(dev->name);
+            dev->name = NULL;
+        }
+    }
+    if (clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE) {
+        dev = tz_devicemgr->devices.ptr;
+        dev->ref--;
+        if (dev->ref <= 0) {
+            dev->ref = 0;
+            while(dev->mouse.pressed)
+            {
+                if (dev->mouse.pressed & (1 << i))
+                {
+                    res = tz_devicemgr_generate_mouse_button(dev->input_device,
+                            i + 1, false);
+                    if (!res) break;
+                    dev->mouse.pressed &= ~(1 << i);
+                }
+                i++;
+                if (i >= TIZEN_INPUT_DEVICEMGR_MAX_BTN) break;
+            }
 
-    ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
+            if (dev->created)
+            {
+                tz_devicemgr_device_close(dev);
+                dev->created = false;
+            }
+            free(dev->name);
+            dev->name = NULL;
+        }
+    }
+    if (clas & TIZEN_INPUT_DEVICE_MANAGER_CLAS_TOUCHSCREEN) {
+        dev = tz_devicemgr->devices.touch;
+        dev->ref--;
+        if (dev->ref <= 0) {
+            dev->ref = 0;
+            while(dev->touch.pressed)
+            {
+                if (dev->touch.pressed & (1 << i))
+                {
+                    res = tz_devicemgr_generate_touch_up(dev->input_device,
+                            i);
+                    if (!res) break;
+                    dev->touch.pressed &= ~(1 << i);
+                }
+                i++;
+                if (i >= tz_devicemgr->touch_max_count) break;
+            }
 
-    return ret;
+            if (dev->created)
+            {
+                tz_devicemgr_device_close(dev);
+                dev->created = false;
+            }
+            free(dev->name);
+            dev->name = NULL;
+        }
+    }
+
+    return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
 }
 
 static int
@@ -715,10 +1108,10 @@ tz_devicemgr_pressed_keys_update(struct ds_tizen_input_devicemgr *tz_devicemgr,
         }
         key->keycode = keycode;
         wl_list_init(&key->link);
-        wl_list_insert(&tz_devicemgr->pressed_keys, &key->link);
+        wl_list_insert(&tz_devicemgr->devices.kbd->key.pressed, &key->link);
     }
     else {
-        wl_list_for_each_safe(key, tmp, &tz_devicemgr->pressed_keys, link) {
+        wl_list_for_each_safe(key, tmp, &tz_devicemgr->devices.kbd->key.pressed, link) {
             if (key->keycode == keycode) {
                 wl_list_remove(&key->link);
                 free(key);
@@ -728,7 +1121,7 @@ tz_devicemgr_pressed_keys_update(struct ds_tizen_input_devicemgr *tz_devicemgr,
     }
 
     ds_inf("Update pressed keys. length: %d, keycode:%d, pressed:%d",
-            wl_list_length(&tz_devicemgr->pressed_keys), keycode, pressed);
+            wl_list_length(&tz_devicemgr->devices.kbd->key.pressed), keycode, pressed);
 
     return true;
 }
@@ -738,10 +1131,10 @@ tz_devicemgr_pressed_keys_cleanup(struct ds_tizen_input_devicemgr *tz_devicemgr)
 {
     struct ds_tizen_input_devicemgr_key_info *keydata, *tmp;
 
-    ds_inf("Clean up the pressed_keys. length: %d",
-            wl_list_length(&tz_devicemgr->pressed_keys));
+    ds_inf("Clean up the kbd.pressed_keys. length: %d",
+            wl_list_length(&tz_devicemgr->devices.kbd->key.pressed));
 
-    wl_list_for_each_safe(keydata, tmp, &tz_devicemgr->pressed_keys, link) {
+    wl_list_for_each_safe(keydata, tmp, &tz_devicemgr->devices.kbd->key.pressed, link) {
         if (tz_devicemgr->devices.kbd)
             tz_devicemgr_generate_key(tz_devicemgr->devices.kbd->input_device,
                     keydata->keycode, false);
@@ -765,48 +1158,145 @@ tz_devicemgr_keymap_list_cleanup(struct ds_tizen_input_devicemgr *tz_devicemgr)
     }
 }
 
-static void
-tz_devicemgr_keyboard_close(struct ds_tizen_input_devicemgr *tz_devicemgr)
+static bool
+tz_devicemgr_generate_touch_move(struct ds_input_device *device, double x, double y,
+        uint32_t finger)
+{
+    struct ds_event_touch_motion ds_event;
+    struct timeval time;
+    unsigned int timestamp;
+    struct ds_touch *touch;
+
+    touch = ds_input_device_get_touch(device);
+    if (!touch) {
+        ds_err("No ds_touch to notify event");
+        return false;
+    }
+
+    gettimeofday(&time, NULL);
+    timestamp = time.tv_sec * 1000 + time.tv_usec / 1000;
+
+    ds_event.time_msec = timestamp;
+    ds_event.id = finger;
+    ds_event.x = x;
+    ds_event.y = y;
+    ds_inf("Generate touch motion. touch:%p, id:%d (%d, %d)", touch, ds_event.id, x, y);
+
+    wl_signal_emit(&touch->events.motion, &ds_event);
+
+    return true;
+}
+
+static bool
+tz_devicemgr_generate_touch_down(struct ds_input_device *device, double x, double y,
+        uint32_t finger)
 {
-    if (!tz_devicemgr->devices.kbd->input_device) return;
-    ds_input_device_destroy(tz_devicemgr->devices.kbd->input_device);
-    tz_devicemgr->devices.kbd->input_device = NULL;
-    tz_devicemgr->devices.kbd->created = false;
+    struct ds_event_touch_down ds_event;
+    struct timeval time;
+    unsigned int timestamp;
+    struct ds_touch *touch;
+
+    touch = ds_input_device_get_touch(device);
+    if (!touch) {
+        ds_err("No ds_touch to notify event");
+        return false;
+    }
+
+    gettimeofday(&time, NULL);
+    timestamp = time.tv_sec * 1000 + time.tv_usec / 1000;
+
+    ds_event.time_msec = timestamp;
+    ds_event.id = finger;
+    ds_event.x = x;
+    ds_event.y = y;
+    ds_inf("Generate touch down. touch:%p, id:%d (%d, %d)", touch, ds_event.id, x, y);
+
+    wl_signal_emit(&touch->events.down, &ds_event);
+
+    return true;
 }
 
-static int
-tz_devicemgr_deinit_generator(struct ds_tizen_input_devicemgr *tz_devicemgr,
-        struct wl_resource *resource)
+static bool
+tz_devicemgr_generate_touch_up(struct ds_input_device *device, uint32_t finger)
 {
-    int ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
-    struct ds_tizen_input_devicemgr_client *client_data;
+    struct ds_event_touch_up ds_event;
+    struct timeval time;
+    unsigned int timestamp;
+    struct ds_touch *touch;
 
-    ds_inf("Deinit generator.");
-    wl_list_for_each(client_data, &tz_devicemgr->clients, link) {
-        if (client_data->resource == resource) {
-            if (client_data->init == true) {
-                client_data->init = false;
-                tz_devicemgr->ref--;
-                if (tz_devicemgr->ref < 0) tz_devicemgr->ref = 0;
-                break;
-            } else {
-                return ret;
-            }
-        }
+    touch = ds_input_device_get_touch(device);
+    if (!touch) {
+        ds_err("No ds_touch to notify event");
+        return false;
+    }
+
+    gettimeofday(&time, NULL);
+    timestamp = time.tv_sec * 1000 + time.tv_usec / 1000;
+
+    ds_event.time_msec = timestamp;
+    ds_event.id = finger;
+    ds_inf("Generate touch up. touch:%p, id:%d", touch, ds_event.id);
+
+    wl_signal_emit(&touch->events.up, &ds_event);
+
+    return true;
+}
+
+static bool
+tz_devicemgr_generate_mouse_move(struct ds_input_device *device, double x, double y)
+{
+    struct ds_event_pointer_motion ds_event;
+    struct timeval time;
+    unsigned int timestamp;
+    struct ds_pointer *pointer;
+
+    pointer = ds_input_device_get_pointer(device);
+    if (!pointer) {
+        ds_err("No ds_pointer to notify event");
+        return false;
     }
 
-    if (tz_devicemgr->ref <= 0) {
-        tz_devicemgr_pressed_keys_cleanup(tz_devicemgr);
+    gettimeofday(&time, NULL);
+    timestamp = time.tv_sec * 1000 + time.tv_usec / 1000;
+
+    ds_event.time_msec = timestamp;
+    ds_event.delta_x = x;
+    ds_event.delta_y = y;
+    ds_inf("Generate mouse motion. pointer:%p, x:%f, y:%f", pointer, ds_event.delta_x, ds_event.delta_y);
 
-        if (!tz_devicemgr->devices.kbd)
-            return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
+    wl_signal_emit(&pointer->events.motion, &ds_event);
 
-        if (tz_devicemgr->devices.kbd->created)
-            tz_devicemgr_keyboard_close(tz_devicemgr);
-        memset(tz_devicemgr->devices.kbd->name, 0, UINPUT_MAX_NAME_SIZE);
+    return true;
+}
+
+static bool
+tz_devicemgr_generate_mouse_button(struct ds_input_device *device, uint32_t button, bool state)
+{
+    struct ds_event_pointer_button ds_event;
+    struct timeval time;
+    unsigned int timestamp;
+    struct ds_pointer *pointer;
+
+    pointer = ds_input_device_get_pointer(device);
+    if (!pointer) {
+        ds_err("No ds_pointer to notify event");
+        return false;
     }
 
-    return ret;
+    gettimeofday(&time, NULL);
+    timestamp = time.tv_sec * 1000 + time.tv_usec / 1000;
+
+    ds_event.time_msec = timestamp;
+    ds_event.button = button;
+    if (state)
+        ds_event.state = DS_BUTTON_PRESSED;
+    else
+        ds_event.state = DS_BUTTON_RELEASED;
+    ds_inf("Generate mouse button. pointer:%p, button:%d, state:%s", pointer, ds_event.button, state ? "PRESSED" : "RELEASED");
+
+    wl_signal_emit(&pointer->events.button, &ds_event);
+
+    return true;
 }
 
 static void
index 52bd2ef..a4428ee 100644 (file)
@@ -9,9 +9,23 @@
 #include <libds/seat.h>
 
 struct ds_tizen_input_devicemgr_device {
-    char name[UINPUT_MAX_NAME_SIZE + 1];
+    char *name;
     struct ds_input_device *input_device;
+    int ref;
+
     bool created;
+
+    struct {
+        struct wl_list pressed;
+    } key;
+
+    struct {
+        unsigned int pressed;
+    } touch;
+
+    struct {
+        unsigned int pressed;
+    } mouse;
 };
 
 struct ds_tizen_input_devicemgr {
@@ -34,20 +48,25 @@ struct ds_tizen_input_devicemgr {
     } devices;
 
     struct wl_list clients;
-    int ref;
 
-    struct wl_list pressed_keys;
     struct wl_list keymap_list;
 
     struct wl_list blocked_keys;
     struct wl_resource *block_resource;
     struct wl_event_source *timer;
     struct ds_seat_keyboard_grab *grab;
+    int touch_max_count;
+
+    struct {
+        uint32_t width;
+        uint32_t height;
+    } output;
 };
 
 struct ds_tizen_input_devicemgr_client {
     struct wl_resource *resource;
     bool init;
+    uint32_t clas;
     struct wl_list link; // ds_tizen_input_devicemgr::clients
 };