diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-05-12 12:08:32 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-05-12 12:08:25 -0400 |
commit | 2e5251b36431e162fdb309c364661de2f80179b3 (patch) | |
tree | c1982df7ef40c02dfa89678664e7bd8cdcbd0765 /src | |
parent | d119fdded93feaf13d2c9ea6ca47b4d84b57bb08 (diff) |
ecore-wl2: add events for changes in keymap, selection, and kbd repeat rate
@feature
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ecore_wl2/Ecore_Wl2.h | 21 | ||||
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2.c | 11 | ||||
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_dnd.c | 8 | ||||
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_input.c | 19 |
4 files changed, 58 insertions, 1 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 9c3e95994f..cd8146fd46 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h | |||
@@ -180,6 +180,12 @@ typedef struct _Ecore_Wl2_Event_Data_Source_Send | |||
180 | Ecore_Wl2_Display *display; | 180 | Ecore_Wl2_Display *display; |
181 | } Ecore_Wl2_Event_Data_Source_Send; | 181 | } Ecore_Wl2_Event_Data_Source_Send; |
182 | 182 | ||
183 | typedef struct Ecore_Wl2_Event_Seat_Selection | ||
184 | { | ||
185 | unsigned int seat; | ||
186 | Ecore_Wl2_Display *display; | ||
187 | } Ecore_Wl2_Event_Seat_Selection; | ||
188 | |||
183 | typedef struct _Ecore_Wl2_Event_Seat_Name | 189 | typedef struct _Ecore_Wl2_Event_Seat_Name |
184 | { | 190 | { |
185 | Eina_Stringshare *name; | 191 | Eina_Stringshare *name; |
@@ -237,6 +243,18 @@ typedef struct _Ecore_Wl2_Event_Window_Configure_Complete | |||
237 | unsigned int win; | 243 | unsigned int win; |
238 | } Ecore_Wl2_Event_Window_Configure_Complete; | 244 | } Ecore_Wl2_Event_Window_Configure_Complete; |
239 | 245 | ||
246 | typedef struct _Ecore_Wl2_Event_Input_Keymap_Changed | ||
247 | { | ||
248 | unsigned int id; | ||
249 | Ecore_Wl2_Display *display; | ||
250 | } Ecore_Wl2_Event_Seat_Keymap_Changed; | ||
251 | |||
252 | typedef struct Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed | ||
253 | { | ||
254 | unsigned int id; | ||
255 | Ecore_Wl2_Display *display; | ||
256 | } Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed; | ||
257 | |||
240 | typedef struct _Ecore_Wl2_Event_Sync_Done | 258 | typedef struct _Ecore_Wl2_Event_Sync_Done |
241 | { | 259 | { |
242 | Ecore_Wl2_Display *display; | 260 | Ecore_Wl2_Display *display; |
@@ -289,6 +307,9 @@ EAPI extern int ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED; /** @since 1.19 */ | |||
289 | EAPI extern int ECORE_WL2_EVENT_DEVICE_ADDED; /** @since 1.19 */ | 307 | EAPI extern int ECORE_WL2_EVENT_DEVICE_ADDED; /** @since 1.19 */ |
290 | EAPI extern int ECORE_WL2_EVENT_DEVICE_REMOVED; /** @since 1.19 */ | 308 | EAPI extern int ECORE_WL2_EVENT_DEVICE_REMOVED; /** @since 1.19 */ |
291 | EAPI extern int ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE; /** @since 1.19 */ | 309 | EAPI extern int ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE; /** @since 1.19 */ |
310 | EAPI extern int ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED; /** @since 1.20 */ | ||
311 | EAPI extern int ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED; /** @since 1.20 */ | ||
312 | EAPI extern int ECORE_WL2_EVENT_SEAT_SELECTION; /** @since 1.20 */ | ||
292 | 313 | ||
293 | /** | 314 | /** |
294 | * @file | 315 | * @file |
diff --git a/src/lib/ecore_wl2/ecore_wl2.c b/src/lib/ecore_wl2/ecore_wl2.c index 7c1b1f0b49..b9c9ec54fa 100644 --- a/src/lib/ecore_wl2/ecore_wl2.c +++ b/src/lib/ecore_wl2/ecore_wl2.c | |||
@@ -36,6 +36,9 @@ EAPI int ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED = 0; | |||
36 | EAPI int ECORE_WL2_EVENT_DEVICE_ADDED = 0; | 36 | EAPI int ECORE_WL2_EVENT_DEVICE_ADDED = 0; |
37 | EAPI int ECORE_WL2_EVENT_DEVICE_REMOVED = 0; | 37 | EAPI int ECORE_WL2_EVENT_DEVICE_REMOVED = 0; |
38 | EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE = 0; | 38 | EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE = 0; |
39 | EAPI int ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED = 0; | ||
40 | EAPI int ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED = 0; | ||
41 | EAPI int ECORE_WL2_EVENT_SEAT_SELECTION = 0; | ||
39 | 42 | ||
40 | EAPI int _ecore_wl2_event_window_www = -1; | 43 | EAPI int _ecore_wl2_event_window_www = -1; |
41 | EAPI int _ecore_wl2_event_window_www_drag = -1; | 44 | EAPI int _ecore_wl2_event_window_www_drag = -1; |
@@ -101,6 +104,9 @@ ecore_wl2_init(void) | |||
101 | _ecore_wl2_event_window_www = ecore_event_type_new(); | 104 | _ecore_wl2_event_window_www = ecore_event_type_new(); |
102 | _ecore_wl2_event_window_www_drag = ecore_event_type_new(); | 105 | _ecore_wl2_event_window_www_drag = ecore_event_type_new(); |
103 | ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE = ecore_event_type_new(); | 106 | ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE = ecore_event_type_new(); |
107 | ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED = ecore_event_type_new(); | ||
108 | ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED = ecore_event_type_new(); | ||
109 | ECORE_WL2_EVENT_SEAT_SELECTION = ecore_event_type_new(); | ||
104 | } | 110 | } |
105 | if (!no_session_recovery) | 111 | if (!no_session_recovery) |
106 | no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY"); | 112 | no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY"); |
@@ -154,7 +160,10 @@ ecore_wl2_shutdown(void) | |||
154 | ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED, | 160 | ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED, |
155 | ECORE_WL2_EVENT_DEVICE_ADDED, | 161 | ECORE_WL2_EVENT_DEVICE_ADDED, |
156 | ECORE_WL2_EVENT_DEVICE_REMOVED, | 162 | ECORE_WL2_EVENT_DEVICE_REMOVED, |
157 | ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE); | 163 | ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, |
164 | ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, | ||
165 | ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, | ||
166 | ECORE_WL2_EVENT_SEAT_SELECTION); | ||
158 | 167 | ||
159 | /* shutdown Ecore_Event */ | 168 | /* shutdown Ecore_Event */ |
160 | ecore_event_shutdown(); | 169 | ecore_event_shutdown(); |
diff --git a/src/lib/ecore_wl2/ecore_wl2_dnd.c b/src/lib/ecore_wl2/ecore_wl2_dnd.c index 132eeb3ebb..830ca4e212 100644 --- a/src/lib/ecore_wl2/ecore_wl2_dnd.c +++ b/src/lib/ecore_wl2/ecore_wl2_dnd.c | |||
@@ -379,11 +379,19 @@ _ecore_wl2_dnd_drop(Ecore_Wl2_Input *input) | |||
379 | void | 379 | void |
380 | _ecore_wl2_dnd_selection(Ecore_Wl2_Input *input, struct wl_data_offer *offer) | 380 | _ecore_wl2_dnd_selection(Ecore_Wl2_Input *input, struct wl_data_offer *offer) |
381 | { | 381 | { |
382 | Ecore_Wl2_Event_Seat_Selection *ev; | ||
383 | |||
382 | if (input->selection) _ecore_wl2_offer_unref(input->selection); | 384 | if (input->selection) _ecore_wl2_offer_unref(input->selection); |
383 | input->selection = NULL; | 385 | input->selection = NULL; |
384 | 386 | ||
385 | if (offer) | 387 | if (offer) |
386 | input->selection = wl_data_offer_get_user_data(offer); | 388 | input->selection = wl_data_offer_get_user_data(offer); |
389 | ev = malloc(sizeof(Ecore_Wl2_Event_Seat_Selection)); | ||
390 | EINA_SAFETY_ON_NULL_RETURN(ev); | ||
391 | ev->seat = input->id; | ||
392 | ev->display = input->display; | ||
393 | ev->display->refs++; | ||
394 | ecore_event_add(ECORE_WL2_EVENT_SEAT_SELECTION, ev, _display_event_free, ev->display); | ||
387 | } | 395 | } |
388 | 396 | ||
389 | void | 397 | void |
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c index 9c7f5d959a..1cd8ea8ede 100644 --- a/src/lib/ecore_wl2/ecore_wl2_input.c +++ b/src/lib/ecore_wl2/ecore_wl2_input.c | |||
@@ -824,6 +824,16 @@ _keyboard_cb_keymap(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsign | |||
824 | input->xkb.keymap = NULL; | 824 | input->xkb.keymap = NULL; |
825 | return; | 825 | return; |
826 | } | 826 | } |
827 | { | ||
828 | Ecore_Wl2_Event_Seat_Keymap_Changed *ev = malloc(sizeof(Ecore_Wl2_Event_Seat_Keymap_Changed)); | ||
829 | if (ev) | ||
830 | { | ||
831 | ev->id = input->id; | ||
832 | ev->display = input->display; | ||
833 | input->display->refs++; | ||
834 | ecore_event_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, ev, _display_event_free, ev->display); | ||
835 | } | ||
836 | } | ||
827 | 837 | ||
828 | input->xkb.control_mask = | 838 | input->xkb.control_mask = |
829 | 1 << xkb_map_mod_get_index(input->xkb.keymap, XKB_MOD_NAME_CTRL); | 839 | 1 << xkb_map_mod_get_index(input->xkb.keymap, XKB_MOD_NAME_CTRL); |
@@ -1019,6 +1029,7 @@ static void | |||
1019 | _keyboard_cb_repeat_setup(void *data, struct wl_keyboard *keyboard EINA_UNUSED, int32_t rate, int32_t delay) | 1029 | _keyboard_cb_repeat_setup(void *data, struct wl_keyboard *keyboard EINA_UNUSED, int32_t rate, int32_t delay) |
1020 | { | 1030 | { |
1021 | Ecore_Wl2_Input *input; | 1031 | Ecore_Wl2_Input *input; |
1032 | Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed *ev; | ||
1022 | 1033 | ||
1023 | input = data; | 1034 | input = data; |
1024 | if (!input) return; | 1035 | if (!input) return; |
@@ -1032,6 +1043,14 @@ _keyboard_cb_repeat_setup(void *data, struct wl_keyboard *keyboard EINA_UNUSED, | |||
1032 | input->repeat.enabled = EINA_TRUE; | 1043 | input->repeat.enabled = EINA_TRUE; |
1033 | input->repeat.rate = (1.0 / rate); | 1044 | input->repeat.rate = (1.0 / rate); |
1034 | input->repeat.delay = (delay / 1000.0); | 1045 | input->repeat.delay = (delay / 1000.0); |
1046 | ev = malloc(sizeof(Ecore_Wl2_Event_Seat_Keymap_Changed)); | ||
1047 | if (ev) | ||
1048 | { | ||
1049 | ev->id = input->id; | ||
1050 | ev->display = input->display; | ||
1051 | ev->display->refs++; | ||
1052 | ecore_event_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, ev, _display_event_free, ev->display); | ||
1053 | } | ||
1035 | } | 1054 | } |
1036 | 1055 | ||
1037 | static const struct wl_keyboard_listener _keyboard_listener = | 1056 | static const struct wl_keyboard_listener _keyboard_listener = |