devicemgr: add virtual mouse/key device creation using configuration 01/198501/1
authorjeon <jhyuni.kang@samsung.com>
Fri, 25 Jan 2019 04:24:56 +0000 (13:24 +0900)
committerjeon <jhyuni.kang@samsung.com>
Fri, 25 Jan 2019 04:25:09 +0000 (13:25 +0900)
  - This functions were lost during devicemgr migration to core
  - so cherry pick this funtions

Change-Id: I89195f203cba11624e460488373e0de6c5a53fbe

src/bin/e_devicemgr_input.c

index ddf133bf10193ed740b0de131db0681dd55d1824..4709005e266ac8eeb42cb3853cbcd470bcf4863b 100644 (file)
@@ -470,6 +470,9 @@ _e_devicemgr_input_cb_key_up(void *data, int type, void *event)
 Eina_Bool
 e_devicemgr_input_init(void)
 {
+   e_devicemgr->virtual_mouse_device_fd = -1;
+   e_devicemgr->virtual_key_device_fd = -1;
+
    E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_devicemgr_input_cb_mouse_button_down, NULL);
    E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_devicemgr_input_cb_mouse_button_up, NULL);
    E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_MOUSE_MOVE, _e_devicemgr_input_cb_mouse_move, NULL);
@@ -480,6 +483,26 @@ e_devicemgr_input_init(void)
    E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_DEVICE_DEL, _e_devicemgr_input_cb_device_del, NULL);
    E_LIST_HANDLER_PREPEND(e_devicemgr->handlers, ECORE_EVENT_DEVICE_SUBCLASS_UPDATE, _e_devicemgr_input_cb_device_update, NULL);
 
+   if (e_devicemgr->dconfig->conf->input.virtual_key_device_enable)
+     {
+        e_devicemgr->virtual_key_device_fd = e_devicemgr_create_virtual_device(ECORE_DEVICE_CLASS_KEYBOARD, "Virtual Key Device");
+
+        if (e_devicemgr->virtual_key_device_fd >= 0)
+          DMINF("input.virtual_key_device_enable: device fd : %d\n", e_devicemgr->virtual_key_device_fd);
+        else
+          DMWRN("input.virtual_key_device_enable: but failed to create device !\n");
+     }
+
+   if (e_devicemgr->dconfig->conf->input.virtual_mouse_device_enable)
+     {
+        e_devicemgr->virtual_mouse_device_fd = e_devicemgr_create_virtual_device(ECORE_DEVICE_CLASS_MOUSE, "Virtual Mouse Device");
+
+        if (e_devicemgr->virtual_mouse_device_fd >= 0)
+          DMINF("input.virtual_mouse_device_enable: device fd : %d\n", e_devicemgr->virtual_mouse_device_fd);
+        else
+          DMWRN("input.virtual_mouse_device_enable: but failed to create device !\n");
+     }
+
    return EINA_TRUE;
 }
 
@@ -490,4 +513,15 @@ e_devicemgr_input_shutdown(void)
 
    EINA_LIST_FREE(e_devicemgr->handlers, h)
      ecore_event_handler_del(h);
+
+   if (e_devicemgr->virtual_key_device_fd)
+     {
+        e_devicemgr_destroy_virtual_device(e_devicemgr->virtual_key_device_fd);
+        e_devicemgr->virtual_key_device_fd = -1;
+     }
+   if (e_devicemgr->virtual_mouse_device_fd)
+     {
+        e_devicemgr_destroy_virtual_device(e_devicemgr->virtual_mouse_device_fd);
+        e_devicemgr->virtual_mouse_device_fd = -1;
+     }
 }