elput: change some functions and internal flags to enable async input setup
authorMike Blumenkrantz <zmike@osg.samsung.com>
Tue, 24 May 2016 20:14:41 +0000 (16:14 -0400)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Wed, 25 May 2016 16:57:27 +0000 (12:57 -0400)
this sets attributes on the Elput_Manager struct so that devices created at
a later point can then have relevant attributes applied to them

src/lib/elput/Elput.h
src/lib/elput/elput_evdev.c
src/lib/elput/elput_input.c
src/lib/elput/elput_logind.c
src/lib/elput/elput_manager.c
src/lib/elput/elput_private.h

index 2f31160..77ba406 100644 (file)
@@ -230,6 +230,24 @@ EAPI Eina_Bool elput_manager_vt_set(Elput_Manager *manager, int vt);
  */
 EAPI const Eina_List *elput_manager_seats_get(Elput_Manager *manager);
 
+
+/**
+ * Set which window to use for this input manager
+ *
+ * @brief This function should be used to specify which window to set on the
+ *        input manager. Setting a window on the input manager is done so that
+ *        when we raise events (mouse movement, keyboard key, etc) then
+ *        this window is passed to the event structure as the window which
+ *        the event occured on.
+ *
+ * @param manager
+ * @param window
+ *
+ * @ingroup Elput_Manager_Group
+ * @since 1.18
+ */
+EAPI void elput_manager_window_set(Elput_Manager *manager, unsigned int window);
+
 /**
  * @defgroup Elput_Input_Group Elput input functions
  *
@@ -329,23 +347,6 @@ EAPI void elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh
  */
 
 /**
- * Set which window to use for this input device
- *
- * @brief This function should be used to specify which window to set on the
- *        input device. Setting a window on the input device is done so that
- *        when we raise events (mouse movement, keyboard key, etc) then
- *        this window is passed to the event structure as the window which
- *        the event occured on.
- *
- * @param device
- * @param window
- *
- * @ingroup Elput_Device_Group
- * @since 1.18
- */
-EAPI void elput_device_window_set(Elput_Device *device, unsigned int window);
-
-/**
  * Set size of output for input device calibration
  *
  * @param device
index 4537019..5095320 100644 (file)
@@ -1345,14 +1345,6 @@ _evdev_touch_get(Elput_Seat *seat)
 }
 
 EAPI void
-elput_device_window_set(Elput_Device *device, unsigned int window)
-{
-   EINA_SAFETY_ON_NULL_RETURN(device);
-
-   device->window = window;
-}
-
-EAPI void
 elput_device_output_size_set(Elput_Device *device, int w, int h)
 {
    EINA_SAFETY_ON_NULL_RETURN(device);
index 8431c29..45778eb 100644 (file)
@@ -500,12 +500,8 @@ elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh)
    Elput_Seat *eseat;
 
    EINA_SAFETY_ON_NULL_RETURN(manager);
+   manager->input.pointer_w = maxw;
+   manager->input.pointer_h = maxh;
 
-   EINA_LIST_FOREACH(manager->input.seats, l, eseat)
-     {
-        if (!eseat->ptr) continue;
-
-        eseat->ptr->maxw = maxw;
-        eseat->ptr->maxh = maxh;
-     }
+   _elput_input_pointer_max_update(manager);
 }
index 8db4a11..475b1c6 100644 (file)
@@ -200,16 +200,6 @@ _logind_dbus_setup(Elput_Manager *em)
                                    _cb_device_paused, em);
    eldbus_proxy_signal_handler_add(proxy, "ResumeDevice",
                                    _cb_device_resumed, em);
-   proxy =
-     eldbus_proxy_get(em->dbus.obj, "org.freedesktop.DBus.Properties");
-   if (!proxy)
-     {
-        ERR("Could not get dbus proxy");
-        goto proxy_err;
-     }
-
-   eldbus_proxy_unref(proxy);
-
    return EINA_TRUE;
 
 proxy_err:
index 3b127af..0dcc820 100644 (file)
@@ -89,6 +89,7 @@ elput_manager_open(Elput_Manager *manager, const char *path, int flags)
              manager->vt_hdlr =
                ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
                                        _cb_key_down, manager);
+             manager->vt_fd = ret;
           }
      }
 
@@ -101,8 +102,11 @@ elput_manager_close(Elput_Manager *manager, int fd)
    EINA_SAFETY_ON_NULL_RETURN(manager);
    EINA_SAFETY_ON_NULL_RETURN(manager->interface);
 
-   if (manager->vt_hdlr) ecore_event_handler_del(manager->vt_hdlr);
-   manager->vt_hdlr = NULL;
+   if (fd == manager->vt_fd)
+     {
+        if (manager->vt_hdlr) ecore_event_handler_del(manager->vt_hdlr);
+        manager->vt_hdlr = NULL;
+     }
 
    if (manager->interface->close)
      manager->interface->close(manager, fd);
@@ -121,6 +125,15 @@ elput_manager_vt_set(Elput_Manager *manager, int vt)
    return EINA_FALSE;
 }
 
+EAPI void
+elput_manager_window_set(Elput_Manager *manager, unsigned int window)
+{
+   EINA_SAFETY_ON_NULL_RETURN(manager);
+
+   manager->window = window;
+   _elput_input_window_update(manager);
+}
+
 EAPI const Eina_List *
 elput_manager_seats_get(Elput_Manager *manager)
 {
index a934bf1..0fc5d6a 100644 (file)
@@ -86,6 +86,7 @@ typedef struct _Elput_Input
    Ecore_Thread *thread;
    Eldbus_Pending *current_pending;
    int pipe;
+   int pointer_w, pointer_h;
 
    Eina_Bool suspended : 1;
 } Elput_Input;
@@ -252,6 +253,8 @@ typedef struct _Elput_Async_Open
    int flags;
 } Elput_Async_Open;
 
+void _elput_input_window_update(Elput_Manager *manager);
+
 int _evdev_event_process(struct libinput_event *event);
 Elput_Device *_evdev_device_create(Elput_Seat *seat, struct libinput_device *device);
 void _evdev_device_destroy(Elput_Device *edev);