From f7a40cfa2fd89d41afd596e7bbfbdd66a4a0e4da Mon Sep 17 00:00:00 2001 From: Lina Banik Date: Mon, 6 Jun 2022 17:16:29 +0200 Subject: [PATCH 1/2] seat: Fix reloading cursor theme after change This reverts commit afde6369 "seat: avoid unneeded reloading xcursor theme". Always avoiding to reload the xcursor theme prevents reloading the cursor even when this is desired. Instead seat_configure_xcursor can determine whether a full reload is necessary. To stay with the spirit of the reverted change, cursors are only fully reloaded, if the theme has changed. Fixes #6931 --- sway/input/seat.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/sway/input/seat.c b/sway/input/seat.c index f73946b1..0fd0e8e6 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -803,9 +803,7 @@ static void seat_apply_input_mapping(struct sway_seat *seat, static void seat_configure_pointer(struct sway_seat *seat, struct sway_seat_device *sway_device) { - if ((seat->wlr_seat->capabilities & WL_SEAT_CAPABILITY_POINTER) == 0) { - seat_configure_xcursor(seat); - } + seat_configure_xcursor(seat); wlr_cursor_attach_input_device(seat->cursor->cursor, sway_device->input_device->wlr_device); wl_event_source_timer_update( @@ -1069,26 +1067,27 @@ void seat_configure_xcursor(struct sway_seat *seat) { sway_log(SWAY_ERROR, "Cannot create XCursor manager for theme '%s'", cursor_theme); } - } - for (int i = 0; i < root->outputs->length; ++i) { - struct sway_output *sway_output = root->outputs->items[i]; - struct wlr_output *output = sway_output->wlr_output; - bool result = - wlr_xcursor_manager_load(seat->cursor->xcursor_manager, - output->scale); - if (!result) { - sway_log(SWAY_ERROR, - "Cannot load xcursor theme for output '%s' with scale %f", - output->name, output->scale); + + for (int i = 0; i < root->outputs->length; ++i) { + struct sway_output *sway_output = root->outputs->items[i]; + struct wlr_output *output = sway_output->wlr_output; + bool result = + wlr_xcursor_manager_load(seat->cursor->xcursor_manager, + output->scale); + if (!result) { + sway_log(SWAY_ERROR, + "Cannot load xcursor theme for output '%s' with scale %f", + output->name, output->scale); + } } - } - // Reset the cursor so that we apply it to outputs that just appeared - cursor_set_image(seat->cursor, NULL, NULL); - cursor_set_image(seat->cursor, "default", NULL); - wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x, - seat->cursor->cursor->y); + // Reset the cursor so that we apply it to outputs that just appeared + cursor_set_image(seat->cursor, NULL, NULL); + cursor_set_image(seat->cursor, "default", NULL); + wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x, + seat->cursor->cursor->y); + } } bool seat_is_input_allowed(struct sway_seat *seat, From c3ec141b3445b37b938c504341c7856d61a34cb9 Mon Sep 17 00:00:00 2001 From: NemuiBanila <67269576+nemuibanila@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:12:57 +0200 Subject: [PATCH 2/2] seat: Fix cursor theme reload for tablet tool --- sway/input/tablet.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sway/input/tablet.c b/sway/input/tablet.c index f979bc68..902cb7ed 100644 --- a/sway/input/tablet.c +++ b/sway/input/tablet.c @@ -58,9 +58,7 @@ void sway_configure_tablet(struct sway_tablet *tablet) { tablet->seat_device->input_device->wlr_device; struct sway_seat *seat = tablet->seat_device->sway_seat; - if ((seat->wlr_seat->capabilities & WL_SEAT_CAPABILITY_POINTER) == 0) { - seat_configure_xcursor(seat); - } + seat_configure_xcursor(seat); if (!tablet->tablet_v2) { tablet->tablet_v2 =