summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-05-25 12:49:44 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-05-25 12:57:27 -0400
commit8c3f0ff640371f6e46d4dd73681a654af2e5bce9 (patch)
treec4f10ab8945f3cf26f5e9a681776a303c308dca2 /src
parent7fdcf841f57de11ea92f4b2d4eeec34c1c5a70e0 (diff)
elput: further simplify device internals
'window' and pointer max w/h attributes are set for a manager object, so let the attributes stay there. this also resolves issues where devices created at a later point would fail to be initialized with these attributes
Diffstat (limited to '')
-rw-r--r--src/lib/elput/elput_evdev.c44
-rw-r--r--src/lib/elput/elput_input.c41
-rw-r--r--src/lib/elput/elput_manager.c1
-rw-r--r--src/lib/elput/elput_private.h3
4 files changed, 25 insertions, 64 deletions
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 5095320ac8..7281532926 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -300,9 +300,9 @@ _keyboard_key_send(Elput_Device *dev, enum libinput_key_state state, const char
300 ev->timestamp = timestamp; 300 ev->timestamp = timestamp;
301 ev->same_screen = 1; 301 ev->same_screen = 1;
302 302
303 ev->window = dev->window; 303 ev->window = dev->seat->manager->window;
304 ev->event_window = dev->window; 304 ev->event_window = dev->seat->manager->window;
305 ev->root_window = dev->window; 305 ev->root_window = dev->seat->manager->window;
306 306
307 if (state == LIBINPUT_KEY_STATE_PRESSED) 307 if (state == LIBINPUT_KEY_STATE_PRESSED)
308 ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); 308 ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
@@ -635,20 +635,20 @@ _pointer_motion_send(Elput_Device *edev)
635 635
636 if (x < ptr->minx) 636 if (x < ptr->minx)
637 x = ptr->minx; 637 x = ptr->minx;
638 else if (x >= ptr->minx + ptr->maxw) 638 else if (x >= ptr->minx + ptr->seat->manager->input.pointer_w)
639 x = ptr->minx + ptr->maxw - 1; 639 x = ptr->minx + ptr->seat->manager->input.pointer_w - 1;
640 640
641 if (y < ptr->miny) 641 if (y < ptr->miny)
642 y = ptr->miny; 642 y = ptr->miny;
643 else if (y >= ptr->miny + ptr->maxh) 643 else if (y >= ptr->miny + ptr->seat->manager->input.pointer_h)
644 y = ptr->miny + ptr->maxh - 1; 644 y = ptr->miny + ptr->seat->manager->input.pointer_h - 1;
645 645
646 ptr->x = x; 646 ptr->x = x;
647 ptr->y = y; 647 ptr->y = y;
648 648
649 ev->window = edev->window; 649 ev->window = edev->seat->manager->window;
650 ev->event_window = edev->window; 650 ev->event_window = edev->seat->manager->window;
651 ev->root_window = edev->window; 651 ev->root_window = edev->seat->manager->window;
652 ev->timestamp = ptr->timestamp; 652 ev->timestamp = ptr->timestamp;
653 ev->same_screen = 1; 653 ev->same_screen = 1;
654 654
@@ -736,9 +736,9 @@ _pointer_button_send(Elput_Device *edev, enum libinput_button_state state)
736 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); 736 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
737 if (!ev) return; 737 if (!ev) return;
738 738
739 ev->window = edev->window; 739 ev->window = edev->seat->manager->window;
740 ev->event_window = edev->window; 740 ev->event_window = edev->seat->manager->window;
741 ev->root_window = edev->window; 741 ev->root_window = edev->seat->manager->window;
742 ev->timestamp = ptr->timestamp; 742 ev->timestamp = ptr->timestamp;
743 ev->same_screen = 1; 743 ev->same_screen = 1;
744 744
@@ -854,9 +854,9 @@ _pointer_axis_send(Elput_Device *dev, int direction, int value)
854 ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)); 854 ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
855 if (!ev) return; 855 if (!ev) return;
856 856
857 ev->window = dev->window; 857 ev->window = dev->seat->manager->window;
858 ev->event_window = dev->window; 858 ev->event_window = dev->seat->manager->window;
859 ev->root_window = dev->window; 859 ev->root_window = dev->seat->manager->window;
860 ev->timestamp = ptr->timestamp; 860 ev->timestamp = ptr->timestamp;
861 ev->same_screen = 1; 861 ev->same_screen = 1;
862 862
@@ -960,9 +960,9 @@ _touch_event_send(Elput_Device *dev, struct libinput_event_touch *event, int typ
960 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); 960 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
961 if (!ev) return; 961 if (!ev) return;
962 962
963 ev->window = dev->window; 963 ev->window = dev->seat->manager->window;
964 ev->event_window = dev->window; 964 ev->event_window = dev->seat->manager->window;
965 ev->root_window = dev->window; 965 ev->root_window = dev->seat->manager->window;
966 ev->timestamp = libinput_event_touch_get_time(event); 966 ev->timestamp = libinput_event_touch_get_time(event);
967 ev->same_screen = 1; 967 ev->same_screen = 1;
968 968
@@ -1067,9 +1067,9 @@ _touch_motion_send(Elput_Device *dev, struct libinput_event_touch *event)
1067 ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)); 1067 ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
1068 if (!ev) return; 1068 if (!ev) return;
1069 1069
1070 ev->window = dev->window; 1070 ev->window = dev->seat->manager->window;
1071 ev->event_window = dev->window; 1071 ev->event_window = dev->seat->manager->window;
1072 ev->root_window = dev->window; 1072 ev->root_window = dev->seat->manager->window;
1073 ev->timestamp = libinput_event_touch_get_time(event); 1073 ev->timestamp = libinput_event_touch_get_time(event);
1074 ev->same_screen = 1; 1074 ev->same_screen = 1;
1075 1075
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index 45778ebe91..c7f55b1590 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -1,35 +1,6 @@
1#include "elput_private.h" 1#include "elput_private.h"
2#include <libudev.h> 2#include <libudev.h>
3 3
4void
5_elput_input_window_update(Elput_Manager *manager)
6{
7 Eina_List *l, *ll;
8 Elput_Seat *seat;
9 Elput_Device *device;
10
11 if (manager->input.thread) return;
12 EINA_LIST_FOREACH(manager->input.seats, l, seat)
13 EINA_LIST_FOREACH(seat->devices, ll, device)
14 device->window = manager->window;
15}
16
17void
18_elput_input_pointer_max_update(Elput_Manager *manager)
19{
20 Eina_List *l;
21 Elput_Seat *eseat;
22
23 if (manager->input.thread) return;
24 EINA_LIST_FOREACH(manager->input.seats, l, eseat)
25 {
26 if (!eseat->ptr) continue;
27
28 eseat->ptr->maxw = manager->input.pointer_w;
29 eseat->ptr->maxh = manager->input.pointer_h;
30 }
31}
32
33static int 4static int
34_cb_open_restricted(const char *path, int flags, void *data) 5_cb_open_restricted(const char *path, int flags, void *data)
35{ 6{
@@ -101,6 +72,7 @@ _udev_seat_create(Elput_Manager *em, const char *name)
101 72
102 eseat = calloc(1, sizeof(Elput_Seat)); 73 eseat = calloc(1, sizeof(Elput_Seat));
103 if (!eseat) return NULL; 74 if (!eseat) return NULL;
75 eseat->manager = em;
104 76
105 eseat->name = eina_stringshare_add(name); 77 eseat->name = eina_stringshare_add(name);
106 em->input.seats = eina_list_append(em->input.seats, eseat); 78 em->input.seats = eina_list_append(em->input.seats, eseat);
@@ -307,11 +279,7 @@ _elput_input_init_end(void *data, Ecore_Thread *eth EINA_UNUSED)
307 _cb_input_dispatch, &manager->input, NULL, NULL); 279 _cb_input_dispatch, &manager->input, NULL, NULL);
308 280
309 if (manager->input.hdlr) 281 if (manager->input.hdlr)
310 { 282 _process_events(&manager->input);
311 _process_events(&manager->input);
312 _elput_input_window_update(manager);
313 _elput_input_pointer_max_update(manager);
314 }
315 else 283 else
316 { 284 {
317 ERR("Could not create input fd handler"); 285 ERR("Could not create input fd handler");
@@ -496,12 +464,7 @@ elput_input_devices_get(Elput_Seat *seat)
496EAPI void 464EAPI void
497elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh) 465elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh)
498{ 466{
499 Eina_List *l;
500 Elput_Seat *eseat;
501
502 EINA_SAFETY_ON_NULL_RETURN(manager); 467 EINA_SAFETY_ON_NULL_RETURN(manager);
503 manager->input.pointer_w = maxw; 468 manager->input.pointer_w = maxw;
504 manager->input.pointer_h = maxh; 469 manager->input.pointer_h = maxh;
505
506 _elput_input_pointer_max_update(manager);
507} 470}
diff --git a/src/lib/elput/elput_manager.c b/src/lib/elput/elput_manager.c
index 0dcc82055d..9b3bce46c6 100644
--- a/src/lib/elput/elput_manager.c
+++ b/src/lib/elput/elput_manager.c
@@ -131,7 +131,6 @@ elput_manager_window_set(Elput_Manager *manager, unsigned int window)
131 EINA_SAFETY_ON_NULL_RETURN(manager); 131 EINA_SAFETY_ON_NULL_RETURN(manager);
132 132
133 manager->window = window; 133 manager->window = window;
134 _elput_input_window_update(manager);
135} 134}
136 135
137EAPI const Eina_List * 136EAPI const Eina_List *
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index 0fc5d6af32..0e0edd1774 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -149,7 +149,6 @@ struct _Elput_Pointer
149 unsigned int timestamp; 149 unsigned int timestamp;
150 150
151 int minx, miny; 151 int minx, miny;
152 int maxw, maxh;
153 int hotx, hoty; 152 int hotx, hoty;
154 153
155 struct 154 struct
@@ -203,13 +202,13 @@ struct _Elput_Seat
203 Elput_Touch *touch; 202 Elput_Touch *touch;
204 203
205 Eina_List *devices; 204 Eina_List *devices;
205 Elput_Manager *manager;
206}; 206};
207 207
208struct _Elput_Device 208struct _Elput_Device
209{ 209{
210 Elput_Seat *seat; 210 Elput_Seat *seat;
211 211
212 uint32_t window;
213 uint32_t ow, oh; 212 uint32_t ow, oh;
214 213
215 const char *path; 214 const char *path;