From 092edb01ea6aadc7bc251e8c598dc6768c8813f1 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Sat, 5 Jul 2025 18:10:07 +0200 Subject: [PATCH 1/8] [revert later] CI: allow compiling wlroots as subproject --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 664e9ead..f926354d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,6 +95,7 @@ jobs: apt-get install -y git gcc clang gdb xwayland apt-get build-dep -y labwc apt-get build-dep -y libwlroots-0.19-dev + apt-get build-dep -y libxkbcommon-dev - name: Install FreeBSD dependencies if: matrix.name == 'FreeBSD' @@ -121,7 +122,7 @@ jobs: xbps-install -y git meson gcc clang pkg-config scdoc \ cairo-devel glib-devel libpng-devel librsvg-devel libxml2-devel \ pango-devel wlroots0.19-devel gdb bash xorg-server-xwayland \ - dejavu-fonts-ttf libsfdo-devel foot + dejavu-fonts-ttf libsfdo-devel foot hwids # These builds are executed on all runners - name: Build with gcc From c538fd5d0ca78303a8d35d7aea031b740e06c5df Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Sat, 5 Jul 2025 16:59:41 +0200 Subject: [PATCH 2/8] chase wlroots: increase wlroots meson dep --- meson.build | 4 ++-- subprojects/wlroots.wrap | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 62925ddb..5a18d5a3 100644 --- a/meson.build +++ b/meson.build @@ -51,9 +51,9 @@ endif add_project_arguments('-DLABWC_VERSION=@0@'.format(version), language: 'c') wlroots = dependency( - 'wlroots-0.19', + 'wlroots-0.20', default_options: ['default_library=static', 'examples=false'], - version: ['>=0.19.0', '<0.20.0'], + version: ['>=0.20.0', '<0.21.0'], ) wlroots_has_xwayland = wlroots.get_variable('have_xwayland') == 'true' diff --git a/subprojects/wlroots.wrap b/subprojects/wlroots.wrap index 25a947ed..c1d52098 100644 --- a/subprojects/wlroots.wrap +++ b/subprojects/wlroots.wrap @@ -1,7 +1,7 @@ [wrap-git] url = https://gitlab.freedesktop.org/wlroots/wlroots.git -revision = 0.19 +revision = f04ef79f619983bfb4a7c9908bdae62e0d0d5ba7 [provide] -dependency_names = wlroots-0.19 -wlroots-0.19=wlroots +dependency_names = wlroots-0.20 +wlroots-0.20=wlroots From 689933c8ef93e711fbfb66c95fd32b845458ee92 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Sat, 5 Jul 2025 17:03:38 +0200 Subject: [PATCH 3/8] chase wlroots: ime: rename to new_text_input (MR 5032) Ref: 536100488fc4c64528786801860f96cfa1a55765 (text-input-v3: Name new text input event correctly) --- src/input/ime.c | 2 +- subprojects/wlroots.wrap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/input/ime.c b/src/input/ime.c index 92d88ffe..ab24f927 100644 --- a/src/input/ime.c +++ b/src/input/ime.c @@ -583,7 +583,7 @@ input_method_relay_create(struct seat *seat) relay->popup_tree = wlr_scene_tree_create(&seat->server->scene->tree); relay->new_text_input.notify = handle_new_text_input; - wl_signal_add(&seat->server->text_input_manager->events.text_input, + wl_signal_add(&seat->server->text_input_manager->events.new_text_input, &relay->new_text_input); relay->new_input_method.notify = handle_new_input_method; diff --git a/subprojects/wlroots.wrap b/subprojects/wlroots.wrap index c1d52098..9199c211 100644 --- a/subprojects/wlroots.wrap +++ b/subprojects/wlroots.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://gitlab.freedesktop.org/wlroots/wlroots.git -revision = f04ef79f619983bfb4a7c9908bdae62e0d0d5ba7 +revision = 536100488fc4c64528786801860f96cfa1a55765 [provide] dependency_names = wlroots-0.20 From 090f5e7d46c01f506c242ec8a453e816fe452767 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 13 Aug 2025 19:57:58 -0700 Subject: [PATCH 4/8] [wip] chase wlroots: Add wl_fixes interface (MR + subproject commit missing) Ref: 812675ba34ce612e9294e8a9814b1baf4b4775d4 (fixes: add implementation) --- src/server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server.c b/src/server.c index a71c76eb..76a69fa0 100644 --- a/src/server.c +++ b/src/server.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -256,6 +257,7 @@ allow_for_sandbox(const struct wlr_security_context_v1_state *security_state, "wl_data_device_manager", /* would be great if we could drop this one */ "wl_seat", "xdg_wm_base", + "wl_fixes", /* enhanced */ "wl_output", "wl_drm", @@ -436,6 +438,8 @@ server_init(struct server *server) server->wl_event_loop = wl_display_get_event_loop(server->wl_display); + wlr_fixes_create(server->wl_display, 1); + /* Catch signals */ server->sighup_source = wl_event_loop_add_signal( server->wl_event_loop, SIGHUP, handle_sighup, server); From 3a5e411080e1c72ad591e4ca6240bc826ad46abd Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Tue, 9 Sep 2025 14:58:03 +0200 Subject: [PATCH 5/8] chase wlroots: ime: rename to new_input_method (MR 5107) Ref: 06aacb2a6fd237a5e1062d611909432bbcf5b566 (input-method: rename input_method event to new_input_method) --- src/input/ime.c | 2 +- subprojects/wlroots.wrap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/input/ime.c b/src/input/ime.c index ab24f927..bfb8816f 100644 --- a/src/input/ime.c +++ b/src/input/ime.c @@ -587,7 +587,7 @@ input_method_relay_create(struct seat *seat) &relay->new_text_input); relay->new_input_method.notify = handle_new_input_method; - wl_signal_add(&seat->server->input_method_manager->events.input_method, + wl_signal_add(&seat->server->input_method_manager->events.new_input_method, &relay->new_input_method); relay->focused_surface_destroy.notify = handle_focused_surface_destroy; diff --git a/subprojects/wlroots.wrap b/subprojects/wlroots.wrap index 9199c211..253b83d7 100644 --- a/subprojects/wlroots.wrap +++ b/subprojects/wlroots.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://gitlab.freedesktop.org/wlroots/wlroots.git -revision = 536100488fc4c64528786801860f96cfa1a55765 +revision = 06aacb2a6fd237a5e1062d611909432bbcf5b566 [provide] dependency_names = wlroots-0.20 From e7fae789ab1e55e4225a27aada1eb0b833abe24b Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Sat, 18 Oct 2025 16:32:20 +0900 Subject: [PATCH 6/8] chase wlroots: ime: don't use `data` in kb grab destroy handler (MR 5170) Ref: 06275103f249cd2954630e59383342e102a6c1a3 (input-method-v2: Destroy keyboard grab before input method) Background: My MR in wlroots (!5107) stopped emitting `wlr_input_method_v2` on its `commit`/`destroy` events, but didn't stop emitting `wlr_input_method_keyboard_grab_v2` on its `destroy` event. That was because `handle_keyboard_grab_destroy()` was called *after* `handle_input_method_destroy()` for some reason, which caused segfault when dereferencing `relay->input_method.keyboard_grab` in `handle_keyboard_grab_destroy()`. MR 5170 reversed this weired order of destroy handler calls, and finally stopped emitting `wlr_input_method_keyboard_grab_v2` on its `destroy` event. --- src/input/ime.c | 3 ++- subprojects/wlroots.wrap | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/input/ime.c b/src/input/ime.c index bfb8816f..efbe54d6 100644 --- a/src/input/ime.c +++ b/src/input/ime.c @@ -309,7 +309,8 @@ handle_keyboard_grab_destroy(struct wl_listener *listener, void *data) { struct input_method_relay *relay = wl_container_of(listener, relay, keyboard_grab_destroy); - struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data; + struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = + relay->input_method->keyboard_grab; assert(keyboard_grab); wl_list_remove(&relay->keyboard_grab_destroy.link); diff --git a/subprojects/wlroots.wrap b/subprojects/wlroots.wrap index 253b83d7..18e5ef98 100644 --- a/subprojects/wlroots.wrap +++ b/subprojects/wlroots.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://gitlab.freedesktop.org/wlroots/wlroots.git -revision = 06aacb2a6fd237a5e1062d611909432bbcf5b566 +revision = 06275103f249cd2954630e59383342e102a6c1a3 [provide] dependency_names = wlroots-0.20 From 777b6a718e0d524d4e487cde56473f194d27e9f3 Mon Sep 17 00:00:00 2001 From: Manuel Barrio Linares Date: Thu, 8 Jan 2026 15:15:22 -0300 Subject: [PATCH 7/8] chase wlroots: wlr_xwayland_set_cursor now takes a wlr_buffer Ref: 84d603acc06a45dd3c3a4b2cf1fd08b2933ca2b5 (xwayland: take wlr_buffer in wlr_xwayland_set_cursor()) Ref: 6ae54dca23064e897b393283887986e5719a747f (xwayland: lock new buffer instead of the old one) Co-Authored-By: Consolatis This wlroots change fixes a potential UAF which we dealt with in labwc. We can thus remove the workaround completely. --- include/xwayland.h | 2 -- src/input/cursor.c | 3 -- src/xwayland.c | 59 ++++------------------------------------ subprojects/wlroots.wrap | 2 +- 4 files changed, 6 insertions(+), 60 deletions(-) diff --git a/include/xwayland.h b/include/xwayland.h index bbb9fa1c..cee15302 100644 --- a/include/xwayland.h +++ b/include/xwayland.h @@ -75,8 +75,6 @@ void xwayland_adjust_usable_area(struct view *view, void xwayland_update_workarea(struct server *server); -void xwayland_reset_cursor(struct server *server); - void xwayland_flush(struct server *server); #endif /* HAVE_XWAYLAND */ diff --git a/src/input/cursor.c b/src/input/cursor.c index 29409bea..c74c72f6 100644 --- a/src/input/cursor.c +++ b/src/input/cursor.c @@ -1610,9 +1610,6 @@ void cursor_reload(struct seat *seat) { cursor_load(seat); -#if HAVE_XWAYLAND - xwayland_reset_cursor(seat->server); -#endif cursor_update_image(seat); } diff --git a/src/xwayland.c b/src/xwayland.c index 5984a31b..9b30c2c8 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -1200,60 +1200,11 @@ xwayland_server_init(struct server *server, struct wlr_compositor *compositor) server->seat.xcursor_manager, XCURSOR_DEFAULT, 1); if (xcursor) { struct wlr_xcursor_image *image = xcursor->images[0]; - wlr_xwayland_set_cursor(server->xwayland, image->buffer, - image->width * 4, image->width, - image->height, image->hotspot_x, - image->hotspot_y); - } -} - -void -xwayland_reset_cursor(struct server *server) -{ - /* - * As xwayland caches the pixel data when not yet started up - * due to the delayed lazy startup approach, we do have to - * re-set the xwayland cursor image. Otherwise the first X11 - * client connected will cause the xwayland server to use - * the cached (and potentially destroyed) pixel data. - * - * Calling this function after reloading the cursor theme - * ensures that the cached pixel data keeps being valid. - * - * To reproduce: - * - Compile with b_sanitize=address,undefined - * - Start labwc (nothing in autostart that could create - * a X11 connection, e.g. no GTK or X11 application) - * - Reconfigure - * - Start some X11 client - */ - - if (!server->xwayland) { - return; - } - - struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor( - server->seat.xcursor_manager, XCURSOR_DEFAULT, 1); - - if (xcursor && !server->xwayland->xwm) { - /* Prevents setting the cursor on an active xwayland server */ - struct wlr_xcursor_image *image = xcursor->images[0]; - wlr_xwayland_set_cursor(server->xwayland, image->buffer, - image->width * 4, image->width, - image->height, image->hotspot_x, - image->hotspot_y); - return; - } - - if (server->xwayland->cursor) { - /* - * The previous configured theme has set the - * default cursor or the xwayland server is - * currently running but still has a cached - * xcursor set that will be used on the next - * xwayland destroy -> lazy startup cycle. - */ - zfree(server->xwayland->cursor); + struct wlr_buffer *cursor_buffer = wlr_xcursor_image_get_buffer(image); + if (cursor_buffer) { + wlr_xwayland_set_cursor(server->xwayland, cursor_buffer, + image->hotspot_x, image->hotspot_y); + } } } diff --git a/subprojects/wlroots.wrap b/subprojects/wlroots.wrap index 18e5ef98..004e3a20 100644 --- a/subprojects/wlroots.wrap +++ b/subprojects/wlroots.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://gitlab.freedesktop.org/wlroots/wlroots.git -revision = 06275103f249cd2954630e59383342e102a6c1a3 +revision = 6ae54dca23064e897b393283887986e5719a747f [provide] dependency_names = wlroots-0.20 From 918c3290fc98da9eb79bd7a4bb7433fd86026bf3 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Sat, 5 Jul 2025 17:37:22 +0200 Subject: [PATCH 8/8] [wip] chase wlroots: track master branch --- subprojects/wlroots.wrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/wlroots.wrap b/subprojects/wlroots.wrap index 004e3a20..4352289b 100644 --- a/subprojects/wlroots.wrap +++ b/subprojects/wlroots.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://gitlab.freedesktop.org/wlroots/wlroots.git -revision = 6ae54dca23064e897b393283887986e5719a747f +revision = master [provide] dependency_names = wlroots-0.20