diff options
author | Bruno Dilly <bdilly@profusion.mobi> | 2016-10-04 15:19:51 -0300 |
---|---|---|
committer | Bruno Dilly <bdilly@profusion.mobi> | 2016-11-01 16:06:19 -0200 |
commit | d7b1a5dfebfee95e77c4c4f2037755b75b7be908 (patch) | |
tree | 11afbb17b16436a840933a5dea9805d6b6e79abb /src | |
parent | 44fc1c6eccd98fa0b7353a89863da4c0f3973818 (diff) |
ecore_wl2: add ecore event for seat name change
And handle it on ecore_evas/wayland, properly
setting the evas device names.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ecore_wl2/Ecore_Wl2.h | 7 | ||||
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2.c | 3 | ||||
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_input.c | 29 | ||||
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_private.h | 1 | ||||
-rw-r--r-- | src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c | 32 |
5 files changed, 67 insertions, 5 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 30fb5d97b5..19c9965ede 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h | |||
@@ -139,6 +139,12 @@ typedef struct _Ecore_Wl2_Event_Data_Source_Send | |||
139 | int fd; | 139 | int fd; |
140 | } Ecore_Wl2_Event_Data_Source_Send; | 140 | } Ecore_Wl2_Event_Data_Source_Send; |
141 | 141 | ||
142 | typedef struct _Ecore_Wl2_Event_Seat_Name | ||
143 | { | ||
144 | Eina_Stringshare *name; | ||
145 | unsigned int id; | ||
146 | } Ecore_Wl2_Event_Seat_Name; | ||
147 | |||
142 | typedef enum | 148 | typedef enum |
143 | { | 149 | { |
144 | ECORE_WL2_SELECTION_CNP, | 150 | ECORE_WL2_SELECTION_CNP, |
@@ -203,6 +209,7 @@ EAPI extern int ECORE_WL2_EVENT_DATA_SOURCE_SEND; /** @since 1.17 */ | |||
203 | EAPI extern int ECORE_WL2_EVENT_WINDOW_CONFIGURE; /** @since 1.17 */ | 209 | EAPI extern int ECORE_WL2_EVENT_WINDOW_CONFIGURE; /** @since 1.17 */ |
204 | EAPI extern int ECORE_WL2_EVENT_SYNC_DONE; /** @since 1.17 */ | 210 | EAPI extern int ECORE_WL2_EVENT_SYNC_DONE; /** @since 1.17 */ |
205 | EAPI extern int ECORE_WL2_EVENT_OFFER_DATA_READY; /** @since 1.19 */ | 211 | EAPI extern int ECORE_WL2_EVENT_OFFER_DATA_READY; /** @since 1.19 */ |
212 | EAPI extern int ECORE_WL2_EVENT_SEAT_NAME_CHANGED; /** @since 1.19 */ | ||
206 | /** | 213 | /** |
207 | * @file | 214 | * @file |
208 | * @brief Ecore functions for dealing with the Wayland display protocol | 215 | * @brief Ecore functions for dealing with the Wayland display protocol |
diff --git a/src/lib/ecore_wl2/ecore_wl2.c b/src/lib/ecore_wl2/ecore_wl2.c index 397f8e3f16..ceb6dce80f 100644 --- a/src/lib/ecore_wl2/ecore_wl2.c +++ b/src/lib/ecore_wl2/ecore_wl2.c | |||
@@ -31,6 +31,7 @@ EAPI int ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0; | |||
31 | EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0; | 31 | EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0; |
32 | EAPI int ECORE_WL2_EVENT_SYNC_DONE = 0; | 32 | EAPI int ECORE_WL2_EVENT_SYNC_DONE = 0; |
33 | EAPI int ECORE_WL2_EVENT_OFFER_DATA_READY = 0; | 33 | EAPI int ECORE_WL2_EVENT_OFFER_DATA_READY = 0; |
34 | EAPI int ECORE_WL2_EVENT_SEAT_NAME_CHANGED = 0; | ||
34 | 35 | ||
35 | EAPI int _ecore_wl2_event_window_www = -1; | 36 | EAPI int _ecore_wl2_event_window_www = -1; |
36 | EAPI int _ecore_wl2_event_window_www_drag = -1; | 37 | EAPI int _ecore_wl2_event_window_www_drag = -1; |
@@ -89,6 +90,7 @@ ecore_wl2_init(void) | |||
89 | ECORE_WL2_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); | 90 | ECORE_WL2_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); |
90 | ECORE_WL2_EVENT_SYNC_DONE = ecore_event_type_new(); | 91 | ECORE_WL2_EVENT_SYNC_DONE = ecore_event_type_new(); |
91 | ECORE_WL2_EVENT_OFFER_DATA_READY = ecore_event_type_new(); | 92 | ECORE_WL2_EVENT_OFFER_DATA_READY = ecore_event_type_new(); |
93 | ECORE_WL2_EVENT_SEAT_NAME_CHANGED = ecore_event_type_new(); | ||
92 | _ecore_wl2_event_window_www = ecore_event_type_new(); | 94 | _ecore_wl2_event_window_www = ecore_event_type_new(); |
93 | _ecore_wl2_event_window_www_drag = ecore_event_type_new(); | 95 | _ecore_wl2_event_window_www_drag = ecore_event_type_new(); |
94 | } | 96 | } |
@@ -140,6 +142,7 @@ ecore_wl2_shutdown(void) | |||
140 | ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0; | 142 | ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0; |
141 | ECORE_WL2_EVENT_SYNC_DONE = 0; | 143 | ECORE_WL2_EVENT_SYNC_DONE = 0; |
142 | ECORE_WL2_EVENT_OFFER_DATA_READY = 0; | 144 | ECORE_WL2_EVENT_OFFER_DATA_READY = 0; |
145 | ECORE_WL2_EVENT_SEAT_NAME_CHANGED = 0; | ||
143 | 146 | ||
144 | /* shutdown Ecore_Event */ | 147 | /* shutdown Ecore_Event */ |
145 | ecore_event_shutdown(); | 148 | ecore_event_shutdown(); |
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c index b89e3e1484..36013fba05 100644 --- a/src/lib/ecore_wl2/ecore_wl2_input.c +++ b/src/lib/ecore_wl2/ecore_wl2_input.c | |||
@@ -1188,11 +1188,31 @@ _seat_cb_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability | |||
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | static void | 1190 | static void |
1191 | _seat_cb_name(void *data EINA_UNUSED, struct wl_seat *seat EINA_UNUSED, const char *name EINA_UNUSED) | 1191 | _cb_seat_event_free(void *data EINA_UNUSED, void *event) |
1192 | { | 1192 | { |
1193 | /* NB: No-Op as we don't care about seat name right now. | 1193 | Ecore_Wl2_Event_Seat_Name *ev; |
1194 | * | 1194 | |
1195 | * This will likely change as we hash out remaining multi-seat issues */ | 1195 | ev = event; |
1196 | eina_stringshare_del(ev->name); | ||
1197 | free(ev); | ||
1198 | } | ||
1199 | |||
1200 | static void | ||
1201 | _seat_cb_name(void *data, struct wl_seat *seat EINA_UNUSED, const char *name) | ||
1202 | { | ||
1203 | Ecore_Wl2_Event_Seat_Name *ev; | ||
1204 | Ecore_Wl2_Input *input; | ||
1205 | |||
1206 | input = data; | ||
1207 | |||
1208 | ev = calloc(1, sizeof(Ecore_Wl2_Event_Seat_Name)); | ||
1209 | EINA_SAFETY_ON_NULL_RETURN(ev); | ||
1210 | |||
1211 | ev->id = input->id; | ||
1212 | ev->name = eina_stringshare_add(name); | ||
1213 | |||
1214 | ecore_event_add(ECORE_WL2_EVENT_SEAT_NAME_CHANGED, ev, | ||
1215 | _cb_seat_event_free, NULL); | ||
1196 | } | 1216 | } |
1197 | 1217 | ||
1198 | static const struct wl_seat_listener _seat_listener = | 1218 | static const struct wl_seat_listener _seat_listener = |
@@ -1241,6 +1261,7 @@ _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id, unsigned int v | |||
1241 | input = calloc(1, sizeof(Ecore_Wl2_Input)); | 1261 | input = calloc(1, sizeof(Ecore_Wl2_Input)); |
1242 | if (!input) return; | 1262 | if (!input) return; |
1243 | 1263 | ||
1264 | input->id = id; | ||
1244 | input->display = display; | 1265 | input->display = display; |
1245 | input->seat_version = version; | 1266 | input->seat_version = version; |
1246 | input->repeat.rate = 0.025; | 1267 | input->repeat.rate = 0.025; |
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index ab619aa3c5..30f9d88473 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h | |||
@@ -405,6 +405,7 @@ struct _Ecore_Wl2_Input | |||
405 | Ecore_Wl2_Offer *drag, *selection; | 405 | Ecore_Wl2_Offer *drag, *selection; |
406 | 406 | ||
407 | unsigned int seat_version; | 407 | unsigned int seat_version; |
408 | unsigned int id; | ||
408 | }; | 409 | }; |
409 | 410 | ||
410 | typedef struct Ecore_Wl2_Event_Window_WWW | 411 | typedef struct Ecore_Wl2_Event_Window_WWW |
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index d420fb4489..980531ca72 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c | |||
@@ -44,7 +44,7 @@ EVAS_SMART_SUBCLASS_NEW(_smart_frame_type, _ecore_evas_wl_frame, | |||
44 | 44 | ||
45 | /* local variables */ | 45 | /* local variables */ |
46 | static int _ecore_evas_wl_init_count = 0; | 46 | static int _ecore_evas_wl_init_count = 0; |
47 | static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[10]; | 47 | static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[11]; |
48 | 48 | ||
49 | static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location); | 49 | static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location); |
50 | 50 | ||
@@ -535,6 +535,33 @@ _ecore_evas_wl_common_cb_global_removed(void *d EINA_UNUSED, int t EINA_UNUSED, | |||
535 | return ECORE_CALLBACK_PASS_ON; | 535 | return ECORE_CALLBACK_PASS_ON; |
536 | } | 536 | } |
537 | 537 | ||
538 | static Eina_Bool | ||
539 | _ecore_evas_wl_common_cb_seat_name_changed(void *d EINA_UNUSED, int t EINA_UNUSED, void *event) | ||
540 | { | ||
541 | Ecore_Wl2_Event_Seat_Name *ev = event; | ||
542 | Ecore_Evas *ee; | ||
543 | Eina_List *l, *ll; | ||
544 | |||
545 | EINA_LIST_FOREACH(ee_list, l, ee) | ||
546 | { | ||
547 | Ecore_Evas_Engine_Wl_Data *wdata; | ||
548 | EE_Wl_Device *device; | ||
549 | |||
550 | wdata = ee->engine.data; | ||
551 | |||
552 | EINA_LIST_FOREACH(wdata->devices_list, ll, device) | ||
553 | { | ||
554 | if (device->id == ev->id) | ||
555 | { | ||
556 | evas_device_name_set(device->seat, ev->name); | ||
557 | break; | ||
558 | } | ||
559 | } | ||
560 | } | ||
561 | |||
562 | return ECORE_CALLBACK_PASS_ON; | ||
563 | } | ||
564 | |||
538 | int | 565 | int |
539 | _ecore_evas_wl_common_init(void) | 566 | _ecore_evas_wl_common_init(void) |
540 | { | 567 | { |
@@ -573,6 +600,9 @@ _ecore_evas_wl_common_init(void) | |||
573 | _ecore_evas_wl_event_hdls[9] = | 600 | _ecore_evas_wl_event_hdls[9] = |
574 | ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_REMOVED, | 601 | ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_REMOVED, |
575 | _ecore_evas_wl_common_cb_global_removed, NULL); | 602 | _ecore_evas_wl_common_cb_global_removed, NULL); |
603 | _ecore_evas_wl_event_hdls[10] = | ||
604 | ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_NAME_CHANGED, | ||
605 | _ecore_evas_wl_common_cb_seat_name_changed, NULL); | ||
576 | 606 | ||
577 | ecore_event_evas_init(); | 607 | ecore_event_evas_init(); |
578 | 608 | ||