From 1ff025ce77767ed7011ca48507ed114d44b220e4 Mon Sep 17 00:00:00 2001 From: "Tobias J. Endres" Date: Thu, 14 Aug 2025 19:43:32 +0200 Subject: [PATCH] docs: Update documentation for Wayland POC and Qt6 --- README.md | 13 ++++++++++++- lessons_learned.md | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76bc0fe..eea206f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,18 @@ Uses [libXdamage](https://www.freedesktop.org/wiki/Software/XDamage/) to detect ## Compilation -To compile run `cmake . && make`, qt5 (core / network ; qt5-base on arch) / x11 (damage / render / xlib ; libx11 / libxdamage / libxrender on arch) libraries are required. +To compile run `cmake . && make`, qt6 (core / gui / multimedia / multimediawidgets ; qt6-base, qt6-multimedia on arch) / x11 (damage / render / xlib ; libx11 / libxdamage / libxrender on arch) libraries are required. + +## Wayland Proof of Concept + +This project now includes a proof-of-concept Wayland grabber, `wayland_poc`. This executable is used to test and develop screen capturing on Wayland. + +To build and run the Wayland POC: +1. Make sure you have the required dependencies installed (Qt6, PipeWire). +2. Build the project: `cmake . && make` +3. Run the executable: `./wayland_poc` + +This will open a window and, after you grant permission in the system's dialog, it will display a capture of your screen. ## Usage diff --git a/lessons_learned.md b/lessons_learned.md index f322a6e..2fdc697 100644 --- a/lessons_learned.md +++ b/lessons_learned.md @@ -123,4 +123,15 @@ This document summarizes the key challenges, debugging steps, and solutions enco * **User Clarification:** The user has clarified that the Proof of Concept (POC) only needs to run in the current environment, and an implementation relying on KDE-specific tools is acceptable. * **New Strategy:** Based on this clarification, the focus for Wayland screen sharing will shift from the generic `xdg-desktop-portal` D-Bus interface to leveraging KDE-specific Wayland protocols, specifically `zkde_screencast_unstable_v1`, as observed in Spectacle's source code. -* **Implication:** This means the `wayland_poc.cpp` will be adapted to use the `zkde_screencast_unstable_v1` protocol directly, rather than going through `xdg-desktop-portal`. This approach is expected to be more direct and potentially simpler for the current environment. \ No newline at end of file +* **Implication:** This means the `wayland_poc.cpp` will be adapted to use the `zkde_screencast_unstable_v1` protocol directly, rather than going through `xdg-desktop-portal`. This approach is expected to be more direct and potentially simpler for the current environment. + +## 11. Migrating to Qt6 and Modern Screen Capture + +* **Problem:** The KDE-specific Wayland protocol approach, while promising, still faced compilation issues related to missing headers (`QNativeInterface`, `QWaylandScreen`) in the user's Qt 5 environment. +* **Decision:** To resolve these issues and modernize the project, the decision was made to migrate the `wayland_poc` to Qt6. +* **Initial Qt6 Migration Issues:** + * The initial attempt to use `QNativeInterface` and `QWaylandScreen` failed because the user's installed Qt6 version (6.4.4) was too old. These features were introduced in later versions (6.5 and 6.7). +* **Revised Qt6 Strategy:** + * Instead of relying on low-level native interfaces, the `wayland_poc` was rewritten to use the high-level `QScreenCapture` API from the Qt Multimedia module. This is the recommended approach for screen capture in modern Qt6. + * This required adding the `Multimedia` and `MultimediaWidgets` components to the `CMakeLists.txt` file. +* **Successful Build:** After these changes, the `wayland_poc` executable was successfully built and run, demonstrating a working Wayland screen capture on the user's system. \ No newline at end of file