From d210ac6b779d0b02acba4776f5f54182ffd361b5 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 30 Sep 2023 13:36:49 +0200 Subject: [PATCH 01/17] chore: Store wlr_session when created --- cage.c | 2 +- seat.c | 6 +++--- server.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cage.c b/cage.c index f78a03f..b5a46ec 100644 --- a/cage.c +++ b/cage.c @@ -293,7 +293,7 @@ main(int argc, char *argv[]) struct wl_event_source *sigterm_source = wl_event_loop_add_signal(event_loop, SIGTERM, handle_signal, &server.wl_display); - server.backend = wlr_backend_autocreate(server.wl_display); + server.backend = wlr_backend_autocreate(server.wl_display, &server.session); if (!server.backend) { wlr_log(WLR_ERROR, "Unable to create the wlroots backend"); ret = 1; diff --git a/seat.c b/seat.c index f67af68..d047b59 100644 --- a/seat.c +++ b/seat.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -263,10 +264,9 @@ handle_keybinding(struct cg_server *server, xkb_keysym_t sym) #endif if (server->allow_vt_switch && sym >= XKB_KEY_XF86Switch_VT_1 && sym <= XKB_KEY_XF86Switch_VT_12) { if (wlr_backend_is_multi(server->backend)) { - struct wlr_session *session = wlr_backend_get_session(server->backend); - if (session) { + if (server->session) { unsigned vt = sym - XKB_KEY_XF86Switch_VT_1 + 1; - wlr_session_change_vt(session, vt); + wlr_session_change_vt(server->session, vt); } } } else { diff --git a/server.h b/server.h index de58456..fef4b5e 100644 --- a/server.h +++ b/server.h @@ -24,6 +24,7 @@ struct cg_server { struct wlr_backend *backend; struct wlr_renderer *renderer; struct wlr_allocator *allocator; + struct wlr_session *session; struct cg_seat *seat; struct wlr_idle *idle; From 0ebdd2b1188faae8d0847185dc853d2c28a69abd Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 30 Sep 2023 13:37:58 +0200 Subject: [PATCH 02/17] chore: Remove wlr_output_damage include --- output.c | 1 - output.h | 1 - 2 files changed, 2 deletions(-) diff --git a/output.c b/output.c index 96a5086..f5d0992 100644 --- a/output.c +++ b/output.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/output.h b/output.h index 4783fd1..780930e 100644 --- a/output.h +++ b/output.h @@ -3,7 +3,6 @@ #include #include -#include #include "server.h" #include "view.h" From fe515905a260f30856465a379c133c7fea9b99b3 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 30 Sep 2023 13:38:29 +0200 Subject: [PATCH 03/17] chore: Call wlr_scene_output_create --- output.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/output.c b/output.c index f5d0992..c327212 100644 --- a/output.c +++ b/output.c @@ -70,24 +70,21 @@ update_output_manager_config(struct cg_server *server) static inline void output_layout_add_auto(struct cg_output *output) { - wlr_output_layout_add_auto(output->server->output_layout, output->wlr_output); - output->scene_output = wlr_scene_get_scene_output(output->server->scene, output->wlr_output); assert(output->scene_output != NULL); + wlr_output_layout_add_auto(output->server->output_layout, output->wlr_output); } static inline void output_layout_add(struct cg_output *output, int32_t x, int32_t y) { - wlr_output_layout_add(output->server->output_layout, output->wlr_output, x, y); - output->scene_output = wlr_scene_get_scene_output(output->server->scene, output->wlr_output); assert(output->scene_output != NULL); + wlr_output_layout_add(output->server->output_layout, output->wlr_output, x, y); } static inline void output_layout_remove(struct cg_output *output) { wlr_output_layout_remove(output->server->output_layout, output->wlr_output); - output->scene_output = NULL; } static void @@ -296,6 +293,8 @@ handle_new_output(struct wl_listener *listener, void *data) output->frame.notify = handle_output_frame; wl_signal_add(&wlr_output->events.frame, &output->frame); + output->scene_output = wlr_scene_output_create(server->scene, wlr_output); + if (!wl_list_empty(&wlr_output->modes)) { /* Ensure the output is marked as enabled before trying to set mode */ wlr_output_enable(wlr_output, true); From cbe25aaa16d9ab13be4acd621876af44a018a9cf Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 30 Sep 2023 13:39:36 +0200 Subject: [PATCH 04/17] chore: wlr_scene_output_commit NULL options --- output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output.c b/output.c index c327212..f75c11b 100644 --- a/output.c +++ b/output.c @@ -169,7 +169,7 @@ handle_output_frame(struct wl_listener *listener, void *data) return; } - wlr_scene_output_commit(output->scene_output); + wlr_scene_output_commit(output->scene_output, NULL); struct timespec now = {0}; clock_gettime(CLOCK_MONOTONIC, &now); From 2ecd64016788f48d4a7ab118a4ba5ffc83571a5e Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 30 Sep 2023 13:39:53 +0200 Subject: [PATCH 05/17] chore: Remove output mode handler --- output.c | 16 ---------------- output.h | 1 - 2 files changed, 17 deletions(-) diff --git a/output.c b/output.c index f75c11b..9884502 100644 --- a/output.c +++ b/output.c @@ -191,19 +191,6 @@ handle_output_commit(struct wl_listener *listener, void *data) } } -static void -handle_output_mode(struct wl_listener *listener, void *data) -{ - struct cg_output *output = wl_container_of(listener, output, mode); - - if (!output->wlr_output->enabled) { - return; - } - - view_position_all(output->server); - update_output_manager_config(output->server); -} - void handle_output_layout_change(struct wl_listener *listener, void *data) { @@ -237,7 +224,6 @@ output_destroy(struct cg_output *output) wl_list_remove(&output->destroy.link); wl_list_remove(&output->commit.link); - wl_list_remove(&output->mode.link); wl_list_remove(&output->frame.link); wl_list_remove(&output->link); @@ -286,8 +272,6 @@ handle_new_output(struct wl_listener *listener, void *data) output->commit.notify = handle_output_commit; wl_signal_add(&wlr_output->events.commit, &output->commit); - output->mode.notify = handle_output_mode; - wl_signal_add(&wlr_output->events.mode, &output->mode); output->destroy.notify = handle_output_destroy; wl_signal_add(&wlr_output->events.destroy, &output->destroy); output->frame.notify = handle_output_frame; diff --git a/output.h b/output.h index 780930e..a3a1a4c 100644 --- a/output.h +++ b/output.h @@ -13,7 +13,6 @@ struct cg_output { struct wlr_scene_output *scene_output; struct wl_listener commit; - struct wl_listener mode; struct wl_listener destroy; struct wl_listener frame; From d341233d9821b2ddbd850724659f321fedfdc42d Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Tue, 21 Nov 2023 19:28:06 +0100 Subject: [PATCH 06/17] chore: Use state field in wlr_output_event_commit --- output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output.c b/output.c index 9884502..55106be 100644 --- a/output.c +++ b/output.c @@ -186,7 +186,7 @@ handle_output_commit(struct wl_listener *listener, void *data) * - output layout change will also be called if needed to position the views * - always update output manager configuration even if the output is now disabled */ - if (event->committed & OUTPUT_CONFIG_UPDATED) { + if (event->state->committed & OUTPUT_CONFIG_UPDATED) { update_output_manager_config(output->server); } } From c0e69eaf421372079caae1b0093f811edc2069c4 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 30 Sep 2023 13:40:21 +0200 Subject: [PATCH 07/17] chore: Use new try_from surface getters --- seat.c | 2 +- xdg_shell.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/seat.c b/seat.c index d047b59..5e1beaf 100644 --- a/seat.c +++ b/seat.c @@ -65,7 +65,7 @@ desktop_view_at(struct cg_server *server, double lx, double ly, struct wlr_surfa } struct wlr_scene_buffer *scene_buffer = wlr_scene_buffer_from_node(node); - struct wlr_scene_surface *scene_surface = wlr_scene_surface_from_buffer(scene_buffer); + struct wlr_scene_surface *scene_surface = wlr_scene_surface_try_from_buffer(scene_buffer); if (!scene_surface) { return NULL; } diff --git a/xdg_shell.c b/xdg_shell.c index c577dc5..9d75b84 100644 --- a/xdg_shell.c +++ b/xdg_shell.c @@ -46,11 +46,13 @@ static struct cg_view * popup_get_view(struct wlr_xdg_popup *popup) { while (true) { - if (popup->parent == NULL || !wlr_surface_is_xdg_surface(popup->parent)) { + if (popup->parent == NULL) { + return NULL; + } + struct wlr_xdg_surface *xdg_surface = wlr_xdg_surface_try_from_wlr_surface(popup->parent); + if (xdg_surface == NULL) { return NULL; } - - struct wlr_xdg_surface *xdg_surface = wlr_xdg_surface_from_wlr_surface(popup->parent); switch (xdg_surface->role) { case WLR_XDG_SURFACE_ROLE_TOPLEVEL: return xdg_surface->data; @@ -254,7 +256,10 @@ handle_xdg_shell_surface_new(struct wl_listener *listener, void *data) } struct wlr_scene_tree *parent_scene_tree = NULL; - struct wlr_xdg_surface *parent = wlr_xdg_surface_from_wlr_surface(popup->parent); + struct wlr_xdg_surface *parent = wlr_xdg_surface_try_from_wlr_surface(popup->parent); + if (parent == NULL) { + return; + } switch (parent->role) { case WLR_XDG_SURFACE_ROLE_TOPLEVEL:; parent_scene_tree = view->scene_tree; From 36b7e268a0392cab8e20547c9ea7864318cccd65 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 30 Sep 2023 13:40:33 +0200 Subject: [PATCH 08/17] chore: Use new map/unmap locations --- xdg_shell.c | 4 ++-- xwayland.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xdg_shell.c b/xdg_shell.c index 9d75b84..046dbd8 100644 --- a/xdg_shell.c +++ b/xdg_shell.c @@ -238,9 +238,9 @@ handle_xdg_shell_surface_new(struct wl_listener *listener, void *data) xdg_shell_view->xdg_toplevel = xdg_surface->toplevel; xdg_shell_view->map.notify = handle_xdg_shell_surface_map; - wl_signal_add(&xdg_surface->events.map, &xdg_shell_view->map); + wl_signal_add(&xdg_surface->surface->events.map, &xdg_shell_view->map); xdg_shell_view->unmap.notify = handle_xdg_shell_surface_unmap; - wl_signal_add(&xdg_surface->events.unmap, &xdg_shell_view->unmap); + wl_signal_add(&xdg_surface->surface->events.unmap, &xdg_shell_view->unmap); xdg_shell_view->destroy.notify = handle_xdg_shell_surface_destroy; wl_signal_add(&xdg_surface->events.destroy, &xdg_shell_view->destroy); xdg_shell_view->request_fullscreen.notify = handle_xdg_shell_surface_request_fullscreen; diff --git a/xwayland.c b/xwayland.c index ef37a49..420949f 100644 --- a/xwayland.c +++ b/xwayland.c @@ -167,9 +167,9 @@ handle_xwayland_surface_new(struct wl_listener *listener, void *data) xwayland_view->xwayland_surface = xwayland_surface; xwayland_view->map.notify = handle_xwayland_surface_map; - wl_signal_add(&xwayland_surface->events.map, &xwayland_view->map); + wl_signal_add(&xwayland_surface->surface->events.map, &xwayland_view->map); xwayland_view->unmap.notify = handle_xwayland_surface_unmap; - wl_signal_add(&xwayland_surface->events.unmap, &xwayland_view->unmap); + wl_signal_add(&xwayland_surface->surface->events.unmap, &xwayland_view->unmap); xwayland_view->destroy.notify = handle_xwayland_surface_destroy; wl_signal_add(&xwayland_surface->events.destroy, &xwayland_view->destroy); xwayland_view->request_fullscreen.notify = handle_xwayland_surface_request_fullscreen; From fead42683b7b71d2c548f1f4f92d7cd5a4a230e0 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 30 Sep 2023 13:40:54 +0200 Subject: [PATCH 09/17] chore: New cursor/xcursor interface --- seat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seat.c b/seat.c index 5e1beaf..fed1292 100644 --- a/seat.c +++ b/seat.c @@ -128,9 +128,9 @@ update_capabilities(struct cg_seat *seat) /* Hide cursor if the seat doesn't have pointer capability. */ if ((caps & WL_SEAT_CAPABILITY_POINTER) == 0) { - wlr_cursor_set_image(seat->cursor, NULL, 0, 0, 0, 0, 0, 0); + wlr_cursor_unset_image(seat->cursor); } else { - wlr_xcursor_manager_set_cursor_image(seat->xcursor_manager, DEFAULT_XCURSOR, seat->cursor); + wlr_cursor_set_xcursor(seat->cursor, seat->xcursor_manager, DEFAULT_XCURSOR); } } From 7017aa445745aff41f47c209c8055058a89ec8cd Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 30 Sep 2023 13:41:07 +0200 Subject: [PATCH 10/17] chore: wlr_compositor_create with version --- cage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cage.c b/cage.c index b5a46ec..04e6edc 100644 --- a/cage.c +++ b/cage.c @@ -342,7 +342,7 @@ main(int argc, char *argv[]) wlr_scene_attach_output_layout(server.scene, server.output_layout); - struct wlr_compositor *compositor = wlr_compositor_create(server.wl_display, server.renderer); + struct wlr_compositor *compositor = wlr_compositor_create(server.wl_display, 6, server.renderer); if (!compositor) { wlr_log(WLR_ERROR, "Unable to create the wlroots compositor"); ret = 1; From ed594e7743a32b64ada2c90d6a9a659c509fdfcb Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Tue, 21 Nov 2023 19:20:13 +0100 Subject: [PATCH 11/17] chore: Switch from wlr_idle to wlr_idle_notify_v1 --- cage.c | 4 ++-- idle_inhibit_v1.c | 4 ++-- seat.c | 28 ++++++++++++++-------------- server.h | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cage.c b/cage.c index 04e6edc..807bb6d 100644 --- a/cage.c +++ b/cage.c @@ -25,8 +25,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -374,7 +374,7 @@ main(int argc, char *argv[]) goto end; } - server.idle = wlr_idle_create(server.wl_display); + server.idle = wlr_idle_notifier_v1_create(server.wl_display); if (!server.idle) { wlr_log(WLR_ERROR, "Unable to create the idle tracker"); ret = 1; diff --git a/idle_inhibit_v1.c b/idle_inhibit_v1.c index 5aba865..683cfe2 100644 --- a/idle_inhibit_v1.c +++ b/idle_inhibit_v1.c @@ -8,8 +8,8 @@ #include #include -#include #include +#include #include "idle_inhibit_v1.h" #include "server.h" @@ -32,7 +32,7 @@ idle_inhibit_v1_check_active(struct cg_server *server) Hence, we simply check for any inhibitors and inhibit accordingly. */ bool inhibited = !wl_list_empty(&server->inhibitors); - wlr_idle_set_enabled(server->idle, NULL, !inhibited); + wlr_idle_notifier_v1_set_inhibited(server->idle, inhibited); } static void diff --git a/seat.c b/seat.c index fed1292..8008dd9 100644 --- a/seat.c +++ b/seat.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -250,7 +250,7 @@ handle_modifier_event(struct wlr_keyboard *keyboard, struct cg_seat *seat) wlr_seat_set_keyboard(seat->seat, keyboard); wlr_seat_keyboard_notify_modifiers(seat->seat, &keyboard->modifiers); - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static bool @@ -272,7 +272,7 @@ handle_keybinding(struct cg_server *server, xkb_keysym_t sym) } else { return false; } - wlr_idle_notify_activity(server->idle, server->seat->seat); + wlr_idle_notifier_v1_notify_activity(server->idle, server->seat->seat); return true; } @@ -304,7 +304,7 @@ handle_key_event(struct wlr_keyboard *keyboard, struct cg_seat *seat, void *data wlr_seat_keyboard_notify_key(seat->seat, event->time_msec, event->keycode, event->state); } - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -512,7 +512,7 @@ handle_touch_down(struct wl_listener *listener, void *data) press_cursor_button(seat, &event->touch->base, event->time_msec, BTN_LEFT, WLR_BUTTON_PRESSED, lx, ly); } - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -531,7 +531,7 @@ handle_touch_up(struct wl_listener *listener, void *data) } wlr_seat_touch_notify_up(seat->seat, event->time_msec, event->touch_id); - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -563,7 +563,7 @@ handle_touch_motion(struct wl_listener *listener, void *data) seat->touch_ly = ly; } - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -572,7 +572,7 @@ handle_touch_frame(struct wl_listener *listener, void *data) struct cg_seat *seat = wl_container_of(listener, seat, touch_frame); wlr_seat_touch_notify_frame(seat->seat); - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -581,7 +581,7 @@ handle_cursor_frame(struct wl_listener *listener, void *data) struct cg_seat *seat = wl_container_of(listener, seat, cursor_frame); wlr_seat_pointer_notify_frame(seat->seat); - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -592,7 +592,7 @@ handle_cursor_axis(struct wl_listener *listener, void *data) wlr_seat_pointer_notify_axis(seat->seat, event->time_msec, event->orientation, event->delta, event->delta_discrete, event->source); - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -604,7 +604,7 @@ handle_cursor_button(struct wl_listener *listener, void *data) wlr_seat_pointer_notify_button(seat->seat, event->time_msec, event->button, event->state); press_cursor_button(seat, &event->pointer->base, event->time_msec, event->button, event->state, seat->cursor->x, seat->cursor->y); - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -634,7 +634,7 @@ process_cursor_motion(struct cg_seat *seat, uint32_t time_msec, double dx, doubl drag_icon_update_position(drag_icon); } - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -651,7 +651,7 @@ handle_cursor_motion_absolute(struct wl_listener *listener, void *data) wlr_cursor_warp_absolute(seat->cursor, &event->pointer->base, event->x, event->y); process_cursor_motion(seat, event->time_msec, dx, dy, dx, dy); - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void @@ -663,7 +663,7 @@ handle_cursor_motion_relative(struct wl_listener *listener, void *data) wlr_cursor_move(seat->cursor, &event->pointer->base, event->delta_x, event->delta_y); process_cursor_motion(seat, event->time_msec, event->delta_x, event->delta_y, event->unaccel_dx, event->unaccel_dy); - wlr_idle_notify_activity(seat->server->idle, seat->seat); + wlr_idle_notifier_v1_notify_activity(seat->server->idle, seat->seat); } static void diff --git a/server.h b/server.h index fef4b5e..c346f7a 100644 --- a/server.h +++ b/server.h @@ -4,8 +4,8 @@ #include "config.h" #include -#include #include +#include #include #include #include @@ -27,7 +27,7 @@ struct cg_server { struct wlr_session *session; struct cg_seat *seat; - struct wlr_idle *idle; + struct wlr_idle_notifier_v1 *idle; struct wlr_idle_inhibit_manager_v1 *idle_inhibit_v1; struct wl_listener new_idle_inhibitor_v1; struct wl_list inhibitors; From a5bbaa92b90e9eae787745704a0f8914b47de21d Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 22 Nov 2023 17:30:59 +0100 Subject: [PATCH 12/17] meson: Convert xwayland option to feature type wlroots as a subproject now yields the xwayland meson option to its parent. We need to match the type for this to work. This also adds support for auto mode, where xwayland is used if present but no warning is given otherwise. --- .github/workflows/main.yml | 6 +++--- meson.build | 4 ++-- meson_options.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0991ad4..78cf1b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: matrix: CC: [ gcc, clang ] OS: [ "alpine:edge", "archlinux:base-devel" ] - xwayland: [ true, false ] + xwayland: [ enabled, disabled ] container: ${{ matrix.OS }} env: CC: ${{ matrix.CC }} @@ -54,7 +54,7 @@ jobs: run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.16.0 - name: Check for formatting changes run: | - meson build-clang-format -Dxwayland=true + meson build-clang-format -Dxwayland=enabled ninja -C build-clang-format clang-format-check scan-build: @@ -73,5 +73,5 @@ jobs: run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.16.0 - name: Run scan-build run: | - meson build-scan-build -Dxwayland=true + meson build-scan-build -Dxwayland=enabled ninja -C build-scan-build scan-build diff --git a/meson.build b/meson.build index fd84262..d38b4d1 100644 --- a/meson.build +++ b/meson.build @@ -64,9 +64,9 @@ server_protos = declare_dependency( sources: server_protos_headers, ) -if get_option('xwayland') +if not get_option('xwayland').disabled() wlroots_has_xwayland = wlroots.get_variable(pkgconfig: 'have_xwayland', internal: 'have_xwayland') == 'true' - if not wlroots_has_xwayland + if get_option('xwayland').enabled() and not wlroots_has_xwayland error('Cannot build Cage with XWayland support: wlroots has been built without it') endif have_xwayland = true diff --git a/meson_options.txt b/meson_options.txt index 22055dc..d64f510 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,2 @@ option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') -option('xwayland', type: 'boolean', value: false, description: 'Enable support for X11 applications') +option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications') From b8d34c120270ece4982f33aff082acca237eeb80 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 22 Nov 2023 17:43:01 +0100 Subject: [PATCH 13/17] ci: Fix Alpine xwayland dependency --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 78cf1b0..e4987c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies (Alpine) if: "matrix.OS == 'alpine:edge'" - run: apk add build-base xcb-util-wm-dev libseat-dev clang git eudev-dev mesa-dev libdrm-dev libinput-dev libxkbcommon-dev pixman-dev wayland-dev meson wayland-protocols xwayland scdoc-doc hwdata + run: apk add build-base xcb-util-wm-dev libseat-dev clang git eudev-dev mesa-dev libdrm-dev libinput-dev libxkbcommon-dev pixman-dev wayland-dev meson wayland-protocols xwayland-dev scdoc-doc hwdata - name: Install dependencies (Arch) if: "matrix.OS == 'archlinux:base-devel'" From 6788de42255c93ec7c1b5ee27556bd8928319b9d Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 22 Nov 2023 05:34:28 +0100 Subject: [PATCH 14/17] ci: Upgrade wlroots to 0.17 --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4987c3..0e7280f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,7 @@ jobs: pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc - name: Fetch wlroots as a subproject - run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.16.0 + run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.17.0 # TODO: use --fatal-meson-warnings when on wlroots 0.15.0 - name: Compile Cage (XWayland=${{ matrix.xwayland }}) @@ -51,7 +51,7 @@ jobs: pacman-key --init pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc hwdata - name: Fetch wlroots as a subproject - run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.16.0 + run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.17.0 - name: Check for formatting changes run: | meson build-clang-format -Dxwayland=enabled @@ -70,7 +70,7 @@ jobs: pacman-key --init pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc hwdata - name: Fetch wlroots as a subproject - run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.16.0 + run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.17.0 - name: Run scan-build run: | meson build-scan-build -Dxwayland=enabled From 46a80d23e7f84e01a8613dc1f959094d8711c66d Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 22 Nov 2023 05:34:38 +0100 Subject: [PATCH 15/17] meson: Bump minimum wlroots to 0.17 --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index d38b4d1..45b3f91 100644 --- a/meson.build +++ b/meson.build @@ -35,7 +35,7 @@ if is_freebsd ) endif -wlroots = dependency('wlroots', version: '>= 0.16.0', fallback: ['wlroots', 'wlroots']) +wlroots = dependency('wlroots', version: '>= 0.17.0', fallback: ['wlroots', 'wlroots']) wayland_protos = dependency('wayland-protocols', version: '>=1.14') wayland_server = dependency('wayland-server') xkbcommon = dependency('xkbcommon') From 6340f4640250dd02e06007addfaa5f6fb6fa5de9 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 22 Nov 2023 17:55:43 +0100 Subject: [PATCH 16/17] ci: No need to test multiple compilers --- .github/workflows/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e7280f..8069562 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,12 +11,9 @@ jobs: strategy: fail-fast: false matrix: - CC: [ gcc, clang ] OS: [ "alpine:edge", "archlinux:base-devel" ] xwayland: [ enabled, disabled ] container: ${{ matrix.OS }} - env: - CC: ${{ matrix.CC }} steps: - name: Checkout Cage uses: actions/checkout@v2 From 3b813cd87cf1ef878e962cec9945f52a57ccbf43 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 22 Nov 2023 17:59:34 +0100 Subject: [PATCH 17/17] ci: Build with/without Xwayland in same task --- .github/workflows/main.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8069562..0444a42 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,6 @@ jobs: fail-fast: false matrix: OS: [ "alpine:edge", "archlinux:base-devel" ] - xwayland: [ enabled, disabled ] container: ${{ matrix.OS }} steps: - name: Checkout Cage @@ -31,11 +30,15 @@ jobs: - name: Fetch wlroots as a subproject run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.17.0 - # TODO: use --fatal-meson-warnings when on wlroots 0.15.0 - - name: Compile Cage (XWayland=${{ matrix.xwayland }}) + - name: Compile Cage run: | - meson build-${{ matrix.CC }}-${{matrix.xwayland }} -Dxwayland=${{ matrix.xwayland }} - ninja -C build-${{ matrix.CC }}-${{matrix.xwayland }} + meson setup build -Dxwayland=enabled + ninja -C build + + - name: Compile cage (no xwayland) + run: | + meson configure build -Dxwayland=disabled + ninja -C build format: runs-on: ubuntu-latest