]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Reload cursor theme and size on reconfigure
authorSimon Long <simon@raspberrypi.com>
Tue, 12 Mar 2024 19:53:41 +0000 (19:53 +0000)
committerGitHub <noreply@github.com>
Tue, 12 Mar 2024 19:53:41 +0000 (20:53 +0100)
Fixes: #1587
include/input/cursor.h
src/input/cursor.c
src/seat.c

index 752d78a885a96ead52606aff998fef5113d6653a..70905c0fd95e9692d756edc5978a6e4e19fccb42 100644 (file)
@@ -119,6 +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_emulate_move_absolute(struct seat *seat,
                struct wlr_input_device *device,
                double x, double y, uint32_t time_msec);
index fd7d0e619c1697fb669922ae3bb34af5da5ba0fb..b1a661c1802307679d870cb0b107ea03121b7665 100644 (file)
@@ -1253,12 +1253,15 @@ cursor_frame(struct wl_listener *listener, void *data)
 }
 
 void
-cursor_init(struct seat *seat)
+cursor_load(struct seat *seat)
 {
        const char *xcursor_theme = getenv("XCURSOR_THEME");
        const char *xcursor_size = getenv("XCURSOR_SIZE");
        uint32_t size = xcursor_size ? atoi(xcursor_size) : 24;
 
+       if (seat->xcursor_manager) {
+               wlr_xcursor_manager_destroy(seat->xcursor_manager);
+       }
        seat->xcursor_manager = wlr_xcursor_manager_create(xcursor_theme, size);
        wlr_xcursor_manager_load(seat->xcursor_manager, 1);
 
@@ -1293,6 +1296,12 @@ cursor_init(struct seat *seat)
                        "Cursor theme is missing cursor names, using fallback");
                cursor_names = cursors_x11;
        }
+}
+
+void
+cursor_init(struct seat *seat)
+{
+       cursor_load(seat);
 
        /* Set the initial cursor image so the cursor is visible right away */
        cursor_set(seat, LAB_CURSOR_DEFAULT);
index 1d4a20e7507be8aabb3052b0afa79cd0305a204a..4ef175d901527ef27f3ccb78739ac1c89609b9fa 100644 (file)
@@ -529,6 +529,7 @@ seat_init(struct server *server)
 
        seat->input_method_relay = input_method_relay_create(seat);
 
+       seat->xcursor_manager = NULL;
        seat->cursor = wlr_cursor_create();
        if (!seat->cursor) {
                wlr_log(WLR_ERROR, "unable to create cursor");
@@ -571,6 +572,7 @@ seat_reconfigure(struct server *server)
 {
        struct seat *seat = &server->seat;
        struct input *input;
+       cursor_load(seat);
        wl_list_for_each(input, &seat->inputs, link) {
                switch (input->wlr_input_device->type) {
                case WLR_INPUT_DEVICE_KEYBOARD: