swc

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

commit e549412ed0d6b22e7e1d14de080a11bfb9bc540d
parent 9b3ddc49f9869eb04743efb2f57812d9f4810a03
Author: Michael Forney <mforney@mforney.org>
Date:   Sat, 18 Jan 2014 05:21:03 -0800

seat: Pass name through initialize function

Diffstat:
Mlibswc/seat.c | 28+++++++++++++++++-----------
Mlibswc/seat.h | 2+-
Mlibswc/swc.c | 2+-
3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/libswc/seat.c b/libswc/seat.c @@ -35,8 +35,6 @@ #include <string.h> #include <libudev.h> -#define SEAT_NAME "seat0" - static struct { char * name; @@ -235,9 +233,14 @@ static void add_devices() udev_enumerate_unref(enumerate); } -bool swc_seat_initialize() +bool swc_seat_initialize(const char * seat_name) { - seat.name = SEAT_NAME; + if (!(seat.name = strdup(seat_name))) + { + ERROR("Could not allocate seat name string\n"); + goto error0; + } + seat.capabilities = 0; wl_list_init(&seat.resources); wl_list_init(&seat.devices); @@ -246,12 +249,12 @@ bool swc_seat_initialize() NULL, &bind_seat); if (!seat.global) - goto error0; + goto error1; if (!swc_data_device_initialize(&seat.data_device)) { ERROR("Could not initialize data device\n"); - goto error1; + goto error2; } wl_signal_add(&seat.data_device.event_signal, &data_device_listener); @@ -259,7 +262,7 @@ bool swc_seat_initialize() if (!swc_keyboard_initialize(&seat.keyboard)) { ERROR("Could not initialize keyboard\n"); - goto error2; + goto error3; } wl_signal_add(&seat.keyboard.focus.event_signal, &keyboard_focus_listener); @@ -267,19 +270,21 @@ bool swc_seat_initialize() if (!swc_pointer_initialize(&seat.pointer)) { ERROR("Could not initialize pointer\n"); - goto error3; + goto error4; } add_devices(); return true; - error3: + error4: swc_keyboard_finish(&seat.keyboard); - error2: + error3: swc_data_device_finish(&seat.data_device); - error1: + error2: wl_global_destroy(seat.global); + error1: + free(seat.name); error0: return false; } @@ -295,6 +300,7 @@ void swc_seat_finalize() swc_evdev_device_destroy(device); wl_global_destroy(seat.global); + free(seat.name); } void swc_seat_reopen_devices() diff --git a/libswc/seat.h b/libswc/seat.h @@ -33,7 +33,7 @@ struct swc_seat_global struct swc_data_device * data_device; }; -bool swc_seat_initialize(); +bool swc_seat_initialize(const char * seat_name); void swc_seat_finalize(); void swc_seat_reopen_devices(); diff --git a/libswc/swc.c b/libswc/swc.c @@ -130,7 +130,7 @@ bool swc_initialize(struct wl_display * display, goto error5; } - if (!swc_seat_initialize()) + if (!swc_seat_initialize(default_seat)) { ERROR("Could not initialize seat\n"); goto error6;