Move xcursor stuff into its own file

This commit is contained in:
emersion 2017-10-27 19:09:38 +02:00
parent ad27cc3bff
commit ec5beeb8b8
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
6 changed files with 65 additions and 40 deletions

View file

@ -81,16 +81,17 @@ struct roots_input *input_create(struct roots_server *server,
input->config = config;
input->server = server;
input->theme = wlr_xcursor_theme_load("default", 16);
if (input->theme == NULL) {
input->xcursor_theme = wlr_xcursor_theme_load("default", 16);
if (input->xcursor_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) {
struct wlr_xcursor *xcursor = get_default_xcursor(input->xcursor_theme);
if (xcursor == NULL) {
wlr_log(L_ERROR, "Cannot load xcursor from theme");
wlr_xcursor_theme_destroy(input->theme);
wlr_xcursor_theme_destroy(input->xcursor_theme);
free(input);
return NULL;
}
@ -98,7 +99,7 @@ struct roots_input *input_create(struct roots_server *server,
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);
wlr_xcursor_theme_destroy(input->xcursor_theme);
free(input);
return NULL;
}
@ -117,7 +118,7 @@ struct roots_input *input_create(struct roots_server *server,
input->cursor = wlr_cursor_create();
cursor_initialize(input);
wlr_cursor_set_xcursor(input->cursor, input->xcursor);
wlr_cursor_set_xcursor(input->cursor, xcursor);
wlr_cursor_attach_output_layout(input->cursor, server->desktop->layout);
wlr_cursor_map_to_region(input->cursor, config->cursor.mapped_box);