aboutsummaryrefslogtreecommitdiff
path: root/rootston/input.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-10-21 22:03:29 -0400
committerDrew DeVault <sir@cmpwn.com>2017-10-21 22:03:48 -0400
commit16f35ecbeacd685e7d9905a7867d8c950e369f2e (patch)
treec9cd07e837b454ff227fde4d7511a98c805bca27 /rootston/input.c
parent169b68b17c668fc6d3feec92f3cf72308ba4e99c (diff)
parentd4e311a1adeee7cfd2a4404d716f3e0237ead607 (diff)
Merge branch 'master' into heghe/wl_list
Diffstat (limited to 'rootston/input.c')
-rw-r--r--rootston/input.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/rootston/input.c b/rootston/input.c
index 86a87e24..5dc7d16d 100644
--- a/rootston/input.c
+++ b/rootston/input.c
@@ -37,7 +37,7 @@ static void input_add_notify(struct wl_listener *listener, void *data) {
pointer_add(device, input);
break;
case WLR_INPUT_DEVICE_TOUCH:
- //touch_add(device, input);
+ touch_add(device, input);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
tablet_tool_add(device, input);
@@ -58,7 +58,7 @@ static void input_remove_notify(struct wl_listener *listener, void *data) {
pointer_remove(device, input);
break;
case WLR_INPUT_DEVICE_TOUCH:
- //touch_remove(device, input);
+ touch_remove(device, input);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
tablet_tool_remove(device, input);
@@ -74,15 +74,34 @@ struct roots_input *input_create(struct roots_server *server,
assert(server->desktop);
struct roots_input *input = calloc(1, sizeof(struct roots_input));
- assert(input);
+ if (input == NULL) {
+ return NULL;
+ }
input->config = config;
input->server = server;
- assert(input->theme = wlr_xcursor_theme_load("default", 16));
- assert(input->xcursor = wlr_xcursor_theme_get_cursor(input->theme, "left_ptr"));
+ input->theme = wlr_xcursor_theme_load("default", 16);
+ if (input->theme == NULL) {
+ wlr_log(L_ERROR, "Cannot load xcursor theme");
+ free(input);
+ return NULL;
+ }
+ input->xcursor = wlr_xcursor_theme_get_cursor(input->theme, "left_ptr");
+ if (input->xcursor == NULL) {
+ wlr_log(L_ERROR, "Cannot load xcursor from theme");
+ wlr_xcursor_theme_destroy(input->theme);
+ free(input);
+ return NULL;
+ }
- assert(input->wl_seat = wlr_seat_create(server->wl_display, "seat0"));
+ input->wl_seat = wlr_seat_create(server->wl_display, "seat0");
+ if (input->wl_seat == NULL) {
+ wlr_log(L_ERROR, "Cannot create seat");
+ wlr_xcursor_theme_destroy(input->theme);
+ free(input);
+ return NULL;
+ }
wlr_seat_set_capabilities(input->wl_seat, WL_SEAT_CAPABILITY_KEYBOARD
| WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_TOUCH);
@@ -91,15 +110,10 @@ struct roots_input *input_create(struct roots_server *server,
wl_list_init(&input->touch);
wl_list_init(&input->tablet_tools);
- wl_list_init(&input->input_add.link);
input->input_add.notify = input_add_notify;
- wl_list_init(&input->input_remove.link);
+ wl_signal_add(&server->backend->events.input_add, &input->input_add);
input->input_remove.notify = input_remove_notify;
-
- wl_signal_add(&server->backend->events.input_add,
- &input->input_add);
- wl_signal_add(&server->backend->events.input_remove,
- &input->input_remove);
+ wl_signal_add(&server->backend->events.input_remove, &input->input_remove);
input->cursor = wlr_cursor_create();
cursor_initialize(input);