From 18628da984ed4852bc29158bee99bba14b91878f Mon Sep 17 00:00:00 2001 From: Gerben Jan Dijkman Date: Mon, 7 Aug 2023 11:17:44 +0200 Subject: [PATCH] Version bump --- gui-libs/wlroots/Manifest | 3 +- ...l-error-on-0-dimension-without-anch.patch} | 24 +-- ...b06633729f1826715c1d0b84614aa3cedb3a.patch | 144 ------------------ ...d839ab56c3e5d7c607a8d76e58e0b75edb85.patch | 106 ------------- ...ywl-dont-crash-upon-missing-keyboard.patch | 55 ------- gui-libs/wlroots/wlroots-0.15.1-r2.ebuild | 83 ---------- gui-libs/wlroots/wlroots-0.16.2-r2.ebuild | 97 ++++++++++++ 7 files changed, 113 insertions(+), 399 deletions(-) rename gui-libs/wlroots/files/{9ed578d159.patch => 0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch} (62%) delete mode 100644 gui-libs/wlroots/files/17b2b06633729f1826715c1d0b84614aa3cedb3a.patch delete mode 100644 gui-libs/wlroots/files/dd03d839ab56c3e5d7c607a8d76e58e0b75edb85.patch delete mode 100644 gui-libs/wlroots/files/wlroots-0.15.1-tinywl-dont-crash-upon-missing-keyboard.patch delete mode 100644 gui-libs/wlroots/wlroots-0.15.1-r2.ebuild create mode 100644 gui-libs/wlroots/wlroots-0.16.2-r2.ebuild diff --git a/gui-libs/wlroots/Manifest b/gui-libs/wlroots/Manifest index 4325402..4ad14dc 100644 --- a/gui-libs/wlroots/Manifest +++ b/gui-libs/wlroots/Manifest @@ -1,2 +1 @@ -DIST wlroots-0.15.1.tar.gz 565816 BLAKE2B 09b704a55d8b4a5ab19bb0fcdd041635fbbbb8eed94ff6d189ef47f9f86e90178efa8441c7db78839b1145ed79ed016d520d6599e256cdcf49130cda38bc307d SHA512 6228160f2f350a406c612f1048d7075cf2f78206cc84bc16f889d5d0acd614f9e98845fffed03d7067cfdbd7558b77fcc5d8cedc3868d866e476523126a63677 -DIST wlroots-0.16.1.tar.gz 588945 BLAKE2B bd7dae29ef730c32ade389bbc1f99610afc0c35fc05a5c80e9257d6eb2ca99c38ecb6277206015432033c59c11fab4743f49413a6a19cf1d35cdbe62cdb57925 SHA512 a590960d3a228f1fec007d20094e48d9276568f59e2ce3bac56889fb7df519d68ffb81a73130b7bbf350ec95056009aaabb18ada52a97486d6ad1d5deb6844c3 +DIST wlroots-0.16.2.tar.gz 589804 BLAKE2B 49911556f1442b43b46e3ec7750706cabeeab915bc36b178b92dec7b66743f4c2f0e335c6e26e318a25ceda41170b20913987a94a3c516df580d379305df7cc2 SHA512 3c1d4fecb3b751987e7051e69849fd62bd4eed95f2d2e548f06e42e4829d0fc24f20c1bfe056a53ede2d1fd05e0c566269a7b9f2bab0de0057a32b55e826a7c0 diff --git a/gui-libs/wlroots/files/9ed578d159.patch b/gui-libs/wlroots/files/0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch similarity index 62% rename from gui-libs/wlroots/files/9ed578d159.patch rename to gui-libs/wlroots/files/0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch index 6f8dc57..b71ed01 100644 --- a/gui-libs/wlroots/files/9ed578d159.patch +++ b/gui-libs/wlroots/files/0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch @@ -1,20 +1,23 @@ -From 9ed578d15949cc01bd756ffc0d9d12e9cc73074f Mon Sep 17 00:00:00 2001 -From: Gerben Jan Dijkman -Date: Tue, 10 Jan 2023 19:47:13 +0100 -Subject: [PATCH] Reverted layer-shell: error on 0 dimension without anchors +From 663278d168152f990cf76a3df9d31ca4c6511604 Mon Sep 17 00:00:00 2001 +Message-Id: <663278d168152f990cf76a3df9d31ca4c6511604.1690371072.git.agx@sigxcpu.org> +From: =?UTF-8?q?Guido=20G=C3=BCnther?= +Date: Fri, 1 Jan 2021 13:58:55 +0100 +Subject: [PATCH] Revert "layer-shell: error on 0 dimension without anchors" -Signed-off-by: Gerben Jan Dijkman +This reverts commit 8dec751a6d84335fb04288b8efab6dd5c90288d3. + +Revert this until phosh has a fixed release. --- types/wlr_layer_shell_v1.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c -index 456dbc0e..55a6cfb8 100644 +index fa054d3c..062fa96d 100644 --- a/types/wlr_layer_shell_v1.c +++ b/types/wlr_layer_shell_v1.c -@@ -328,26 +328,6 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) { - return; - } +@@ -316,26 +316,6 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) { + struct wlr_layer_surface_v1 *surface = + wlr_layer_surface_v1_from_wlr_surface(wlr_surface); - const uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | - ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; @@ -39,3 +42,6 @@ index 456dbc0e..55a6cfb8 100644 surface->current = surface->pending; surface->pending.committed = 0; +-- +2.40.1 + diff --git a/gui-libs/wlroots/files/17b2b06633729f1826715c1d0b84614aa3cedb3a.patch b/gui-libs/wlroots/files/17b2b06633729f1826715c1d0b84614aa3cedb3a.patch deleted file mode 100644 index eaeecdb..0000000 --- a/gui-libs/wlroots/files/17b2b06633729f1826715c1d0b84614aa3cedb3a.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 17b2b06633729f1826715c1d0b84614aa3cedb3a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Guido=20G=C3=BCnther?= -Date: Mon, 28 Feb 2022 13:49:32 +0100 -Subject: [PATCH] seat: Allow to cancel touches - -After cancelation we destroy the touch points associated with this -surface as the Wayland spec says: - -No further events are sent to the clients from that particular gesture. -Touch cancellation applies to all touch points currently active on this -client's surface. The client is responsible for finalizing the touch -points, future touch points on this surface may re-use the touch point -ID. - -Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2999 ---- - include/wlr/types/wlr_seat.h | 21 ++++++++++++++++-- - types/seat/wlr_seat_touch.c | 42 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 61 insertions(+), 2 deletions(-) - -diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h -index ebbcfd479..1946873ae 100644 ---- a/include/wlr/types/wlr_seat.h -+++ b/include/wlr/types/wlr_seat.h -@@ -119,9 +119,11 @@ struct wlr_touch_grab_interface { - void (*enter)(struct wlr_seat_touch_grab *grab, uint32_t time_msec, - struct wlr_touch_point *point); - void (*frame)(struct wlr_seat_touch_grab *grab); -- // XXX this will conflict with the actual touch cancel which is different so -- // we need to rename this -+ // Cancel grab - void (*cancel)(struct wlr_seat_touch_grab *grab); -+ // Send wl_touch::cancel -+ void (*wl_cancel)(struct wlr_seat_touch_grab *grab, -+ struct wlr_surface *surface); - }; - - /** -@@ -613,6 +615,14 @@ void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time_msec, - void wlr_seat_touch_send_motion(struct wlr_seat *seat, uint32_t time_msec, - int32_t touch_id, double sx, double sy); - -+/** -+ * Notify the seat that this is a global gesture and the client should cancel -+ * processing it. The event will go to the client for the surface given. -+ * This function does not respect touch grabs: you probably want -+ * `wlr_seat_touch_notify_cancel()` instead. -+ */ -+void wlr_seat_touch_send_cancel(struct wlr_seat *seat, struct wlr_surface *surface); -+ - void wlr_seat_touch_send_frame(struct wlr_seat *seat); - - /** -@@ -639,6 +649,13 @@ void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time_msec, - void wlr_seat_touch_notify_motion(struct wlr_seat *seat, uint32_t time_msec, - int32_t touch_id, double sx, double sy); - -+/** -+ * Notify the seat that this is a global gesture and the client should -+ * cancel processing it. Defers to any grab of the touch device. -+ */ -+void wlr_seat_touch_notify_cancel(struct wlr_seat *seat, -+ struct wlr_surface *surface); -+ - void wlr_seat_touch_notify_frame(struct wlr_seat *seat); - - /** -diff --git a/types/seat/wlr_seat_touch.c b/types/seat/wlr_seat_touch.c -index 65a8c7c06..abc17ae2c 100644 ---- a/types/seat/wlr_seat_touch.c -+++ b/types/seat/wlr_seat_touch.c -@@ -41,6 +41,11 @@ static void default_touch_cancel(struct wlr_seat_touch_grab *grab) { - // cannot be cancelled - } - -+static void default_touch_wl_cancel(struct wlr_seat_touch_grab *grab, -+ struct wlr_surface *surface) { -+ wlr_seat_touch_send_cancel(grab->seat, surface); -+} -+ - const struct wlr_touch_grab_interface default_touch_grab_impl = { - .down = default_touch_down, - .up = default_touch_up, -@@ -48,6 +53,7 @@ const struct wlr_touch_grab_interface default_touch_grab_impl = { - .enter = default_touch_enter, - .frame = default_touch_frame, - .cancel = default_touch_cancel, -+ .wl_cancel = default_touch_wl_cancel, - }; - - -@@ -238,6 +244,26 @@ void wlr_seat_touch_notify_frame(struct wlr_seat *seat) { - } - } - -+void wlr_seat_touch_notify_cancel(struct wlr_seat *seat, -+ struct wlr_surface *surface) { -+ struct wlr_seat_touch_grab *grab = seat->touch_state.grab; -+ if (grab->interface->wl_cancel) { -+ grab->interface->wl_cancel(grab, surface); -+ } -+ -+ struct wl_client *client = wl_resource_get_client(surface->resource); -+ struct wlr_seat_client *seat_client = wlr_seat_client_for_wl_client(seat, client); -+ if (seat_client == NULL) { -+ return; -+ } -+ struct wlr_touch_point *point, *tmp; -+ wl_list_for_each_safe(point, tmp, &seat->touch_state.touch_points, link) { -+ if (point->client == seat_client) { -+ touch_point_destroy(point); -+ } -+ } -+} -+ - static void handle_point_focus_destroy(struct wl_listener *listener, - void *data) { - struct wlr_touch_point *point = -@@ -376,6 +402,22 @@ void wlr_seat_touch_send_frame(struct wlr_seat *seat) { - } - } - -+void wlr_seat_touch_send_cancel(struct wlr_seat *seat, struct wlr_surface *surface) { -+ struct wl_client *client = wl_resource_get_client(surface->resource); -+ struct wlr_seat_client *seat_client = wlr_seat_client_for_wl_client(seat, client); -+ if (seat_client == NULL) { -+ return; -+ } -+ -+ struct wl_resource *resource; -+ wl_resource_for_each(resource, &seat_client->touches) { -+ if (seat_client_from_touch_resource(resource) == NULL) { -+ continue; -+ } -+ wl_touch_send_cancel(resource); -+ } -+} -+ - int wlr_seat_touch_num_points(struct wlr_seat *seat) { - return wl_list_length(&seat->touch_state.touch_points); - } --- -GitLab - diff --git a/gui-libs/wlroots/files/dd03d839ab56c3e5d7c607a8d76e58e0b75edb85.patch b/gui-libs/wlroots/files/dd03d839ab56c3e5d7c607a8d76e58e0b75edb85.patch deleted file mode 100644 index e5a48e5..0000000 --- a/gui-libs/wlroots/files/dd03d839ab56c3e5d7c607a8d76e58e0b75edb85.patch +++ /dev/null @@ -1,106 +0,0 @@ -From dd03d839ab56c3e5d7c607a8d76e58e0b75edb85 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Guido=20G=C3=BCnther?= -Date: Fri, 25 Mar 2022 18:48:58 +0100 -Subject: [PATCH] xdg-activation: Deduplicate token creation code - -There were three places initializing a token: - -- wlr_xdg_activation_v1_add_token -- wlr_xdg_activation_token_v1_create -- activation_handle_get_activation_token - -The initialization of the token.destroy was missing in the first one. To -prevent these functions from getting out of sync move the token creation -into a common function. - -Fixes 4c59f7d4 ("xdg-activation: Allow to submit tokens") ---- - types/wlr_xdg_activation_v1.c | 42 +++++++++++++++++------------------ - 1 file changed, 20 insertions(+), 22 deletions(-) - -diff --git a/types/wlr_xdg_activation_v1.c b/types/wlr_xdg_activation_v1.c -index 02ba9e07f..c54364ccc 100644 ---- a/types/wlr_xdg_activation_v1.c -+++ b/types/wlr_xdg_activation_v1.c -@@ -248,15 +248,11 @@ static void activation_handle_destroy(struct wl_client *client, - wl_resource_destroy(activation_resource); - } - --static void activation_handle_get_activation_token(struct wl_client *client, -- struct wl_resource *activation_resource, uint32_t id) { -- struct wlr_xdg_activation_v1 *activation = -- activation_from_resource(activation_resource); -- -+static struct wlr_xdg_activation_token_v1 *activation_token_create( -+ struct wlr_xdg_activation_v1 *activation) { - struct wlr_xdg_activation_token_v1 *token = calloc(1, sizeof(*token)); - if (token == NULL) { -- wl_client_post_no_memory(client); -- return; -+ return NULL; - } - wl_list_init(&token->link); - wl_list_init(&token->seat_destroy.link); -@@ -265,6 +261,20 @@ static void activation_handle_get_activation_token(struct wl_client *client, - - token->activation = activation; - -+ return token; -+} -+ -+static void activation_handle_get_activation_token(struct wl_client *client, -+ struct wl_resource *activation_resource, uint32_t id) { -+ struct wlr_xdg_activation_v1 *activation = -+ activation_from_resource(activation_resource); -+ -+ struct wlr_xdg_activation_token_v1 *token = activation_token_create(activation); -+ if (token == NULL) { -+ wl_client_post_no_memory(client); -+ return; -+ } -+ - uint32_t version = wl_resource_get_version(activation_resource); - token->resource = wl_resource_create(client, - &xdg_activation_token_v1_interface, version, id); -@@ -371,19 +381,12 @@ struct wlr_xdg_activation_v1 *wlr_xdg_activation_v1_create( - - struct wlr_xdg_activation_token_v1 *wlr_xdg_activation_token_v1_create( - struct wlr_xdg_activation_v1 *activation) { -- struct wlr_xdg_activation_token_v1 *token = calloc(1, sizeof(*token)); -+ struct wlr_xdg_activation_token_v1 *token = activation_token_create(activation); -+ - if (token == NULL) { - return NULL; - } - -- wl_list_init(&token->link); -- // Currently no way to set seat/surface -- wl_list_init(&token->seat_destroy.link); -- wl_list_init(&token->surface_destroy.link); -- wl_signal_init(&token->events.destroy); -- -- token->activation = activation; -- - if (!token_init(token)) { - wlr_xdg_activation_token_v1_destroy(token); - return NULL; -@@ -412,15 +415,10 @@ struct wlr_xdg_activation_token_v1 *wlr_xdg_activation_v1_add_token( - struct wlr_xdg_activation_v1 *activation, const char *token_str) { - assert(token_str); - -- struct wlr_xdg_activation_token_v1 *token = calloc(1, sizeof(*token)); -+ struct wlr_xdg_activation_token_v1 *token = activation_token_create(activation); - if (token == NULL) { - return NULL; - } -- wl_list_init(&token->link); -- wl_list_init(&token->seat_destroy.link); -- wl_list_init(&token->surface_destroy.link); -- -- token->activation = activation; - token->token = strdup(token_str); - - wl_list_insert(&activation->tokens, &token->link); --- -GitLab - diff --git a/gui-libs/wlroots/files/wlroots-0.15.1-tinywl-dont-crash-upon-missing-keyboard.patch b/gui-libs/wlroots/files/wlroots-0.15.1-tinywl-dont-crash-upon-missing-keyboard.patch deleted file mode 100644 index cff1f72..0000000 --- a/gui-libs/wlroots/files/wlroots-0.15.1-tinywl-dont-crash-upon-missing-keyboard.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 7d950f3dac6cca62635d5e4ff2af33b35372f6db Mon Sep 17 00:00:00 2001 -From: Simon Ser -Date: Sat, 19 Mar 2022 14:00:43 +0100 -Subject: [PATCH] tinywl: don't crash when there is no keyboard - -Running with WLR_BACKENDS=headless, there is no keyboard device. -Avoid crashes like so: - - ../tinywl/tinywl.c:136:2: runtime error: member access within null pointer of type 'struct wlr_keyboard' - ../tinywl/tinywl.c:136:2: runtime error: member access within null pointer of type 'struct wlr_keyboard' - AddressSanitizer:DEADLYSIGNAL - ================================================================= - ==331107==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000120 (pc 0x556ed03e4e99 bp 0x7ffce834bc10 sp 0x7ffce834bbb0 T0) - ==331107==The signal is caused by a READ memory access. - ==331107==Hint: address points to the zero page. - #0 0x556ed03e4e99 in focus_view ../tinywl/tinywl.c:136 - #1 0x556ed03eb3be in xdg_toplevel_map ../tinywl/tinywl.c:603 - #2 0x7f75d6f768db in wlr_signal_emit_safe ../util/signal.c:29 - #3 0x7f75d6e9cac7 in xdg_surface_role_commit ../types/xdg_shell/wlr_xdg_surface.c:315 - #4 0x7f75d6eb6944 in surface_commit_state ../types/wlr_compositor.c:466 - #5 0x7f75d6eb7b02 in surface_handle_commit ../types/wlr_compositor.c:523 - #6 0x7f75d5714d49 (/usr/lib/libffi.so.8+0x6d49) - #7 0x7f75d5714266 (/usr/lib/libffi.so.8+0x6266) - #8 0x7f75d68cb322 (/usr/lib/libwayland-server.so.0+0xd322) - #9 0x7f75d68c65cb (/usr/lib/libwayland-server.so.0+0x85cb) - #10 0x7f75d68c91c9 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xb1c9) - #11 0x7f75d68c6d36 in wl_display_run (/usr/lib/libwayland-server.so.0+0x8d36) - #12 0x556ed03eef55 in main ../tinywl/tinywl.c:905 - #13 0x7f75d5d2330f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f) - #14 0x7f75d5d233c0 in __libc_start_main@GLIBC_2.2.5 (/usr/lib/libc.so.6+0x2d3c0) - #15 0x556ed03e46e4 in _start (/home/simon/src/wlroots/build/tinywl/tinywl+0x136e4) ---- - tinywl/tinywl.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c -index dd442aac..8796e9df 100644 ---- a/tinywl/tinywl.c -+++ b/tinywl/tinywl.c -@@ -130,8 +130,10 @@ static void focus_view(struct tinywl_view *view, struct wlr_surface *surface) { - * track of this and automatically send key events to the appropriate - * clients without additional work on your part. - */ -- wlr_seat_keyboard_notify_enter(seat, view->xdg_surface->surface, -- keyboard->keycodes, keyboard->num_keycodes, &keyboard->modifiers); -+ if (keyboard != NULL) { -+ wlr_seat_keyboard_notify_enter(seat, view->xdg_surface->surface, -+ keyboard->keycodes, keyboard->num_keycodes, &keyboard->modifiers); -+ } - } - - static void keyboard_handle_modifiers( --- -2.36.1 - diff --git a/gui-libs/wlroots/wlroots-0.15.1-r2.ebuild b/gui-libs/wlroots/wlroots-0.15.1-r2.ebuild deleted file mode 100644 index 9af0c3b..0000000 --- a/gui-libs/wlroots/wlroots-0.15.1-r2.ebuild +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit meson - -DESCRIPTION="Pluggable, composable, unopinionated modules for building a Wayland compositor with updates from pureos (for phoc)" -HOMEPAGE="https://source.puri.sm/Librem5/wlroots" - -SRC_URI="https://gitlab.freedesktop.org/${PN}/${PN}/-/archive/${PV}/${P}.tar.gz" -KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86" -SLOT="0/$(ver_cut 2)" - -LICENSE="MIT" -IUSE="tinywl vulkan x11-backend X" - -DEPEND=" - >=dev-libs/libinput-1.14.0:0= - >=dev-libs/wayland-1.20.0 - >=dev-libs/wayland-protocols-1.24 - media-libs/mesa[egl(+),gles2,gbm(+)] - sys-auth/seatd:= - virtual/libudev - vulkan? ( - dev-util/glslang:0= - dev-util/vulkan-headers:0= - media-libs/vulkan-loader:0= - ) - >=x11-libs/libdrm-2.4.109:0= - x11-libs/libxkbcommon - x11-libs/pixman - x11-backend? ( x11-libs/libxcb:0= ) - X? ( - x11-base/xwayland - x11-libs/libxcb:0= - x11-libs/xcb-util-image - x11-libs/xcb-util-wm - ) -" -RDEPEND=" - ${DEPEND} -" -BDEPEND=" - >=dev-libs/wayland-protocols-1.24 - >=dev-util/meson-0.60.0 - dev-util/wayland-scanner - virtual/pkgconfig -" - -PATCHES=( - "${FILESDIR}"/wlroots-0.15.1-tinywl-dont-crash-upon-missing-keyboard.patch - "${FILESDIR}"/17b2b06633729f1826715c1d0b84614aa3cedb3a.patch - "${FILESDIR}"/dd03d839ab56c3e5d7c607a8d76e58e0b75edb85.patch - "${FILESDIR}"/9ed578d159.patch - -) - -src_configure() { - # xcb-util-errors is not on Gentoo Repository (and upstream seems inactive?) - local emesonargs=( - "-Dxcb-errors=disabled" - $(meson_use tinywl examples) - -Drenderers=$(usex vulkan 'gles2,vulkan' gles2) - -Dxwayland=$(usex X enabled disabled) - -Dbackends=drm,libinput$(usex x11-backend ',x11' '') - ) - - meson_src_configure -} - -src_install() { - meson_src_install - - if use tinywl; then - dobin "${BUILD_DIR}"/tinywl/tinywl - fi -} - -pkg_postinst() { - elog "You must be in the input group to allow your compositor" - elog "to access input devices via libinput." -} diff --git a/gui-libs/wlroots/wlroots-0.16.2-r2.ebuild b/gui-libs/wlroots/wlroots-0.16.2-r2.ebuild new file mode 100644 index 0000000..02947f0 --- /dev/null +++ b/gui-libs/wlroots/wlroots-0.16.2-r2.ebuild @@ -0,0 +1,97 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit meson + +DESCRIPTION="Pluggable, composable, unopinionated modules for building a Wayland compositor" +HOMEPAGE="https://gitlab.freedesktop.org/wlroots/wlroots" + +if [[ ${PV} == 9999 ]]; then + EGIT_REPO_URI="https://gitlab.freedesktop.org/${PN}/${PN}.git" + inherit git-r3 + SLOT="0/9999" +else + SRC_URI="https://gitlab.freedesktop.org/${PN}/${PN}/-/archive/${PV}/${P}.tar.gz" + KEYWORDS="amd64 arm64 ~loong ~ppc64 ~riscv x86" + SLOT="0/$(ver_cut 2)" +fi + +LICENSE="MIT" +IUSE="+drm +libinput tinywl vulkan x11-backend X phoc" + +DEPEND=" + >=dev-libs/wayland-1.21.0 + >=dev-libs/wayland-protocols-1.28 + drm? ( sys-apps/hwdata:= ) + libinput? ( >=dev-libs/libinput-1.14.0:0= ) + media-libs/mesa[egl(+),gles2] + sys-auth/seatd:= + virtual/libudev + vulkan? ( + dev-util/glslang:0= + dev-util/vulkan-headers:0= + media-libs/vulkan-loader:0= + ) + >=x11-libs/libdrm-2.4.114:0= + x11-libs/libxkbcommon + >=x11-libs/pixman-0.42.0:0= + x11-backend? ( x11-libs/libxcb:0= ) + X? ( + x11-base/xwayland + x11-libs/libxcb:0= + x11-libs/xcb-util-image + x11-libs/xcb-util-renderutil + x11-libs/xcb-util-wm + ) +" +RDEPEND=" + ${DEPEND} +" +BDEPEND=" + >=dev-libs/wayland-protocols-1.24 + >=dev-util/meson-0.60.0 + dev-util/wayland-scanner + virtual/pkgconfig +" + +src_prepare() { + if use phoc; then + PATCHES+=( "${FILESDIR}"/0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch ) + fi + default +} + +src_configure() { + local backends=( + $(usev drm) + $(usev libinput) + $(usev x11-backend 'x11') + ) + # Separate values with a comma with this evil floating point bit hack + local meson_backends=$(IFS=','; echo "${backends[*]}") + # xcb-util-errors is not on Gentoo Repository (and upstream seems inactive?) + local emesonargs=( + "-Dxcb-errors=disabled" + $(meson_use tinywl examples) + -Drenderers=$(usex vulkan 'gles2,vulkan' gles2) + $(meson_feature X xwayland) + -Dbackends=${meson_backends} + ) + + meson_src_configure +} + +src_install() { + meson_src_install + + if use tinywl; then + dobin "${BUILD_DIR}"/tinywl/tinywl + fi +} + +pkg_postinst() { + elog "You must be in the input group to allow your compositor" + elog "to access input devices via libinput." +}