EAPI Eina_Bool ecore_drm_display_fb_hal_buffer_create(Ecore_Drm_Fb *fb);
EAPI void ecore_drm_display_fb_hal_buffer_destroy(Ecore_Drm_Fb *fb);
+EAPI Eina_Bool ecore_drm_device_pointer_rotation_set(Ecore_Drm_Device *dev, int rotation);
+
# ifdef __cplusplus
}
# endif
cached_keymap = map;
}
+
+EAPI Eina_Bool
+ecore_drm_device_pointer_rotation_set(Ecore_Drm_Device *dev, int rotation)
+{
+ Ecore_Drm_Seat *seat = NULL;
+ Ecore_Drm_Evdev *edev = NULL;
+ Eina_List *l = NULL, *l2 = NULL;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(dev->seats, EINA_FALSE);
+
+ if ((rotation % 90 != 0) || (rotation / 90 > 3) || (rotation < 0)) return EINA_FALSE;
+
+ EINA_LIST_FOREACH(dev->seats, l, seat)
+ {
+ switch (rotation)
+ {
+ case 90:
+ seat->ptr.swap = EINA_TRUE;
+ seat->ptr.invert_x = EINA_FALSE;
+ seat->ptr.invert_y = EINA_TRUE;
+ break;
+ case 180:
+ seat->ptr.swap = EINA_FALSE;
+ seat->ptr.invert_x = EINA_TRUE;
+ seat->ptr.invert_y = EINA_TRUE;
+ break;
+ case 270:
+ seat->ptr.swap = EINA_TRUE;
+ seat->ptr.invert_x = EINA_TRUE;
+ seat->ptr.invert_y = EINA_FALSE;
+ break;
+ case 0:
+ seat->ptr.swap = EINA_FALSE;
+ seat->ptr.invert_x = EINA_FALSE;
+ seat->ptr.invert_y = EINA_FALSE;
+ break;
+ default:
+ break;
+ }
+ }
+ return EINA_TRUE;
+}
_device_handle_pointer_motion(struct libinput_device *device, struct libinput_event_pointer *event)
{
Ecore_Drm_Evdev *edev;
+ double dx, dy, temp;
TRACE_INPUT_BEGIN(_device_handle_pointer_motion);
return;
}
- edev->seat->ptr.dx += libinput_event_pointer_get_dx(event);
- edev->seat->ptr.dy += libinput_event_pointer_get_dy(event);
+ dx = libinput_event_pointer_get_dx(event);
+ dy = libinput_event_pointer_get_dy(event);
+
+ if (edev->seat->ptr.swap)
+ {
+ temp = dx;
+ dx = dy;
+ dy = temp;
+ }
+ if (edev->seat->ptr.invert_x)
+ dx *= -1;
+ if (edev->seat->ptr.invert_y)
+ dy *= -1;
+
+ edev->seat->ptr.dx += dx;
+ edev->seat->ptr.dy += dy;
edev->mouse.dx = edev->seat->ptr.dx;
edev->mouse.dy = edev->seat->ptr.dy;