devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=5c7cfdc133c1edc21b8ece39bd306d0eace623da

commit 5c7cfdc133c1edc21b8ece39bd306d0eace623da
Author: Boram Park <boram1288.p...@samsung.com>
Date:   Wed Apr 29 08:54:03 2015 -0400

    ecore_drm: send a fake motion event to let other know the initial pos of 
mouse
    
    Summary:
    At the first time after finishing booting, the position of mouse cursor is 
in the
    center of screen. But e doesn't know it. ecore_drm should let e know the 
initial
    position of cursor by sending a fake motino event.
    
    Reviewers: devilhorns, ManMower, zmike, raster, gwanglim
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D2410
---
 src/lib/ecore_drm/ecore_drm_evdev.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c 
b/src/lib/ecore_drm/ecore_drm_evdev.c
index c995975..2e4ada1 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -5,6 +5,8 @@
 #include "ecore_drm_private.h"
 #include <ctype.h>
 
+static void  _device_modifiers_update(Ecore_Drm_Evdev *edev);
+
 static void 
 _device_calibration_set(Ecore_Drm_Evdev *edev)
 {
@@ -78,8 +80,40 @@ _device_output_set(Ecore_Drm_Evdev *edev)
    if (libinput_device_has_capability(edev->device, 
                                       LIBINPUT_DEVICE_CAP_POINTER))
      {
+        Ecore_Drm_Input *input;
+        Ecore_Event_Mouse_Move *ev;
+
         edev->mouse.dx = edev->output->current_mode->width / 2;
         edev->mouse.dy = edev->output->current_mode->height / 2;
+
+        /* send a fake motion event to let other know the initial pos of mouse 
*/
+        if (!(input = edev->seat->input)) return;
+        if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
+
+        ev->window = (Ecore_Window)input->dev->window;
+        ev->event_window = (Ecore_Window)input->dev->window;
+        ev->root_window = (Ecore_Window)input->dev->window;
+
+        _device_modifiers_update(edev);
+        ev->modifiers = edev->xkb.modifiers;
+        ev->same_screen = 1;
+
+        ev->x = edev->mouse.dx;
+        ev->y = edev->mouse.dy;
+        ev->root.x = ev->x;
+        ev->root.y = ev->y;
+        ev->multi.device = edev->mt_slot;
+        ev->multi.radius = 1;
+        ev->multi.radius_x = 1;
+        ev->multi.radius_y = 1;
+        ev->multi.pressure = 1.0;
+        ev->multi.angle = 0.0;
+        ev->multi.x = ev->x;
+        ev->multi.y = ev->y;
+        ev->multi.root.x = ev->x;
+        ev->multi.root.y = ev->y;
+
+        ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
      }
 }
 

-- 


Reply via email to