mirror of
https://github.com/cage-kiosk/cage.git
synced 2025-10-29 05:40:19 -04:00
seat: move initial cursor center to dedicated function
This commit is contained in:
parent
4dc3cf80b2
commit
efbf7c035b
3 changed files with 11 additions and 5 deletions
6
cage.c
6
cage.c
|
|
@ -579,11 +579,7 @@ main(int argc, char *argv[])
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Place the cursor in the center of the output layout. */
|
seat_center_cursor(server.seat);
|
||||||
struct wlr_box layout_box;
|
|
||||||
wlr_output_layout_get_box(server.output_layout, NULL, &layout_box);
|
|
||||||
wlr_cursor_warp(server.seat->cursor, NULL, layout_box.width / 2, layout_box.height / 2);
|
|
||||||
|
|
||||||
wl_display_run(server.wl_display);
|
wl_display_run(server.wl_display);
|
||||||
|
|
||||||
#if CAGE_HAS_XWAYLAND
|
#if CAGE_HAS_XWAYLAND
|
||||||
|
|
|
||||||
9
seat.c
9
seat.c
|
|
@ -944,3 +944,12 @@ seat_set_focus(struct cg_seat *seat, struct cg_view *view)
|
||||||
|
|
||||||
process_cursor_motion(seat, -1);
|
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);
|
||||||
|
}
|
||||||
|
|
|
||||||
1
seat.h
1
seat.h
|
|
@ -91,5 +91,6 @@ struct cg_seat *seat_create(struct cg_server *server, struct wlr_backend *backen
|
||||||
void seat_destroy(struct cg_seat *seat);
|
void seat_destroy(struct cg_seat *seat);
|
||||||
struct cg_view *seat_get_focus(struct cg_seat *seat);
|
struct cg_view *seat_get_focus(struct cg_seat *seat);
|
||||||
void seat_set_focus(struct cg_seat *seat, struct cg_view *view);
|
void seat_set_focus(struct cg_seat *seat, struct cg_view *view);
|
||||||
|
void seat_center_cursor(struct cg_seat *seat);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue