#include "e_input_private.h"
static void _device_modifiers_update(E_Input_Evdev *edev);
+static void _device_configured_size_get(E_Input_Evdev *edev, int *x, int *y, int *w, int *h);
void
_device_calibration_set(E_Input_Evdev *edev)
E_Output *output;
int w = 0, h = 0;
int temp;
+ const char *output_name;
+
+ output_name = libinput_device_get_output_name(edev->device);
+ if (output_name)
+ {
+ E_FREE(edev->output_name);
+ edev->output_name = strdup(output_name);
+ ELOGF("E_INPUT_EVDEV", "Device has output_name:%s", NULL, output_name);
+ }
output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
e_output_size_get(output, &w, &h);
}
static void
+_device_configured_size_get(E_Input_Evdev *edev, int *x, int *y, int *w, int *h)
+{
+ E_Output *output = NULL;
+
+ EINA_SAFETY_ON_NULL_RETURN(edev);
+
+ if (!edev->output_configured)
+ {
+ if (edev->output_name)
+ {
+ output = e_output_find(edev->output_name);
+ if (output)
+ {
+ edev->mouse.minx = output->config.geom.x;
+ edev->mouse.miny = output->config.geom.y;
+ edev->mouse.maxw = output->config.geom.w;
+ edev->mouse.maxh = output->config.geom.h;
+ }
+ }
+
+ edev->output_configured = EINA_TRUE;
+ ELOGF("E_INPUT_EVDEV", "Device is configured by output x:%d,y:%d (w:%d, h:%d)",
+ NULL, edev->mouse.minx, edev->mouse.miny, edev->mouse.maxw, edev->mouse.maxh);
+ }
+ if (x) *x = edev->mouse.minx;
+ if (y) *y = edev->mouse.miny;
+ if (w) *w = edev->mouse.maxw;
+ if (h) *h = edev->mouse.maxh;
+}
+
+static void
_device_handle_touch_down(struct libinput_device *device, struct libinput_event_touch *event)
{
E_Input_Evdev *edev;
- int w = 0, h = 0;
+ int x = 0, y = 0, w = 0, h = 0;
E_Comp_Config *comp_conf = NULL;
if (!(edev = libinput_device_get_user_data(device)))
return;
}
- e_output_size_get(e_comp_screen_primary_output_get(e_comp->e_comp_screen), &w, &h);
+ _device_configured_size_get(edev, &x, &y, &w, &h);
edev->mouse.dx = edev->seat->ptr.ix = edev->seat->ptr.dx =
- libinput_event_touch_get_x_transformed(event, w);
+ x + libinput_event_touch_get_x_transformed(event, w);
edev->mouse.dy = edev->seat->ptr.iy = edev->seat->ptr.dy =
- libinput_event_touch_get_y_transformed(event, h);
+ y + libinput_event_touch_get_y_transformed(event, h);
edev->mt_slot = libinput_event_touch_get_slot(event);
if (edev->mt_slot < 0)
_device_handle_touch_motion(struct libinput_device *device, struct libinput_event_touch *event)
{
E_Input_Evdev *edev;
- int w = 0, h = 0;
+ int x = 0, y = 0, w = 0, h = 0;
if (!(edev = libinput_device_get_user_data(device)))
{
return;
}
- e_output_size_get(e_comp_screen_primary_output_get(e_comp->e_comp_screen), &w, &h);
+ _device_configured_size_get(edev, &x, &y, &w, &h);
edev->mouse.dx = edev->seat->ptr.dx =
- libinput_event_touch_get_x_transformed(event, w);
+ x + libinput_event_touch_get_x_transformed(event, w);
edev->mouse.dy = edev->seat->ptr.dy =
- libinput_event_touch_get_y_transformed(event, h);
+ y + libinput_event_touch_get_y_transformed(event, h);
if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
floor(edev->seat->ptr.dy) == edev->seat->ptr.iy)
free(edev->touch.coords);
edev->touch.coords = NULL;
}
+ E_FREE(edev->output_name);
free(edev);
}