summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-06-02 18:23:45 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-06-02 18:23:43 -0400
commitf220f086b991cd3aad306d7cbeb181e531d1dddb (patch)
tree31583caea5434fe92b3bd06922cd68e07747b9cd /src/lib
parent36dcd5719a2a82d91a468d9a23e9f09b22713492 (diff)
downloadefl-f220f086b991cd3aad306d7cbeb181e531d1dddb.tar.gz
elput: move pointer coords into seat struct
@fix
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elput/elput.c5
-rw-r--r--src/lib/elput/elput_evdev.c108
-rw-r--r--src/lib/elput/elput_input.c22
-rw-r--r--src/lib/elput/elput_private.h7
4 files changed, 68 insertions, 74 deletions
diff --git a/src/lib/elput/elput.c b/src/lib/elput/elput.c
index f0c7a9027b..9519129759 100644
--- a/src/lib/elput/elput.c
+++ b/src/lib/elput/elput.c
@@ -13,6 +13,7 @@ EAPI int ELPUT_EVENT_MODIFIERS_SEND = 0;
EAPI int ELPUT_EVENT_DEVICE_CHANGE = 0;
EAPI int ELPUT_EVENT_SESSION_ACTIVE = 0;
EAPI int ELPUT_EVENT_POINTER_MOTION = 0;
+EAPI int elput_event_session_ready = 0;
EAPI int
elput_init(void)
@@ -40,6 +41,7 @@ elput_init(void)
ELPUT_EVENT_DEVICE_CHANGE = ecore_event_type_new();
ELPUT_EVENT_SESSION_ACTIVE = ecore_event_type_new();
ELPUT_EVENT_POINTER_MOTION = ecore_event_type_new();
+ elput_event_session_ready = ecore_event_type_new();
}
return _elput_init_count;
@@ -68,7 +70,8 @@ elput_shutdown(void)
ELPUT_EVENT_MODIFIERS_SEND,
ELPUT_EVENT_DEVICE_CHANGE,
ELPUT_EVENT_SESSION_ACTIVE,
- ELPUT_EVENT_POINTER_MOTION);
+ ELPUT_EVENT_POINTER_MOTION,
+ elput_event_session_ready);
eina_log_domain_unregister(_elput_log_dom);
_elput_log_dom = -1;
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index fb9d5a2bed..fca4042681 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -799,8 +799,8 @@ _pointer_motion_send(Elput_Device *edev)
ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
if (!ev) return;
- x = ptr->x;
- y = ptr->y;
+ x = ptr->seat->pointer.x;
+ y = ptr->seat->pointer.y;
if (x < ptr->minx)
x = ptr->minx;
@@ -812,8 +812,8 @@ _pointer_motion_send(Elput_Device *edev)
else if (y >= ptr->miny + ptr->seat->manager->input.pointer_h)
y = ptr->miny + ptr->seat->manager->input.pointer_h - 1;
- ptr->x = x;
- ptr->y = y;
+ ptr->seat->pointer.x = x;
+ ptr->seat->pointer.y = y;
ev->window = edev->seat->manager->window;
ev->event_window = edev->seat->manager->window;
@@ -823,10 +823,10 @@ _pointer_motion_send(Elput_Device *edev)
ev->dev = edev->evas_device;
if (ev->dev) efl_ref(ev->dev);
- ev->x = ptr->x;
- ev->y = ptr->y;
- ev->root.x = ptr->x;
- ev->root.y = ptr->y;
+ ev->x = ptr->seat->pointer.x;
+ ev->y = ptr->seat->pointer.y;
+ ev->root.x = ptr->seat->pointer.x;
+ ev->root.y = ptr->seat->pointer.y;
kbd = _evdev_keyboard_get(edev->seat);
if (kbd) _keyboard_modifiers_update(kbd, edev->seat);
@@ -841,10 +841,10 @@ _pointer_motion_send(Elput_Device *edev)
ev->multi.radius_y = 1;
ev->multi.pressure = ptr->pressure;
ev->multi.angle = 0.0;
- ev->multi.x = ptr->x;
- ev->multi.y = ptr->y;
- ev->multi.root.x = ptr->x;
- ev->multi.root.y = ptr->y;
+ ev->multi.x = ptr->seat->pointer.x;
+ ev->multi.y = ptr->seat->pointer.y;
+ ev->multi.root.x = ptr->seat->pointer.x;
+ ev->multi.root.y = ptr->seat->pointer.y;
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _event_free, ev->dev);
}
@@ -878,8 +878,8 @@ _pointer_motion(struct libinput_device *idev, struct libinput_event_pointer *eve
ptr = _evdev_pointer_get(edev->seat);
if (!ptr) return EINA_FALSE;
- ptr->x += libinput_event_pointer_get_dx(event);
- ptr->y += libinput_event_pointer_get_dy(event);
+ ptr->seat->pointer.x += libinput_event_pointer_get_dx(event);
+ ptr->seat->pointer.y += libinput_event_pointer_get_dy(event);
ptr->timestamp = libinput_event_pointer_get_time(event);
_pointer_motion_send(edev);
@@ -900,8 +900,8 @@ _pointer_motion_abs(struct libinput_device *idev, struct libinput_event_pointer
ptr = _evdev_pointer_get(edev->seat);
if (!ptr) return EINA_FALSE;
- ptr->x = libinput_event_pointer_get_absolute_x_transformed(event, edev->ow);
- ptr->y = libinput_event_pointer_get_absolute_y_transformed(event, edev->oh);
+ ptr->seat->pointer.x = libinput_event_pointer_get_absolute_x_transformed(event, edev->ow);
+ ptr->seat->pointer.y = libinput_event_pointer_get_absolute_y_transformed(event, edev->oh);
ptr->timestamp = libinput_event_pointer_get_time(event);
/* TODO: these needs to run a matrix transform based on output */
@@ -934,10 +934,10 @@ _pointer_button_send(Elput_Device *edev, enum libinput_button_state state)
ev->dev = edev->evas_device;
if (ev->dev) efl_ref(ev->dev);
- ev->x = ptr->x;
- ev->y = ptr->y;
- ev->root.x = ptr->x;
- ev->root.y = ptr->y;
+ ev->x = ptr->seat->pointer.x;
+ ev->y = ptr->seat->pointer.y;
+ ev->root.x = ptr->seat->pointer.x;
+ ev->root.y = ptr->seat->pointer.y;
touch = _evdev_touch_get(edev->seat);
if (touch) ev->multi.device = touch->slot;
@@ -946,10 +946,10 @@ _pointer_button_send(Elput_Device *edev, enum libinput_button_state state)
ev->multi.radius_y = 1;
ev->multi.pressure = ptr->pressure;
ev->multi.angle = 0.0;
- ev->multi.x = ptr->x;
- ev->multi.y = ptr->y;
- ev->multi.root.x = ptr->x;
- ev->multi.root.y = ptr->y;
+ ev->multi.x = ptr->seat->pointer.x;
+ ev->multi.y = ptr->seat->pointer.y;
+ ev->multi.root.x = ptr->seat->pointer.x;
+ ev->multi.root.y = ptr->seat->pointer.y;
ev->buttons = ptr->buttons;
@@ -1057,10 +1057,10 @@ _pointer_axis_send(Elput_Device *dev, int direction, int value)
ev->dev = dev->evas_device;
if (ev->dev) efl_ref(ev->dev);
- ev->x = ptr->x;
- ev->y = ptr->y;
- ev->root.x = ptr->x;
- ev->root.y = ptr->y;
+ ev->x = ptr->seat->pointer.x;
+ ev->y = ptr->seat->pointer.y;
+ ev->root.x = ptr->seat->pointer.x;
+ ev->root.y = ptr->seat->pointer.y;
ev->z = value;
ev->direction = direction;
@@ -1165,10 +1165,10 @@ _touch_event_send(Elput_Device *dev, int type)
ev->timestamp = touch->timestamp;
ev->same_screen = 1;
- ev->x = touch->x;
- ev->y = touch->y;
- ev->root.x = touch->x;
- ev->root.y = touch->y;
+ ev->x = touch->seat->pointer.x;
+ ev->y = touch->seat->pointer.y;
+ ev->root.x = touch->seat->pointer.x;
+ ev->root.y = touch->seat->pointer.y;
ev->modifiers = dev->seat->modifiers;
@@ -1215,8 +1215,8 @@ _touch_motion_send(Elput_Device *dev)
ev->dev = dev->evas_device;
if (ev->dev) efl_ref(ev->dev);
- ev->x = lround(touch->x);
- ev->y = lround(touch->y);
+ ev->x = lround(touch->seat->pointer.x);
+ ev->y = lround(touch->seat->pointer.y);
ev->root.x = ev->x;
ev->root.y = ev->y;
@@ -1228,10 +1228,10 @@ _touch_motion_send(Elput_Device *dev)
ev->multi.radius_y = 1;
ev->multi.pressure = touch->pressure;
ev->multi.angle = 0.0;
- ev->multi.x = touch->x;
- ev->multi.y = touch->y;
- ev->multi.root.x = touch->x;
- ev->multi.root.y = touch->y;
+ ev->multi.x = touch->seat->pointer.x;
+ ev->multi.y = touch->seat->pointer.y;
+ ev->multi.root.x = touch->seat->pointer.x;
+ ev->multi.root.y = touch->seat->pointer.y;
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _event_free, ev->dev);
}
@@ -1251,18 +1251,18 @@ _touch_down(struct libinput_device *idevice, struct libinput_event_touch *event)
touch->slot = libinput_event_touch_get_seat_slot(event);
touch->timestamp = libinput_event_touch_get_time(event);
- touch->x = libinput_event_touch_get_x_transformed(event, dev->ow);
- touch->y = libinput_event_touch_get_y_transformed(event, dev->oh);
+ touch->seat->pointer.x = libinput_event_touch_get_x_transformed(event, dev->ow);
+ touch->seat->pointer.y = libinput_event_touch_get_y_transformed(event, dev->oh);
/* TODO: these needs to run a matrix transform based on output */
/* _ecore_drm2_output_coordinate_transform(dev->output, */
- /* touch->x, touch->y, */
- /* &touch->x, &touch->y); */
+ /* touch->seat->pointer.x, touch->seat->pointer.y, */
+ /* &touch->seat->pointer.x, &touch->seat->pointer.y); */
if (touch->slot == touch->grab.id)
{
- touch->grab.x = touch->x;
- touch->grab.y = touch->y;
+ touch->grab.x = touch->seat->pointer.x;
+ touch->grab.y = touch->seat->pointer.y;
}
touch->points++;
@@ -1273,8 +1273,8 @@ _touch_down(struct libinput_device *idevice, struct libinput_event_touch *event)
if (touch->points == 1)
{
touch->grab.id = touch->slot;
- touch->grab.x = touch->x;
- touch->grab.y = touch->y;
+ touch->grab.x = touch->seat->pointer.x;
+ touch->grab.y = touch->seat->pointer.y;
touch->grab.timestamp = touch->timestamp;
}
}
@@ -1311,13 +1311,13 @@ _touch_motion(struct libinput_device *idevice, struct libinput_event_touch *even
touch = _evdev_touch_get(dev->seat);
if (!touch) return;
- touch->x = libinput_event_touch_get_x_transformed(event, dev->ow);
- touch->y = libinput_event_touch_get_y_transformed(event, dev->oh);
+ touch->seat->pointer.x = libinput_event_touch_get_x_transformed(event, dev->ow);
+ touch->seat->pointer.y = libinput_event_touch_get_y_transformed(event, dev->oh);
/* TODO: these needs to run a matrix transform based on output */
/* _ecore_drm2_output_coordinate_transform(dev->output, */
- /* touch->x, touch->y, */
- /* &touch->x, &touch->y); */
+ /* touch->seat->pointer.x, touch->seat->pointer.y, */
+ /* &touch->seat->pointer.x, &touch->seat->pointer.y); */
touch->slot = libinput_event_touch_get_seat_slot(event);
touch->timestamp = libinput_event_touch_get_time(event);
@@ -1392,19 +1392,19 @@ _tablet_tool_axis(struct libinput_device *idev, struct libinput_event_tablet_too
EINA_SAFETY_ON_NULL_RETURN(ptr);
tool = libinput_event_tablet_tool_get_tool(event);
- ptr->x = libinput_event_tablet_tool_get_x_transformed(event, dev->ow);
- ptr->y = libinput_event_tablet_tool_get_y_transformed(event, dev->oh);
+ ptr->seat->pointer.x = libinput_event_tablet_tool_get_x_transformed(event, dev->ow);
+ ptr->seat->pointer.y = libinput_event_tablet_tool_get_y_transformed(event, dev->oh);
if (libinput_event_tablet_tool_x_has_changed(event))
{
ax[num].label = ECORE_AXIS_LABEL_X;
- ax[num].value = ptr->x;
+ ax[num].value = ptr->seat->pointer.x;
num++;
}
if (libinput_event_tablet_tool_y_has_changed(event))
{
ax[num].label = ECORE_AXIS_LABEL_Y;
- ax[num].value = ptr->y;
+ ax[num].value = ptr->seat->pointer.y;
num++;
}
if (libinput_tablet_tool_has_pressure(tool))
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index 52a00f5fa2..de8d067435 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -457,23 +457,11 @@ elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, int *x, int
EINA_LIST_FOREACH(manager->input.seats, l, eseat)
{
- if (!eseat->ptr) continue;
- if ((eseat->name) && (strcmp(eseat->name, seat)))
- continue;
- if (x) *x = eseat->ptr->x;
- if (y) *y = eseat->ptr->y;
+ if (!eina_streq(eseat->name, seat)) continue;
+ if (x) *x = eseat->pointer.x;
+ if (y) *y = eseat->pointer.y;
return;
}
-
- EINA_LIST_FOREACH(manager->input.seats, l, eseat)
- {
- if (!eseat->touch) continue;
- if ((eseat->name) && (strcmp(eseat->name, seat)))
- continue;
- if (x) *x = eseat->touch->x;
- if (y) *y = eseat->touch->y;
- break;
- }
}
EAPI void
@@ -501,8 +489,8 @@ elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int
if ((eseat->name) && (strcmp(eseat->name, seat)))
continue;
- eseat->ptr->x = x;
- eseat->ptr->y = y;
+ eseat->pointer.x = x;
+ eseat->pointer.y = y;
eseat->ptr->timestamp = ecore_loop_time_get();
EINA_LIST_FOREACH(eseat->devices, ll, edev)
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index a5263f7720..d57c085a9d 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -142,7 +142,6 @@ struct _Elput_Keyboard
struct _Elput_Pointer
{
- double x, y;
int buttons;
unsigned int timestamp;
double pressure;
@@ -171,7 +170,6 @@ struct _Elput_Pointer
struct _Elput_Touch
{
- double x, y;
int slot;
unsigned int points;
unsigned int timestamp;
@@ -197,6 +195,11 @@ struct _Elput_Seat
int kbd, ptr, touch;
} count;
+ struct
+ {
+ double x, y;
+ } pointer;
+
unsigned int modifiers;
Elput_Keyboard *kbd;