Commit 19a9cfed authored by Guido Gunther's avatar Guido Gunther Committed by Sebastian Krzyszkowiak
Browse files

cursor: g_assert on NULL cursor

Don't try to go on without a cursor (which can only happen when calloc
fails). wlroots also only returns NULL in case of memory problems.

This allows to remove the NULL checks elsewhere
parent f26fa012
Pipeline #65798 passed with stages
in 26 minutes and 50 seconds
......@@ -20,14 +20,11 @@
struct roots_cursor *roots_cursor_create(struct roots_seat *seat) {
struct roots_cursor *cursor = calloc(1, sizeof(struct roots_cursor));
if (!cursor) {
return NULL;
}
g_assert (cursor);
cursor->cursor = wlr_cursor_create();
if (!cursor->cursor) {
free(cursor);
return NULL;
}
g_assert (cursor->cursor);
cursor->default_xcursor = ROOTS_XCURSOR_DEFAULT;
return cursor;
}
......
......@@ -527,9 +527,7 @@ void roots_seat_configure_cursor(struct roots_seat *seat) {
static void roots_seat_init_cursor(struct roots_seat *seat) {
PhocServer *server = phoc_server_get_default ();
seat->cursor = roots_cursor_create(seat);
if (!seat->cursor) {
return;
}
seat->cursor->seat = seat;
struct wlr_cursor *wlr_cursor = seat->cursor->cursor;
PhocDesktop *desktop = server->desktop;
......@@ -1492,10 +1490,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
NULL, 0, NULL);
}
if (seat->cursor) {
roots_cursor_update_focus(seat->cursor);
}
roots_cursor_update_focus(seat->cursor);
roots_input_method_relay_set_focus(&seat->im_relay, view->wlr_surface);
}
......@@ -1542,10 +1537,7 @@ void roots_seat_set_focus_layer(struct roots_seat *seat,
NULL, 0, NULL);
}
if (seat->cursor) {
roots_cursor_update_focus(seat->cursor);
}
roots_cursor_update_focus(seat->cursor);
roots_input_method_relay_set_focus(&seat->im_relay, layer->surface);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment