summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2/ecore_drm2_device.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-07-07 16:01:58 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-07-07 16:15:59 +0900
commit570a398e290d93e2b6ef998b263004281f45097d (patch)
treeffbd3efc53eff097d509dde0764e8ba340638db2 /src/lib/ecore_drm2/ecore_drm2_device.c
parent0906506470a8f1058dd5840e874f515b8ee8ffc2 (diff)
ecore_drm2: Fix mouse pointer when using absolute coords
Running E wl2 in KVM led to the following issue: integrated mouse pointer would always be stuck at (0,0). The reason was that calibration would never happen, and it's required* for absolute pointing devices, such as the qemu mouse integration. Fix: Listen to device add and calibrate based on the first output. No idea if we could calibrate on any other output, or how this should be done in case of multiple screens. [*] I believe calibration might actually not be required, as the absolute position is already the correct one when received from libinput.
Diffstat (limited to 'src/lib/ecore_drm2/ecore_drm2_device.c')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_device.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index ad786e8269..831c53837b 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -33,6 +33,25 @@ _cb_session_active(void *data, int type EINA_UNUSED, void *event)
33 return ECORE_CALLBACK_RENEW; 33 return ECORE_CALLBACK_RENEW;
34} 34}
35 35
36static Eina_Bool
37_cb_device_change(void *data, int type EINA_UNUSED, void *event)
38{
39 Elput_Event_Device_Change *ev = event;
40 Ecore_Drm2_Device *device = data;
41
42 if (ev->type == ELPUT_DEVICE_ADDED)
43 {
44 Ecore_Drm2_Output *output;
45
46 /* FIXME: not sure which output to use to calibrate */
47 output = eina_list_data_get(device->outputs);
48 if (output)
49 ecore_drm2_device_calibrate(device, output->w, output->h);
50 }
51
52 return ECORE_CALLBACK_RENEW;
53}
54
36static const char * 55static const char *
37_drm2_device_find(const char *seat) 56_drm2_device_find(const char *seat)
38{ 57{
@@ -155,6 +174,10 @@ ecore_drm2_device_open(Ecore_Drm2_Device *device)
155 ecore_event_handler_add(ELPUT_EVENT_SESSION_ACTIVE, 174 ecore_event_handler_add(ELPUT_EVENT_SESSION_ACTIVE,
156 _cb_session_active, device); 175 _cb_session_active, device);
157 176
177 device->device_change_hdlr =
178 ecore_event_handler_add(ELPUT_EVENT_DEVICE_CHANGE,
179 _cb_device_change, device);
180
158 /* NB: Not going to enable planes if we don't support atomic */ 181 /* NB: Not going to enable planes if we don't support atomic */
159 /* if (drmSetClientCap(device->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0) */ 182 /* if (drmSetClientCap(device->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0) */
160 /* ERR("Could not set Universal Plane support: %m"); */ 183 /* ERR("Could not set Universal Plane support: %m"); */
@@ -182,9 +205,8 @@ ecore_drm2_device_free(Ecore_Drm2_Device *device)
182{ 205{
183 EINA_SAFETY_ON_NULL_RETURN(device); 206 EINA_SAFETY_ON_NULL_RETURN(device);
184 207
185 if (device->active_hdlr) ecore_event_handler_del(device->active_hdlr); 208 ecore_event_handler_del(device->active_hdlr);
186 device->active_hdlr = NULL; 209 ecore_event_handler_del(device->device_change_hdlr);
187
188 eina_stringshare_del(device->path); 210 eina_stringshare_del(device->path);
189 free(device); 211 free(device);
190} 212}