commit 3e821b0
Michael Forney
·
2014-01-20 23:34:41 +0000 UTC
parent f8e4d3d
seat: Reopen devices on session activation
1 files changed,
+25,
-12
+25,
-12
1@@ -27,6 +27,7 @@
2 #include "event.h"
3 #include "internal.h"
4 #include "keyboard.h"
5+#include "launch.h"
6 #include "pointer.h"
7 #include "util.h"
8
9@@ -128,6 +129,25 @@ static struct wl_listener data_device_listener = {
10 .notify = &handle_data_device_event
11 };
12
13+static void handle_launch_event(struct wl_listener * listener, void * data)
14+{
15+ struct swc_event * event = data;
16+ struct swc_evdev_device * device;
17+
18+ switch (event->type)
19+ {
20+ case SWC_LAUNCH_EVENT_ACTIVATED:
21+ /* Re-open all input devices */
22+ wl_list_for_each(device, &seat.devices, link)
23+ swc_evdev_device_reopen(device);
24+ break;
25+ }
26+}
27+
28+static struct wl_listener launch_listener = {
29+ .notify = &handle_launch_event
30+};
31+
32 /* Wayland Seat Interface */
33 static void get_pointer(struct wl_client * client, struct wl_resource * resource,
34 uint32_t id)
35@@ -240,16 +260,17 @@ bool swc_seat_initialize(const char * seat_name)
36 goto error0;
37 }
38
39- seat.capabilities = 0;
40- wl_list_init(&seat.resources);
41- wl_list_init(&seat.devices);
42-
43 seat.global = wl_global_create(swc.display, &wl_seat_interface, 2,
44 NULL, &bind_seat);
45
46 if (!seat.global)
47 goto error1;
48
49+ seat.capabilities = 0;
50+ wl_list_init(&seat.resources);
51+ wl_list_init(&seat.devices);
52+ wl_signal_add(&swc.launch->event_signal, &launch_listener);
53+
54 if (!swc_data_device_initialize(&seat.data_device))
55 {
56 ERROR("Could not initialize data device\n");
57@@ -302,11 +323,3 @@ void swc_seat_finalize()
58 free(seat.name);
59 }
60
61-void swc_seat_reopen_devices()
62-{
63- struct swc_evdev_device * device;
64-
65- wl_list_for_each(device, &seat.devices, link)
66- swc_evdev_device_reopen(device);
67-}
68-