From 07a5add7efdfe1e6ae61dab55a2c6460373dfd1d Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 13 Jan 2024 08:15:59 -0500 Subject: [PATCH] Refresh kwin support patch with final version --- 0001-wlheadless-Add-support-for-kwin.patch | 54 +++++++++++----------- xwayland-run.spec | 9 ++-- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/0001-wlheadless-Add-support-for-kwin.patch b/0001-wlheadless-Add-support-for-kwin.patch index 6bfc1cc..fdf992d 100644 --- a/0001-wlheadless-Add-support-for-kwin.patch +++ b/0001-wlheadless-Add-support-for-kwin.patch @@ -1,15 +1,21 @@ -From ac94b6621c2dfa70329fbc89c77ad7a5042f1d5a Mon Sep 17 00:00:00 2001 +From c5846bed1d01497c75f8347e4d5dd1077cf171e9 Mon Sep 17 00:00:00 2001 From: Neal Gompa -Date: Sun, 10 Dec 2023 18:03:30 -0500 +Date: Tue, 2 Jan 2024 21:36:40 -0500 Subject: [PATCH] wlheadless: Add support for kwin +Even though kwin_wayland supports passing a command, it seems the actual +arguments following the command get ignored, so this is not suitable for +wlheadless. + +Instead, we spawn kwin_wayland and the clients separately like we do for +weston. --- - README.md | 5 ++- + README.md | 5 +-- man/wlheadless-run.man | 2 +- meson_options.txt | 2 +- - src/wlheadless/kwin.py | 76 ++++++++++++++++++++++++++++++++++++++ + src/wlheadless/kwin.py | 70 ++++++++++++++++++++++++++++++++++++++ src/wlheadless/meson.build | 1 + - 5 files changed, 82 insertions(+), 4 deletions(-) + 5 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 src/wlheadless/kwin.py diff --git a/README.md b/README.md @@ -67,12 +73,12 @@ index 97367ba..535da87 100644 value: 'weston') diff --git a/src/wlheadless/kwin.py b/src/wlheadless/kwin.py new file mode 100644 -index 0000000..e529229 +index 0000000..1721d1c --- /dev/null +++ b/src/wlheadless/kwin.py -@@ -0,0 +1,76 @@ +@@ -0,0 +1,70 @@ +# -+# Copyright © 2023 Neal Gompa. ++# Copyright © 2024 Neal Gompa. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as @@ -109,6 +115,7 @@ index 0000000..e529229 + def __init__(self): + self.compositor_args = [] + self.compositor = [ ++ 'dbus-run-session', + 'kwin_wayland', + '--virtual', + ] @@ -117,36 +124,29 @@ index 0000000..e529229 + + + def spawn_client(self, command_args): -+ """Helper function to spawn kwin and the client at once.""" -+ wayland_display = 'wayland-' + format(getpid()) -+ environ['WAYLAND_DISPLAY'] = wayland_display -+ compositor = self.compositor -+ compositor.extend(self.compositor_args) -+ compositor.extend(['--wayland-display', format(wayland_display)]) -+ compositor.extend(['--']) -+ compositor.extend(command_args) -+ return self.wlheadless_common.run_command(compositor) ++ """Helper function to spawn the Wayland client.""" ++ return self.wlheadless_common.run_command(command_args) + + + def spawn_xwayland(self, xserver_args = []): -+ """Helper function to spawn kwin and Xwayland at once.""" -+ compositor = self.compositor -+ compositor.extend(self.compositor_args) -+ compositor.extend(['--']) ++ """Helper function to spawn Xwayland.""" + xserver_args.extend(['-fullscreen']) -+ return self.xwayland.spawn_xwayland(xserver_args, compositor) ++ return self.xwayland.spawn_xwayland(xserver_args) + + + def wait_compositor(self): + """Waits for the compositor to start.""" -+ return 0 ++ return self.wlheadless_common.wait_compositor() + + + def run_compositor(self, compositor_args = []): -+ """Starts the Wayland compositor.""" -+ # Just save the given args for when we shall actually spawn the compositor. -+ self.compositor_args = compositor_args -+ return 0 ++ """Helper function to spawn kwin.""" ++ wayland_display = 'wayland-' + format(getpid()) ++ environ['WAYLAND_DISPLAY'] = wayland_display ++ compositor = self.compositor ++ compositor.extend(self.compositor_args) ++ compositor.extend(['--socket', format(wayland_display)]) ++ return self.wlheadless_common.run_compositor(compositor) diff --git a/src/wlheadless/meson.build b/src/wlheadless/meson.build index cdf650c..e6fbfce 100644 --- a/src/wlheadless/meson.build diff --git a/xwayland-run.spec b/xwayland-run.spec index 6b2c96d..69fe89d 100644 --- a/xwayland-run.spec +++ b/xwayland-run.spec @@ -1,13 +1,13 @@ Name: xwayland-run Version: 0.0.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Set of utilities to run headless X/Wayland clients License: GPL-2.0-or-later URL: https://gitlab.freedesktop.org/ofourdan/xwayland-run Source0: %{url}/-/archive/%{version}/%{name}-%{version}.tar.gz -# From: https://gitlab.freedesktop.org/ofourdan/xwayland-run/-/merge_requests/4 +# Backport from upstream Patch0001: 0001-wlheadless-Add-support-for-kwin.patch BuildArch: noarch @@ -15,7 +15,7 @@ BuildArch: noarch BuildRequires: meson >= 0.60.0 BuildRequires: git-core BuildRequires: python3-devel -Requires: (weston or kwin-wayland or mutter or cage or gnome-kiosk) +Requires: (weston or cage or kwin-wayland or mutter or gnome-kiosk) Requires: xorg-x11-server-Xwayland # Provide names of the other utilities included @@ -54,6 +54,9 @@ Xwayland and various Wayland compositor headless. %changelog +* Sat Jan 13 2024 Neal Gompa - 0.0.2-3 +- Refresh kwin support patch with final version + * Sun Dec 10 2023 Neal Gompa - 0.0.2-2 - Refresh kwin support patch - Add provides for other included utilities