swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 3e821b0fad7926ce708dafd5d723efbd0d4935f0
parent f8e4d3d86e7655de3ad1db307b45a94de047a0f6
Author: Michael Forney <mforney@mforney.org>
Date:   Mon, 20 Jan 2014 15:34:41 -0800

seat: Reopen devices on session activation

Diffstat:
Mlibswc/seat.c | 37+++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/libswc/seat.c b/libswc/seat.c @@ -27,6 +27,7 @@ #include "event.h" #include "internal.h" #include "keyboard.h" +#include "launch.h" #include "pointer.h" #include "util.h" @@ -128,6 +129,25 @@ static struct wl_listener data_device_listener = { .notify = &handle_data_device_event }; +static void handle_launch_event(struct wl_listener * listener, void * data) +{ + struct swc_event * event = data; + struct swc_evdev_device * device; + + switch (event->type) + { + case SWC_LAUNCH_EVENT_ACTIVATED: + /* Re-open all input devices */ + wl_list_for_each(device, &seat.devices, link) + swc_evdev_device_reopen(device); + break; + } +} + +static struct wl_listener launch_listener = { + .notify = &handle_launch_event +}; + /* Wayland Seat Interface */ static void get_pointer(struct wl_client * client, struct wl_resource * resource, uint32_t id) @@ -240,16 +260,17 @@ bool swc_seat_initialize(const char * seat_name) goto error0; } - seat.capabilities = 0; - wl_list_init(&seat.resources); - wl_list_init(&seat.devices); - seat.global = wl_global_create(swc.display, &wl_seat_interface, 2, NULL, &bind_seat); if (!seat.global) goto error1; + seat.capabilities = 0; + wl_list_init(&seat.resources); + wl_list_init(&seat.devices); + wl_signal_add(&swc.launch->event_signal, &launch_listener); + if (!swc_data_device_initialize(&seat.data_device)) { ERROR("Could not initialize data device\n"); @@ -302,11 +323,3 @@ void swc_seat_finalize() free(seat.name); } -void swc_seat_reopen_devices() -{ - struct swc_evdev_device * device; - - wl_list_for_each(device, &seat.devices, link) - swc_evdev_device_reopen(device); -} -