rootston: keep one xcursor_theme per seat
This commit is contained in:
parent
aaf0691883
commit
2dccb11741
|
@ -30,6 +30,7 @@ struct roots_cursor {
|
||||||
enum roots_cursor_mode mode;
|
enum roots_cursor_mode mode;
|
||||||
|
|
||||||
// state from input (review if this is necessary)
|
// state from input (review if this is necessary)
|
||||||
|
struct roots_xcursor_theme *xcursor_theme;
|
||||||
struct wlr_seat *wl_seat;
|
struct wlr_seat *wl_seat;
|
||||||
struct wl_client *cursor_client;
|
struct wl_client *cursor_client;
|
||||||
int offs_x, offs_y;
|
int offs_x, offs_y;
|
||||||
|
|
|
@ -44,7 +44,7 @@ static void roots_cursor_update_position(struct roots_cursor *cursor, uint32_t t
|
||||||
set_compositor_cursor = view_client != cursor->cursor_client;
|
set_compositor_cursor = view_client != cursor->cursor_client;
|
||||||
}
|
}
|
||||||
if (set_compositor_cursor) {
|
if (set_compositor_cursor) {
|
||||||
roots_xcursor_theme_set_default(desktop->xcursor_theme,
|
roots_xcursor_theme_set_default(cursor->xcursor_theme,
|
||||||
cursor->cursor);
|
cursor->cursor);
|
||||||
cursor->cursor_client = NULL;
|
cursor->cursor_client = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,13 +241,14 @@ void output_add_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_output_layout_add_auto(desktop->layout, wlr_output);
|
wlr_output_layout_add_auto(desktop->layout, wlr_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roots_xcursor_theme_load(desktop->xcursor_theme, wlr_output->scale)) {
|
|
||||||
wlr_log(L_ERROR, "Cannot load xcursor theme with scale %d",
|
|
||||||
wlr_output->scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct roots_seat *seat;
|
struct roots_seat *seat;
|
||||||
wl_list_for_each(seat, &input->seats, link) {
|
wl_list_for_each(seat, &input->seats, link) {
|
||||||
|
if (roots_xcursor_theme_load(seat->cursor->xcursor_theme,
|
||||||
|
wlr_output->scale)) {
|
||||||
|
wlr_log(L_ERROR, "Cannot load xcursor theme for output '%s' "
|
||||||
|
"with scale %d", wlr_output->name, wlr_output->scale);
|
||||||
|
}
|
||||||
|
|
||||||
roots_seat_configure_cursor(seat);
|
roots_seat_configure_cursor(seat);
|
||||||
roots_seat_configure_xcursor(seat);
|
roots_seat_configure_xcursor(seat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,9 @@ static void roots_seat_init_cursor(struct roots_seat *seat) {
|
||||||
struct roots_desktop *desktop = seat->input->server->desktop;
|
struct roots_desktop *desktop = seat->input->server->desktop;
|
||||||
wlr_cursor_attach_output_layout(wlr_cursor, desktop->layout);
|
wlr_cursor_attach_output_layout(wlr_cursor, desktop->layout);
|
||||||
|
|
||||||
roots_xcursor_theme_set_default(desktop->xcursor_theme, wlr_cursor);
|
// TODO: be able to configure per-seat cursor themes
|
||||||
|
seat->cursor->xcursor_theme = desktop->xcursor_theme;
|
||||||
|
roots_xcursor_theme_set_default(seat->cursor->xcursor_theme, wlr_cursor);
|
||||||
|
|
||||||
wl_list_init(&seat->cursor->touch_points);
|
wl_list_init(&seat->cursor->touch_points);
|
||||||
|
|
||||||
|
@ -444,7 +446,7 @@ void roots_seat_remove_device(struct roots_seat *seat,
|
||||||
}
|
}
|
||||||
|
|
||||||
void roots_seat_configure_xcursor(struct roots_seat *seat) {
|
void roots_seat_configure_xcursor(struct roots_seat *seat) {
|
||||||
roots_xcursor_theme_set_default(seat->input->server->desktop->xcursor_theme,
|
roots_xcursor_theme_set_default(seat->cursor->xcursor_theme,
|
||||||
seat->cursor->cursor);
|
seat->cursor->cursor);
|
||||||
wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x,
|
wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x,
|
||||||
seat->cursor->cursor->y);
|
seat->cursor->cursor->y);
|
||||||
|
@ -522,7 +524,7 @@ void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view) {
|
||||||
view_maximize(view, false);
|
view_maximize(view, false);
|
||||||
wlr_seat_pointer_clear_focus(seat->seat);
|
wlr_seat_pointer_clear_focus(seat->seat);
|
||||||
|
|
||||||
roots_xcursor_theme_set_move(seat->input->server->desktop->xcursor_theme,
|
roots_xcursor_theme_set_move(seat->cursor->xcursor_theme,
|
||||||
seat->cursor->cursor);
|
seat->cursor->cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +551,7 @@ void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
|
||||||
view_maximize(view, false);
|
view_maximize(view, false);
|
||||||
wlr_seat_pointer_clear_focus(seat->seat);
|
wlr_seat_pointer_clear_focus(seat->seat);
|
||||||
|
|
||||||
roots_xcursor_theme_set_resize(seat->input->server->desktop->xcursor_theme,
|
roots_xcursor_theme_set_resize(seat->cursor->xcursor_theme,
|
||||||
seat->cursor->cursor, edges);
|
seat->cursor->cursor, edges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,6 +564,6 @@ void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view) {
|
||||||
view_maximize(view, false);
|
view_maximize(view, false);
|
||||||
wlr_seat_pointer_clear_focus(seat->seat);
|
wlr_seat_pointer_clear_focus(seat->seat);
|
||||||
|
|
||||||
roots_xcursor_theme_set_rotate(seat->input->server->desktop->xcursor_theme,
|
roots_xcursor_theme_set_rotate(seat->cursor->xcursor_theme,
|
||||||
seat->cursor->cursor);
|
seat->cursor->cursor);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue