summaryrefslogtreecommitdiff
path: root/src/lib/elput
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-06-21 12:46:29 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-06-21 12:46:29 -0400
commitb2a4f45790bd6d3beba494d55e269cc0650f0848 (patch)
tree204c45b708cd9d947ad18266ab00e42ca5d83645 /src/lib/elput
parentc39e8e75555573c1c1083794bb04923a6229ae65 (diff)
elput: Support suspending and resuming inputs on vt switch
This patch fixes an issue where input would stop working when you vt-switch away and back again in a running Enlightenment Wayland session. Basically, when we vt-switch away, we need to tell libinput to suspend input event processing, and when we return to re-enable it. Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib/elput')
-rw-r--r--src/lib/elput/elput_input.c27
-rw-r--r--src/lib/elput/elput_logind.c5
-rw-r--r--src/lib/elput/elput_private.h3
3 files changed, 34 insertions, 1 deletions
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index 57b9b05d76..1baf2f8dc8 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -339,6 +339,33 @@ _elput_input_init_thread(void *data, Ecore_Thread *eth EINA_UNUSED)
339 } 339 }
340} 340}
341 341
342void
343_elput_input_enable(Elput_Manager *manager)
344{
345 if (!manager->input.hdlr)
346 {
347 manager->input.hdlr =
348 ecore_main_fd_handler_add(libinput_get_fd(manager->input.lib),
349 ECORE_FD_READ, _cb_input_dispatch,
350 &manager->input, NULL, NULL);
351 }
352
353 if (manager->input.suspended)
354 {
355 if (libinput_resume(manager->input.lib) != 0) return;
356 manager->input.suspended = EINA_FALSE;
357 _process_events(&manager->input);
358 }
359}
360
361void
362_elput_input_disable(Elput_Manager *manager)
363{
364 libinput_suspend(manager->input.lib);
365 _process_events(&manager->input);
366 manager->input.suspended = EINA_TRUE;
367}
368
342EAPI Eina_Bool 369EAPI Eina_Bool
343elput_input_init(Elput_Manager *manager) 370elput_input_init(Elput_Manager *manager)
344{ 371{
diff --git a/src/lib/elput/elput_logind.c b/src/lib/elput/elput_logind.c
index fedb2b09e6..206f6e8337 100644
--- a/src/lib/elput/elput_logind.c
+++ b/src/lib/elput/elput_logind.c
@@ -17,6 +17,11 @@ _logind_session_active_send(Elput_Manager *em, Eina_Bool active)
17{ 17{
18 Elput_Event_Session_Active *ev; 18 Elput_Event_Session_Active *ev;
19 19
20 if (active)
21 _elput_input_enable(em);
22 else
23 _elput_input_disable(em);
24
20 ev = calloc(1, sizeof(Elput_Event_Session_Active)); 25 ev = calloc(1, sizeof(Elput_Event_Session_Active));
21 if (!ev) return; 26 if (!ev) return;
22 27
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index cda235e49d..59ec76e36a 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -264,7 +264,8 @@ typedef struct _Elput_Async_Open
264 int flags; 264 int flags;
265} Elput_Async_Open; 265} Elput_Async_Open;
266 266
267void _elput_input_window_update(Elput_Manager *manager); 267void _elput_input_enable(Elput_Manager *manager);
268void _elput_input_disable(Elput_Manager *manager);
268 269
269int _evdev_event_process(struct libinput_event *event); 270int _evdev_event_process(struct libinput_event *event);
270Elput_Device *_evdev_device_create(Elput_Seat *seat, struct libinput_device *device); 271Elput_Device *_evdev_device_create(Elput_Seat *seat, struct libinput_device *device);