]> git.mdlowis.com Git - proto/labwc.git/commitdiff
cursor: reload cursor on Reconfigure
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Fri, 3 May 2024 12:18:43 +0000 (14:18 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 4 May 2024 20:28:10 +0000 (21:28 +0100)
This gives instant feedback when changing cursor theme or size.
It only works for server side cursors or clients using the
cursor-shape protocol.

Fixes: #1619
include/input/cursor.h
src/input/cursor.c
src/seat.c

index 70905c0fd95e9692d756edc5978a6e4e19fccb42..94c9df4751e616934b77c799051820b51ec22816 100644 (file)
@@ -119,7 +119,7 @@ void cursor_update_focus(struct server *server);
 void cursor_update_image(struct seat *seat);
 
 void cursor_init(struct seat *seat);
-void cursor_load(struct seat *seat);
+void cursor_reload(struct seat *seat);
 void cursor_emulate_move_absolute(struct seat *seat,
                struct wlr_input_device *device,
                double x, double y, uint32_t time_msec);
index 6e0e81aa33c3fbffacb36507a411941a0892da2f..01c3dbe7d22223776cfd51c2221290068fe3bd05 100644 (file)
@@ -299,6 +299,7 @@ cursor_update_image(struct seat *seat)
                 */
                if (seat->seat->pointer_state.focused_surface) {
                        seat->server_cursor = LAB_CURSOR_DEFAULT;
+                       wlr_cursor_set_xcursor(seat->cursor, seat->xcursor_manager, "");
                        cursor_update_focus(seat->server);
                }
                return;
@@ -1254,7 +1255,7 @@ cursor_frame(struct wl_listener *listener, void *data)
        wlr_seat_pointer_notify_frame(seat->seat);
 }
 
-void
+static void
 cursor_load(struct seat *seat)
 {
        const char *xcursor_theme = getenv("XCURSOR_THEME");
@@ -1300,6 +1301,13 @@ cursor_load(struct seat *seat)
        }
 }
 
+void
+cursor_reload(struct seat *seat)
+{
+       cursor_load(seat);
+       cursor_update_image(seat);
+}
+
 void
 cursor_init(struct seat *seat)
 {
index 6fbeb595e2ce868b88eac6d846cbedf99ca977b8..816e58dd3ea38d20f8fafa6b85bd128c9a82506d 100644 (file)
@@ -587,7 +587,7 @@ seat_reconfigure(struct server *server)
 {
        struct seat *seat = &server->seat;
        struct input *input;
-       cursor_load(seat);
+       cursor_reload(seat);
        overlay_reconfigure(seat);
        wl_list_for_each(input, &seat->inputs, link) {
                switch (input->wlr_input_device->type) {