seat: move initial cursor center to dedicated function

This commit is contained in:
Jonathan GUILLOT 2023-11-08 17:22:06 +01:00 committed by Simon Ser
parent 4dc3cf80b2
commit efbf7c035b
3 changed files with 11 additions and 5 deletions

9
seat.c
View file

@ -944,3 +944,12 @@ seat_set_focus(struct cg_seat *seat, struct cg_view *view)
process_cursor_motion(seat, -1);
}
void
seat_center_cursor(struct cg_seat *seat)
{
/* Place the cursor in the center of the output layout. */
struct wlr_box layout_box;
wlr_output_layout_get_box(seat->server->output_layout, NULL, &layout_box);
wlr_cursor_warp(seat->cursor, NULL, layout_box.width / 2, layout_box.height / 2);
}