devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=21b1a3f221fb6bd477cfefbb9d0099717c13523d

commit 21b1a3f221fb6bd477cfefbb9d0099717c13523d
Author: Duna Oh <duna...@samsung.com>
Date:   Mon Nov 30 11:05:07 2015 -0500

    ecore-drm: Add logical pointer x, y variable in seat for reflecting 
multiple pointer's movement
    
    Summary: When one pointer moves, we should update the position of other 
devices.
    
    Test Plan:
    (1) Two pointer devices are connected.
    (2) Move the cursor to (x, y) position using "device 1".
    (3) When you move the cursor using "device 2", the cursor doesn't start 
from (x, y) position. This causes discontinuous mouse motion.
    
    Reviewers: raster, zmike, gwanglim, stefan_schmidt, devilhorns, ManMower
    
    Reviewed By: devilhorns, ManMower
    
    Subscribers: cedric, Jeon, input.hacker, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D3384
---
 src/lib/ecore_drm/ecore_drm_device.c  |  6 +--
 src/lib/ecore_drm/ecore_drm_evdev.c   | 86 +++++++++++++++++++----------------
 src/lib/ecore_drm/ecore_drm_private.h |  5 ++
 3 files changed, 56 insertions(+), 41 deletions(-)

diff --git a/src/lib/ecore_drm/ecore_drm_device.c 
b/src/lib/ecore_drm/ecore_drm_device.c
index 3e70d24..9d0442c 100644
--- a/src/lib/ecore_drm/ecore_drm_device.c
+++ b/src/lib/ecore_drm/ecore_drm_device.c
@@ -442,12 +442,12 @@ ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, 
int *x, int *y)
      {
         EINA_LIST_FOREACH(seat->devices, ll, edev)
           {
-             if (!libinput_device_has_capability(edev->device, 
+             if (!libinput_device_has_capability(edev->device,
                                                  LIBINPUT_DEVICE_CAP_POINTER))
                continue;
 
-             if (x) *x = edev->mouse.dx;
-             if (y) *y = edev->mouse.dy;
+             if (x) *x = seat->ptr.dx;
+             if (y) *y = seat->ptr.dy;
 
              return;
           }
diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c 
b/src/lib/ecore_drm/ecore_drm_evdev.c
index 69b398f..824fb09 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -80,8 +80,10 @@ _device_output_set(Ecore_Drm_Evdev *edev)
    if (libinput_device_has_capability(edev->device, 
                                       LIBINPUT_DEVICE_CAP_POINTER))
      {
-        edev->mouse.dx = edev->output->current_mode->width / 2;
-        edev->mouse.dy = edev->output->current_mode->height / 2;
+        edev->seat->ptr.ix = edev->seat->ptr.dx = 
edev->output->current_mode->width / 2;
+        edev->seat->ptr.iy = edev->seat->ptr.dy = 
edev->output->current_mode->height / 2;
+        edev->mouse.dx = edev->seat->ptr.dx;
+        edev->mouse.dy = edev->seat->ptr.dy;
      }
 }
 
@@ -359,15 +361,18 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct 
libinput_event_pointer *eve
 
    if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
 
-   if (edev->mouse.ix < edev->mouse.minx)
-     edev->mouse.dx = edev->mouse.ix = edev->mouse.minx;
-   else if (edev->mouse.ix >= (edev->mouse.minx + edev->mouse.maxw))
-     edev->mouse.dx = edev->mouse.ix = (edev->mouse.minx + edev->mouse.maxw - 
1);
+   if (edev->seat->ptr.ix < edev->mouse.minx)
+     edev->seat->ptr.dx = edev->seat->ptr.ix = edev->mouse.minx;
+   else if (edev->seat->ptr.ix >= (edev->mouse.minx + edev->mouse.maxw))
+     edev->seat->ptr.dx = edev->seat->ptr.ix = (edev->mouse.minx + 
edev->mouse.maxw - 1);
 
-   if (edev->mouse.iy < edev->mouse.miny)
-     edev->mouse.dy = edev->mouse.iy = edev->mouse.miny;
-   else if (edev->mouse.iy >= (edev->mouse.miny + edev->mouse.maxh))
-     edev->mouse.dy = edev->mouse.iy = (edev->mouse.miny + edev->mouse.maxh - 
1);
+   if (edev->seat->ptr.iy < edev->mouse.miny)
+     edev->seat->ptr.dy = edev->seat->ptr.iy = edev->mouse.miny;
+   else if (edev->seat->ptr.iy >= (edev->mouse.miny + edev->mouse.maxh))
+     edev->seat->ptr.dy = edev->seat->ptr.iy = (edev->mouse.miny + 
edev->mouse.maxh - 1);
+
+   edev->mouse.dx = edev->seat->ptr.dx;
+   edev->mouse.dy = edev->seat->ptr.dy;
 
    ev->window = (Ecore_Window)input->dev->window;
    ev->event_window = (Ecore_Window)input->dev->window;
@@ -378,8 +383,8 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct 
libinput_event_pointer *eve
    _device_modifiers_update(edev);
    ev->modifiers = edev->xkb.modifiers;
 
-   ev->x = edev->mouse.ix;
-   ev->y = edev->mouse.iy;
+   ev->x = edev->seat->ptr.ix;
+   ev->y = edev->seat->ptr.iy;
    ev->root.x = ev->x;
    ev->root.y = ev->y;
 
@@ -404,14 +409,17 @@ _device_handle_pointer_motion(struct libinput_device 
*device, struct libinput_ev
 
    if (!(edev = libinput_device_get_user_data(device))) return;
 
-   edev->mouse.dx += libinput_event_pointer_get_dx(event);
-   edev->mouse.dy += libinput_event_pointer_get_dy(event);
+   edev->seat->ptr.dx += libinput_event_pointer_get_dx(event);
+   edev->seat->ptr.dy += libinput_event_pointer_get_dy(event);
+
+   edev->mouse.dx = edev->seat->ptr.dx;
+   edev->mouse.dy = edev->seat->ptr.dy;
 
-   if (floor(edev->mouse.dx) == edev->mouse.ix &&
-       floor(edev->mouse.dy) == edev->mouse.iy) return;
+   if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
+       floor(edev->seat->ptr.dy) == edev->seat->ptr.iy) return;
 
-   edev->mouse.ix = edev->mouse.dx;
-   edev->mouse.iy = edev->mouse.dy;
+   edev->seat->ptr.ix = edev->seat->ptr.dx;
+   edev->seat->ptr.iy = edev->seat->ptr.dy;
   _device_pointer_motion(edev, event);
 }
 
@@ -422,16 +430,18 @@ _device_handle_pointer_motion_absolute(struct 
libinput_device *device, struct li
 
    if (!(edev = libinput_device_get_user_data(device))) return;
 
-   edev->mouse.dx =
+   edev->mouse.dx = edev->seat->ptr.dx =
      libinput_event_pointer_get_absolute_x_transformed(event,
                                                        
edev->output->current_mode->width);
-   edev->mouse.dy =
+   edev->mouse.dy = edev->seat->ptr.dy =
      libinput_event_pointer_get_absolute_y_transformed(event,
                                                        
edev->output->current_mode->height);
 
-   if (floor(edev->mouse.dx) == edev->mouse.ix &&
-       floor(edev->mouse.dy) == edev->mouse.iy) return;
+   if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
+       floor(edev->seat->ptr.dy) == edev->seat->ptr.iy) return;
 
+   edev->seat->ptr.ix = edev->seat->ptr.dx;
+   edev->seat->ptr.iy = edev->seat->ptr.dy;
    _device_pointer_motion(edev, event);
 }
 
@@ -466,8 +476,8 @@ _device_handle_button(struct libinput_device *device, 
struct libinput_event_poin
    _device_modifiers_update(edev);
    ev->modifiers = edev->xkb.modifiers;
 
-   ev->x = edev->mouse.ix;
-   ev->y = edev->mouse.iy;
+   ev->x = edev->seat->ptr.ix;
+   ev->y = edev->seat->ptr.iy;
    ev->root.x = ev->x;
    ev->root.y = ev->y;
 
@@ -548,8 +558,8 @@ _device_handle_axis(struct libinput_device *device, struct 
libinput_event_pointe
    _device_modifiers_update(edev);
    ev->modifiers = edev->xkb.modifiers;
 
-   ev->x = edev->mouse.ix;
-   ev->y = edev->mouse.iy;
+   ev->x = edev->seat->ptr.ix;
+   ev->y = edev->seat->ptr.iy;
    ev->root.x = ev->x;
    ev->root.y = ev->y;
 
@@ -659,8 +669,8 @@ _device_handle_touch_event_send(Ecore_Drm_Evdev *edev, 
struct libinput_event_tou
    _device_modifiers_update(edev);
    ev->modifiers = edev->xkb.modifiers;
 
-   ev->x = edev->mouse.ix;
-   ev->y = edev->mouse.iy;
+   ev->x = edev->seat->ptr.ix;
+   ev->y = edev->seat->ptr.iy;
    ev->root.x = ev->x;
    ev->root.y = ev->y;
 
@@ -734,8 +744,8 @@ _device_handle_touch_motion_send(Ecore_Drm_Evdev *edev, 
struct libinput_event_to
    ev->modifiers = edev->xkb.modifiers;
    ev->modifiers = 0;
 
-   ev->x = edev->mouse.ix;
-   ev->y = edev->mouse.iy;
+   ev->x = edev->seat->ptr.ix;
+   ev->y = edev->seat->ptr.iy;
    ev->root.x = ev->x;
    ev->root.y = ev->y;
 
@@ -760,9 +770,9 @@ _device_handle_touch_down(struct libinput_device *device, 
struct libinput_event_
 
    if (!(edev = libinput_device_get_user_data(device))) return;
 
-   edev->mouse.ix = edev->mouse.dx =
+   edev->mouse.dx = edev->seat->ptr.ix = edev->seat->ptr.dx =
      libinput_event_touch_get_x_transformed(event, 
edev->output->current_mode->width);
-   edev->mouse.iy = edev->mouse.dy =
+   edev->mouse.dy = edev->seat->ptr.iy = edev->seat->ptr.dy =
      libinput_event_touch_get_y_transformed(event, 
edev->output->current_mode->height);
 
    edev->mt_slot = libinput_event_touch_get_seat_slot(event);
@@ -778,16 +788,16 @@ _device_handle_touch_motion(struct libinput_device 
*device, struct libinput_even
 
    if (!(edev = libinput_device_get_user_data(device))) return;
 
-   edev->mouse.dx =
+   edev->mouse.dx = edev->seat->ptr.dx =
      libinput_event_touch_get_x_transformed(event, 
edev->output->current_mode->width);
-   edev->mouse.dy =
+   edev->mouse.dy = edev->seat->ptr.dy =
      libinput_event_touch_get_y_transformed(event, 
edev->output->current_mode->height);
 
-   if (floor(edev->mouse.dx) == edev->mouse.ix &&
-       floor(edev->mouse.dy) == edev->mouse.iy) return;
+   if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
+       floor(edev->seat->ptr.dy) == edev->seat->ptr.iy) return;
 
-   edev->mouse.ix = edev->mouse.dx;
-   edev->mouse.iy = edev->mouse.dy;
+   edev->seat->ptr.ix = edev->seat->ptr.dx;
+   edev->seat->ptr.iy = edev->seat->ptr.dy;
 
    edev->mt_slot = libinput_event_touch_get_seat_slot(event);
 
diff --git a/src/lib/ecore_drm/ecore_drm_private.h 
b/src/lib/ecore_drm/ecore_drm_private.h
index 0153fb3..aa97a20 100644
--- a/src/lib/ecore_drm/ecore_drm_private.h
+++ b/src/lib/ecore_drm/ecore_drm_private.h
@@ -153,6 +153,11 @@ struct _Ecore_Drm_Seat
    const char *name;
    Ecore_Drm_Input *input;
    Eina_List *devices;
+   struct
+     {
+        int ix, iy;
+        double dx, dy;
+     } ptr;
 };
 
 struct _Ecore_Drm_Input

-- 


Reply via email to