Compare commits

..

156 Commits

Author SHA1 Message Date
rewine 27d5c8cc73 chore(debian): update version to 0.7.6
Log: new version
2025-10-30 20:26:03 +08:00
April & May & June 3bf30e97e5 fix: Put Treeland at the first place for session selection
Treeland should be the first candidate of session selection, this commit ensures that.
2025-10-30 20:25:26 +08:00
rewine 29ac51b15e refactor: replace PopupSurfaceContainer with SurfaceContainer for popup
handling

Changed m_popupContainer from PopupSurfaceContainer to SurfaceContainer
to fix tooltip damage issue caused by PR #428. This is a temporary
fix while a better solution for handling popup click events is being
developed.

Log: Fixed tooltip display issues by changing popup container
implementation

Influence:
1. Test tooltip display functionality across different applications
2. Verify popup windows and menus still work correctly
3. Check for any regression in popup interaction behavior
4. Test various popup types including context menus and tooltips
5. Verify z-ordering of popup elements remains correct

refactor: 将弹出窗口容器从 PopupSurfaceContainer 替换为 SurfaceContainer

将 m_popupContainer 从 PopupSurfaceContainer 改为 SurfaceContainer,以修
复 PR #428 导致的工具提示损坏问题。这是一个临时修复方案,同时正在开发更
好的弹出窗口点击事件处理方案。

Log: 通过更改弹出窗口容器实现修复了工具提示显示问题

Influence:
1. 测试不同应用程序中的工具提示显示功能
2. 验证弹出窗口和菜单是否仍能正常工作
3. 检查弹出窗口交互行为是否有回归问题
4. 测试各种弹出类型,包括上下文菜单和工具提示
5. 验证弹出元素的 Z 轴排序是否保持正确
2025-10-30 18:50:54 +08:00
Lu YaNing f50669edc6 refactor: implement atomic multi-output configuration
- Use WOutputRenderWindow interface for output configuration
- Complete output state management with all properties
- Ensure settings only saved when configuration succeeds
2025-10-30 10:51:03 +08:00
YaoBing Xiao 04791bc889 fix: occasional crash during recording toplevel
WSurfaceEntent::surface may be nullptr, use
WSGTextureProvider::qwBuffer.

Fixes: linuxdeepin/treeland#603

Log
2025-10-24 16:46:17 +08:00
JiDe Zhang 1866331471 fix: use safeConnect for aboutToBeInvalidated
The WSurface's `aboutToBeInvalidated` signal connection was incorrectly
using `QObject::connect` instead of `safeConnect`. This could lead
to issues when the WSurface object is modified using `setSurface`,
as the previous object's `aboutToBeInvalidated` signal would not be
disconnected, potentially causing a crash or unexpected behavior. This
change replaces the regular `QObject::connect` with `safeConnect` to
ensure proper disconnection and avoid potential issues when the surface
is replaced.

Influence:
1. Test replacing a WSurface multiple times with different WSurface
objects using `setSurface`.
2. Verify that the `releaseResources` function is only called when the
current WSurface is truly invalidated and not prematurely.
3. Observe application behavior under heavy WSurface replacement
scenarios to ensure stability and prevent crashes.

fix: 使用 safeConnect 连接 aboutToBeInvalidated 信号

WSurface 的 `aboutToBeInvalidated` 信号连接错误地使用了
`QObject::connect` 而不是 `safeConnect`。当使用 `setSurface` 修改
WSurface 对象时,这可能导致问题,因为前一个对象的 `aboutToBeInvalidated`
信号不会断开,可能导致崩溃或意外行为。此更改将常规的 `QObject::connect`
替换为 `safeConnect`,以确保正确断开连接并避免在表面替换时出现潜在问题。

Influence:
1. 使用 `setSurface` 多次用不同的 WSurface 对象替换 WSurface。
2. 验证 `releaseResources` 函数仅在当前 WSurface 真正失效时才被调用,而
不是过早调用。
3. 观察在大量 WSurface 替换场景下的应用程序行为,以确保稳定并防止崩溃。
2025-10-24 13:57:27 +08:00
transifex-integration[bot] f7e4a195c6
i18n: Updates for project TreeLand (#601)
* [skip CI] Translate wallpaper.en_US.ts in sq

91% of minimum 10% translated source file: 'wallpaper.en_US.ts'
on 'sq'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate lockscreen.en_US.ts in sq

95% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'sq'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate lockscreen.en_US.ts in sq

100% translated source file: 'lockscreen.en_US.ts'
on 'sq'.

* [skip CI] Translate multitaskview.en_US.ts in sq

100% translated source file: 'multitaskview.en_US.ts'
on 'sq'.

* [skip CI] Translate treeland.en_US.ts in sq

100% translated source file: 'treeland.en_US.ts'
on 'sq'.

---------

Log:
2025-10-21 10:42:49 +08:00
April & May & June 8aa33384f2 refactor: Convert Session to shared_ptr and simplify session lifecycle
使用 shared_ptr 管理 Session 生命周期并简化会话管理

This commit refactors the session management system to use shared_ptr
for automatic memory management and improves session visibility handling:

本次提交重构了会话管理系统,使用 shared_ptr 进行自动内存管理,
并改进了会话可见性处理:

Changes:
- Convert Session* to std::shared_ptr<Session> throughout codebase
- Change m_activeSession to std::weak_ptr to prevent circular references
- Remove manual delete calls for Session objects (automatic cleanup)
- Simplify session switching logic in updateActiveUserSession()
- Add lastActivatedSurface tracking per session
- Remove applySurfaceVisibility() - now handled in updateVisible()
- Update surface visibility check to use surfaceBelongsToCurrentSession()
- Add proper socket enable/disable on session switch
- Restore last activated surface when switching sessions

变更内容:
- 将 Session* 转换为 std::shared_ptr<Session>
- 将 m_activeSession 改为 std::weak_ptr 以防止循环引用
- 移除手动 delete Session 对象的调用(自动清理)
- 简化 updateActiveUserSession() 中的会话切换逻辑
- 为每个会话添加 lastActivatedSurface 跟踪
- 移除 applySurfaceVisibility() - 现在在 updateVisible() 中处理
- 更新表面可见性检查以使用 surfaceBelongsToCurrentSession()
- 在会话切换时正确启用/禁用 socket
- 切换会话时恢复上次激活的表面

Benefits:
- Eliminates memory leaks from manual Session management
- Safer pointer handling with shared_ptr/weak_ptr
- Per-session surface activation state preservation
- More efficient visibility updates (per-surface vs recursive walk)

优点:
- 消除手动 Session 管理导致的内存泄漏
- 使用 shared_ptr/weak_ptr 更安全的指针处理
- 保留每个会话的表面激活状态
- 更高效的可见性更新(按表面更新而非递归遍历)
2025-10-21 10:09:17 +08:00
April & May & June bbdbc40a94 chore: Remove unused code & Add document
This commit removed unused code and add document / comment to newly
added functions
2025-10-21 10:09:17 +08:00
April & May b2661a3d86 feat: Manage per-user Wayland/XWayland sessions via Helper::Session
- add `Session` struct and store `QList<Session*> m_sessions`
- create / reuse a `WSocket` + `WXWayland` pair per uid in
`ensureSession`

通过 Helper::Session 管理每个用户的 Wayland / XWayland 会话

- 添加 `Session` 结构体,并用 `QList<Session*> m_sessions` 保存所有会话
- 在 `ensureSession` 中为每个 uid 创建或复用一对 `WSocket` + `WXWayland`
2025-10-21 10:09:17 +08:00
April & May 6547558cc7 feat: Add per-user XWayland session management
- Track each WXWayland instance by uid so every session gets its own
XWayland socket
- Hide/show XWayland surfaces when switching users to prevent previous
windows leaking

为不同用户管理独立的 XWayland 会话

- 为每个 uid 记录 WXWayland 实例,实现按用户隔离的 XWayland socket
- 切换用户时自动隐藏/显示对应的 XWayland 窗口,避免旧会话窗口外泄
2025-10-21 10:09:17 +08:00
JiDe Zhang 66193ba1bc chore: add ASAN environment variables
Add AddressSanitizer (ASAN) environment variables to the treeland
systemd service file. This aids in debugging memory-related issues
within treeland, particularly when running with ASAN enabled. The
`ASAN_SYMBOLIZER_PATH` variable points to the llvm-symbolizer, enabling
symbolization of ASAN reports. The `ASAN_OPTIONS` variable configures
ASAN to log its output to a specific file (`/tmp/treeland-asan`),
disables leak detection (due to false positives in some environments),
enables immediate abortion on error, and enables symbolization within
the log file. This change facilitates easier debugging of memory
corruption and other ASAN-detectable errors.

Influence:
1. Verify that ASAN logs are generated in the specified log file when
ASAN is enabled.
2. Ensure that the ASAN logs contain symbolized stack traces.
3. Confirm that treeland aborts when memory errors are detected with
ASAN enabled.

chore: 添加 ASAN 环境变量

将 AddressSanitizer (ASAN) 环境变量添加到 treeland systemd 服务文件中。
这有助于调试 treeland 中与内存相关的问题,尤其是在启用 ASAN 的情况下。
`ASAN_SYMBOLIZER_PATH` 变量指向 llvm-symbolizer,从而可以对 ASAN 报告
进行符号化。`ASAN_OPTIONS` 变量配置 ASAN 将其输出记录到特定文件 (`/tmp/
treeland-asan`),禁用泄漏检测(由于某些环境中的误报),在发生错误时立即
中止,并启用日志文件中的符号化。此更改有助于更轻松地调试内存损坏和其他
ASAN 可检测到的错误。

Influence:
1. 验证启用 ASAN 后,是否在指定的日志文件中生成 ASAN 日志。
2. 确保 ASAN 日志包含符号化的堆栈跟踪。
3. 确认在启用 ASAN 的情况下检测到内存错误时,treeland 会中止。
2025-10-16 21:36:37 +08:00
JiDe Zhang 5bde9683eb feat: Expose XWayland surface process ID
This change addresses the issue where the client process ID associated
with an XWayland surface could not be directly obtained through
`WClient`. Previously, accessing the `WClient` of an XWayland
surface always returned the XWayland process itself. To resolve
this, two virtual functions, `pid()` and `pidFD()`, have been added
to the `WObject` class and overridden in `WXWaylandSurface`. These
functions allow retrieving the actual PID and PID file descriptor
of the XWayland window's client. The `pidFD` is obtained by using
`syscall(SYS_pidfd_open, pid(), 0)`. This approach enables correct
identification of the client process owning the XWayland surface.

Influence:
1. Verify that the `pid()` function on a `WXWaylandSurface` object
returns the correct process ID of the client application, not the
XWayland process.
2. Confirm that `pidFD()` returns a valid file descriptor for the client
application's PID. Check the returned file descriptor is valid.
3. Ensure that these new functions do not negatively impact other parts
of the Waylib codebase.
4. Test multiple XWayland applications to ensure consistent and accurate
PID retrieval.
5. Test on different platforms to ensure `syscall(SYS_pidfd_open, pid(),
0)` is working correctly, and fallback gracefully if not.

feat: 暴露 XWayland surface 进程 ID

此更改解决了无法通过 `WClient` 直接获取与 XWayland surface 关联的客户
端进程 ID 的问题。 以前,访问 XWayland surface 的 `WClient` 始终返回
XWayland 进程本身。 为了解决这个问题,我们在 `WObject` 类中添加了两个虚
函数 `pid()` 和 `pidFD()`,并在 `WXWaylandSurface` 中重写了它们。 这些函
数允许检索 XWayland 窗口客户端的实际 PID 和 PID 文件描述符。 `pidFD` 通
过使用 `syscall(SYS_pidfd_open, pid(), 0)` 获得。 这种方法可以正确识别拥
有 XWayland surface 的客户端进程。

Influence:
1. 验证 `WXWaylandSurface` 对象上的 `pid()` 函数返回客户端应用程序的正确
进程 ID,而不是 XWayland 进程。
2. 确认 `pidFD()` 为客户端应用程序的 PID 返回有效的文件描述符。 检查返回
的文件描述符是否有效。
3. 确保这些新函数不会对 Waylib 代码库的其他部分产生负面影响。
4. 测试多个 XWayland 应用程序,以确保一致且准确的 PID 检索。
5. 在不同平台上进行测试,以确保 `syscall(SYS_pidfd_open, pid(), 0)` 正常
工作,如果不能正常工作,则优雅地回退。
2025-10-16 14:09:51 +08:00
JiDe Zhang ca8de83d47 chore: change Debian build environment to unstable
The Debian build environment in the CI workflows for both qwlroots and
waylib has been changed from `experimental` to `unstable`. This change
was necessary because the `experimental` environment was proving to
be unstable, frequently causing CI failures. Debian `unstable` is more
reliable and now provides wlroots 0.19 which meets the required version.
The apt sources in the build workflows have been updated to reflect
this change.

Influence:
1. Monitor CI build stability for both qwlroots and waylib on the Debian
unstable environment.
2. Verify that the builds are successful and that the required
dependencies, including wlroots 0.19, are correctly installed.
3. Check for any compatibility issues introduced by the change in the
build environment.

chore: 更改 Debian 构建环境为 unstable

qwlroots 和 waylib 的 CI 工作流程中的 Debian 构建环境已从 `experimental`
更改为 `unstable`。 这一更改是必要的,因为 `experimental` 环境被证明不
稳定,经常导致 CI 失败。 Debian `unstable` 更加可靠,现在提供 wlroots
0.19,满足了所需的版本。 构建工作流程中的 apt 源已更新以反映此更改。

Influence:
1. 监控 Debian unstable 环境上 qwlroots 和 waylib 的 CI 构建稳定性。
2. 验证构建是否成功,以及是否正确安装了所需的依赖项,包括 wlroots 0.19。
3. 检查构建环境更改引入的任何兼容性问题。
2025-10-16 13:28:04 +08:00
JiDe Zhang 5af6a3903d refactor: remove branch filter for workflow triggers
This commit removes the branch filters from the `on` triggers in several
GitHub workflow files. Specifically, the `branches: - master` filter has
been removed from the `push` and `pull_request` triggers in `.github/
workflows/qwlroots-archlinux-build.yml`, `.github/workflows/qwlroots-
debian-build.yml`, `.github/workflows/treeland-archlinux-build.yml`,
`.github/workflows/waylib-archlinux-build.yml`, and `.github/workflows/
waylib-debian-build.yml`.

This change ensures that the workflows are triggered for all branches,
including feature branches and release branches, rather than being
limited to the `master` branch. This provides better coverage for
automated builds and tests whenever changes are pushed or a pull request
is created against *any* branch.  This is important as the project
evolves beyond relying solely on master and introduces feature branches,
ensuring consistent CI across development.

Influence:
1. Verify that all workflows trigger correctly on pushes and pull
requests for all branches, not just master.
2. Create a pull request to a new branch and ensure that all relevant
workflows are triggered.
3. Push a commit to a new branch and verify that all relevant workflows
are triggered.

重构: 移除工作流程触发器的分支筛选器

此提交从多个 GitHub 工作流程文件的 `on` 触发器中删除了分支筛选器。
具体来说,已从 `.github/workflows/qwlroots-archlinux-build.yml`、
`.github/workflows/qwlroots-debian-build.yml`、`.github/workflows/
treeland-archlinux-build.yml`、`.github/workflows/waylib-archlinux-
build.yml` 和 `.github/workflows/waylib-debian-build.yml` 中的 `push` 和
`pull_request` 触发器中删除 `branches: - master` 筛选器。

此更改确保工作流程在所有分支(包括功能分支和发布分支)上触发,而不是仅限
于 `master` 分支。 无论何时推送更改或针对*任何*分支创建拉取请求,这都为
自动构建和测试提供了更好的覆盖范围。 这一点很重要,因为项目的发展不仅仅
依赖于 master,还引入了功能分支,确保了整个开发过程中的持续集成。

Influence:
1. 验证所有工作流程是否在所有分支(不仅仅是 master)的推送和拉取请求上正
确触发。
2. 创建一个到新分支的拉取请求,并确保所有相关的工作流程都被触发。
3. 将提交推送到一个新分支,并验证所有相关的工作流程是否被触发。
2025-10-15 15:49:41 +08:00
JiDe Zhang f6af3a539f fix: fix build when treeland examples are enabled
Fixes a build failure that occurs when Treeland examples are enabled,
specifically in higher versions of Qt6. The issue arises because certain
private Qt modules (like `WaylandClientPrivate`) are not automatically
included and need to be explicitly specified using `find_package`.
Failing to do so results in linker errors during the build process. This
change ensures that the necessary private modules are found, allowing
the examples to compile successfully.

Influence:
1. Build the `test_multitaskview` example with Treeland examples
enabled.
2. Verify that the build completes without any errors related to missing
Qt private modules.
3. Confirm that the compiled example runs correctly.

fix: 修复开启 treeland 示例时构建失败的问题

修复了在 Qt6 的较高版本中,启用 Treeland 示例时发生的构建失败。 出现此问
题的原因是某些私有 Qt 模块(如 `WaylandClientPrivate`)不会自动包含,需
要使用 `find_package` 显式指定。 否则,会导致构建过程中出现链接器错误。
此更改确保找到必要的私有模块,从而使示例能够成功编译。

Influence:
1. 在启用 Treeland 示例的情况下构建 `test_multitaskview` 示例。
2. 验证构建是否完成,并且没有与缺少的 Qt 私有模块相关的任何错误。
3. 确认编译后的示例可以正确运行。
2025-10-14 12:20:06 +08:00
JiDe Zhang 3f03884083 fix: fix build failure on Arch Linux
The build was failing on Arch Linux due to an upgrade to Qt 6.10.
This version of Qt requires explicitly finding the private modules
(QuickPrivate, WaylandClientPrivate). This commit updates the
CMakeLists.txt files in the affected directories (src/, src/treeland-
shortcut/, waylib/examples/tinywl/, and waylib/src/server/) to
explicitly find these private modules. It also updates the minimum
required Qt version in some waylib CMakeLists.txt files to 6.8 to align
with the actual required version.

修复了在 Arch Linux 上的构建失败

由于升级到 Qt 6.10,导致在 Arch Linux 上的构建失败。 此版本的 Qt 需要显
式查找私有模块(QuickPrivate, WaylandClientPrivate)。 此提交更新了受影
响目录(src/、src/treeland-shortcut/、waylib/examples/tinywl/ 和 waylib/
src/server/)中的 CMakeLists.txt 文件,以显式查找这些私有模块。 它还在一
些 waylib CMakeLists.txt 文件中更新了最低要求的 Qt 版本到 6.8,以与实际
要求的版本保持一致。
2025-10-14 09:49:03 +08:00
April & May 777e0f2a7b fix: Disable minimize / maximize animation for window that doesn't belongs to current user
This should work as intended
2025-10-09 09:56:50 +08:00
April & May 7c11939015 fix: fix private module inclusion on lower version of Qt
GuiPrivate and QuickPrivate cannot be found under Qt <= 6.8. This commit should work as intended.
2025-10-09 09:56:13 +08:00
Felix Yan 4827731cfc fix: compile errors on Arch for forward declared class
`TreelandConfig` became a forward declaration on
fa1e1e6a18 which breaks moc compilation on
Arch with the following errors. Let's use `Q_MOC_INCLUDE` like the
others to workaround it. Note that `Q_DECLARE_OPAQUE_POINTER` should be
avoided here because `TreelandConfig` is a `Q_OBJECT`.

```
[585/700] Building CXX object src/CMakeFiles/libtreeland.dir/libtreeland_autogen/mocs_compilation.cpp.o
FAILED: src/CMakeFiles/libtreeland.dir/libtreeland_autogen/mocs_compilation.cpp.o
/usr/bin/c++ -DDDECLARATIVE_TRANSLATIONS_DIR=\"dtk6/DDeclarative/translations\" -DDSG_DATA_DIR=\"/usr/share/dsg\" -DDSYSINFO_PREFIX=\"\" -DDTK_QML_APP_PLUGIN_PATH=\"/usr/lib/dtk6declarative/qml-app\" -DDTK_QML_APP_PLUGIN_SUBPATH=\"dtkdeclarative/plugins\" -DPREFIX=\"/usr\" -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_FORCE_ASSERTS -DQT_GUI_LIB -DQT_MESSAGELOGCONTEXT -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMETA_LIB -DQT_QMLMODELS_LIB -DQT_QMLWORKERSCRIPT_LIB -DQT_QML_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQT_XML_LIB -DTREELAND_COMPONENTS_TRANSLATION_DIR=\"/usr/share/treeland/translations\" -DTREELAND_DATA_DIR=\"/usr/share/treeland\" -DTREELAND_PLUGINS_INSTALL_PATH=\"/usr/lib/treeland/plugins\" -DTREELAND_PLUGINS_OUTPUT_PATH=\"/build/treeland/src/treeland/lib/plugins\" -DWLR_USE_UNSTABLE -Dlibtreeland_EXPORTS -I/build/treeland/src/treeland/src -I/build/treeland/src/treeland/src/libtreeland_autogen/include -I/build/treeland/src/treeland/protocols -I/build/treeland/src/treeland/src/config -I/build/treeland/src/treeland/src/core -I/build/treeland/src/treeland/src/effects -I/build/treeland/src/treeland/src/greeter -I/build/treeland/src/treeland/src/input -I/build/treeland/src/treeland/src/interfaces -I/build/treeland/src/treeland/src/output -I/build/treeland/src/treeland/src/seat -I/build/treeland/src/treeland/src/surface -I/build/treeland/src/treeland/src/workspace -I/build/treeland/src/treeland/src/utils -I/build/treeland/src/treeland/src/wallpaper -I/build/treeland/src/treeland/waylib/src/server/kernel -I/build/treeland/src/treeland/waylib/src/server/qtquick -I/build/treeland/src/treeland/waylib/src/server/qtquick/private -I/build/treeland/src/treeland/waylib/src/server/utils -I/build/treeland/src/treeland/waylib/src/server/protocols -I/build/treeland/src/treeland/waylib/src/server/protocols/private -I/build/treeland/src/treeland/waylib/qwlroots/src/generate -I/build/treeland/src/treeland/qwlroots/src -I/build/treeland/src/treeland/qwlroots/src/render -I/build/treeland/src/treeland/qwlroots/src/types -I/build/treeland/src/treeland/qwlroots/src/util -I/build/treeland/src/treeland/qwlroots/src/interfaces -I/build/treeland/src/treeland/src/modules/foreign-toplevel -I/build/treeland/src/treeland/src/modules/primary-output -I/build/treeland/src/treeland/src/modules/personalization -I/build/treeland/src/treeland/src/modules/shortcut -I/build/treeland/src/treeland/src/modules/wallpaper-color -I/build/treeland/src/treeland/src/modules/window-management -I/build/treeland/src/treeland/src/modules/virtual-output -I/build/treeland/src/treeland/src/modules/dde-shell -I/build/treeland/src/treeland/src/modules/capture -I/build/treeland/src/treeland/src/modules/item-selector -I/build/treeland/src/treeland/src/modules/ddm -isystem /usr/include/qt6/QtQml/6.9.2 -isystem /usr/include/qt6/QtQml/6.9.2/QtQml -isystem /usr/include/qt6/QtCore/6.9.2 -isystem /usr/include/qt6/QtCore/6.9.2/QtCore -isystem /usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem /usr/lib/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtQml -isystem /usr/include/qt6/QtQmlIntegration -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/dtk6/DCore -isystem /usr/include/qt6/QtDBus -isystem /usr/include/qt6/QtXml -isystem /usr/include/dtk6/DLog -isystem /usr/include/dtk6/DDeclarative -isystem /usr/include/qt6/QtQuick -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtQmlMeta -isystem /usr/include/qt6/QtQmlModels -isystem /usr/include/qt6/QtQmlWorkerScript -isystem /usr/include/qt6/QtOpenGL -isystem /usr/include/dtk6/DGui -isystem /usr/include/dtk6/DSystemSettings -isystem /usr/include/wlroots-0.19 -isystem /usr/include/pixman-1 -isystem /usr/include/libdrm -isystem /usr/include/qt6/QtQuickControls2 -isystem /usr/include/qt6/QtQuick/6.9.2 -isystem /usr/include/qt6/QtQuick/6.9.2/QtQuick -isystem /usr/include/qt6/QtGui/6.9.2 -isystem /usr/include/qt6/QtGui/6.9.2/QtGui -isystem /usr/include/qt6/QtQmlModels/6.9.2 -isystem /usr/include/qt6/QtQmlModels/6.9.2/QtQmlModels -isystem /usr/include/qt6/QtQmlMeta/6.9.2 -isystem /usr/include/qt6/QtQmlMeta/6.9.2/QtQmlMeta -isystem /usr/include/qt6/QtQmlWorkerScript/6.9.2 -isystem /usr/include/qt6/QtQmlWorkerScript/6.9.2/QtQmlWorkerScript -isystem /usr/include/qt6/QtConcurrent -isystem /usr/include/ddm/auth -isystem /usr/include/ddm/common -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/treeland/src=/usr/src/debug/treeland -flto=auto -std=gnu++20 -fPIC -mno-direct-extern-access -MD -MT src/CMakeFiles/libtreeland.dir/libtreeland_autogen/mocs_compilation.cpp.o -MF src/CMakeFiles/libtreeland.dir/libtreeland_autogen/mocs_compilation.cpp.o.d -o src/CMakeFiles/libtreeland.dir/libtreeland_autogen/mocs_compilation.cpp.o -c /build/treeland/src/treeland/src/libtreeland_autogen/mocs_compilation.cpp
In file included from /usr/include/qt6/QtCore/qobject.h:18,
                 from /usr/include/qt6/QtCore/qabstractanimation.h:8,
                 from /usr/include/qt6/QtCore/QtCore:19,
                 from /usr/include/qt6/QtQmlIntegration/QtQmlIntegrationDepends:3,
                 from /usr/include/qt6/QtQmlIntegration/QtQmlIntegration:3,
                 from /build/treeland/src/treeland/waylib/src/server/kernel/wglobal.h:8,
                 from /build/treeland/src/treeland/waylib/src/server/qtquick/wsurfaceitem.h:6,
                 from /build/treeland/src/treeland/src/surface/surfacewrapper.h:5,
                 from /build/treeland/src/treeland/src/surface/surfacecontainer.h:5,
                 from /build/treeland/src/treeland/src/libtreeland_autogen/TAC5DWH4SE/../../core/lockscreen.h:6,
                 from /build/treeland/src/treeland/src/libtreeland_autogen/TAC5DWH4SE/moc_lockscreen.cpp:9,
                 from /build/treeland/src/treeland/src/libtreeland_autogen/mocs_compilation.cpp:2:
/usr/include/qt6/QtCore/qmetatype.h: In instantiation of ‘constexpr bool QtPrivate::checkTypeIsSuitableForMetaType() [with X = TreelandConfig*]’:
/usr/include/qt6/QtCore/qmetatype.h:2661:43:   required from ‘constexpr const QtPrivate::QMetaTypeInterface* QtPrivate::qTryMetaTypeInterfaceForType() [with Unique = void; T = TreelandConfig*]’
 2661 |         checkTypeIsSuitableForMetaType<Ty>();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/include/qt6/QtCore/qtmochelpers.h:170:51:   required from ‘static constexpr void QtMocHelpers::detail::MetaTypeList<TypeMustBeComplete, T>::copyTo(Result&, uint&) [with Unique = void; Result = QtMocHelpers::MetaObjectContents<255, 112, 807, 45>; bool TypeMustBeComplete = true; T = {TreelandConfig*}; uint = unsigned int]’
  170 |                 qTryMetaTypeInterfaceForType<U, T>()...
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/include/qt6/QtCore/qtmochelpers.h:262:65:   required from ‘constexpr const QtMocHelpers::MetaObjectContents<255, 112, 807, 45> Helper::qt_staticMetaObjectContent<{anonymous}::qt_meta_tag_ZN6HelperE_t>’
  262 |             decltype(input.metaTypes())::template copyTo<Unique>(result, metatypeoffset);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/build/treeland/src/treeland/src/libtreeland_autogen/LTNFY7LWQW/../../seat/helper.h:106:5:   required from ‘constexpr const auto Helper::qt_staticMetaObjectStaticContent<{anonymous}::qt_meta_tag_ZN6HelperE_t>’
  106 |     Q_OBJECT
      |     ^~~~~~~~
/build/treeland/src/treeland/src/libtreeland_autogen/LTNFY7LWQW/moc_helper.cpp:217:5:   required from here
  217 |     qt_staticMetaObjectStaticContent<qt_meta_tag_ZN6HelperE_t>.stringdata,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/treeland/src/treeland/src/libtreeland_autogen/LTNFY7LWQW/../../seat/helper.h:106:5:   in ‘constexpr’ expansion of ‘Helper::qt_create_metaobjectdata<{anonymous}::qt_meta_tag_ZN6HelperE_t>()’
/build/treeland/src/treeland/src/libtreeland_autogen/LTNFY7LWQW/moc_helper.cpp:212:54:   in ‘constexpr’ expansion of ‘QtMocHelpers::metaObjectData<Helper, void, StringRefStorage<char [7], char [12], char [5], char [14], char [5], char [21], char [1], char [21], char [24], char [22], char [18], char [18], char [19], char [28], char [16], char [16], char [8], char [16], char [7], char [21], char [36], char [8], char [28], char [14], char [17], char [18], char [6], char [13], char [10], char [16], char [11], char [10], char [12], char [15], char [14], char [14], char [22], char [15], char [11], char [11], char [21], char [18], char [14], char [17], char [10], char [11], char [7], char [16], char [21], char [5], char [10], char [12], char [7], char [11], char [13], char [14]>, UintData<SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SlotData<void(SurfaceWrapper*, Qt::FocusReason)>, SlotData<void(SurfaceWrapper*)>, SlotData<void(SurfaceWrapper*, Qt::FocusReason)>, SlotData<void(SurfaceWrapper*)>, SlotData<void(SurfaceWrapper*)>, SlotData<bool(SurfaceWrapper*)>, SlotData<void()>, SlotData<void()>, SlotData<void(bool)>, SlotData<void(const QString&, const QDBusObjectPath&)>, MethodData<void()>, MethodData<bool(Waylib::Server::WLayerSurface*) const> >, UintData<PropertyData<bool>, PropertyData<RootSurfaceContainer*>, PropertyData<float>, PropertyData<Helper::OutputMode>, PropertyData<TogglableGesture*>, PropertyData<TogglableGesture*>, PropertyData<SurfaceWrapper*>, PropertyData<Workspace*>, PropertyData<TreelandConfig*>, PropertyData<bool> >, UintData<EnumData<Helper::OutputMode, 2>, EnumData<Helper::CurrentMode, 4> >, UintData<>, ClassInfos<2> >(0, qt_stringData, qt_methods, qt_properties, qt_enums, qt_constructors, qt_classinfo)’
/usr/include/qt6/QtCore/qtmochelpers.h:550:39:   in ‘constexpr’ expansion of ‘(& properties)->QtMocHelpers::UintData<QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::copyTo<void, QtMocHelpers::MetaObjectContents<255, 112, 807, 45> >(result, ((size_t)dataoffset), metatypeoffset)’
/usr/include/qt6/QtCore/qtmochelpers.h:255:21:   in ‘constexpr’ expansion of ‘((const QtMocHelpers::UintData<QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >*)this)->QtMocHelpers::UintData<QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::data.QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9>, QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::forEach<QtMocHelpers::UintData<QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::copyTo<void, QtMocHelpers::MetaObjectContents<255, 112, 807, 45> >(QtMocHelpers::MetaObjectContents<255, 112, 807, 45>&, size_t, uint&) const::<lambda(const auto:60&)> >(<lambda closure object>QtMocHelpers::UintData<QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::copyTo<void, QtMocHelpers::MetaObjectContents<255, 112, 807, 45> >(QtMocHelpers::MetaObjectContents<255, 112, 807, 45>&, size_t, uint&) const::<lambda(const auto:60&)>{ptr, dataoffset, payloadoffset, (* & metatypeoffset), (* & result)})’
/usr/include/qt6/QtCore/qtmochelpers.h:204:19:   in ‘constexpr’ expansion of ‘invoke.QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9>, QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::forEach<QtMocHelpers::UintData<QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::copyTo<void, QtMocHelpers::MetaObjectContents<255, 112, 807, 45> >(QtMocHelpers::MetaObjectContents<255, 112, 807, 45>&, size_t, uint&) const::<lambda(const auto:60&)> >(QtMocHelpers::UintData<QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::copyTo<void, QtMocHelpers::MetaObjectContents<255, 112, 807, 45> >(QtMocHelpers::MetaObjectContents<255, 112, 807, 45>&, size_t, uint&) const::<lambda(const auto:60&)>&&) const::<lambda(const auto:59&)>(((const QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9>, QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >*)this)->QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9>, QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::QtMocHelpers::detail::UintDataEntry<8, QtMocHelpers::PropertyData<TreelandConfig*> >)’
/usr/include/qt6/QtCore/qtmochelpers.h:201:67:   in ‘constexpr’ expansion of ‘(& f)->QtMocHelpers::UintData<QtMocHelpers::PropertyData<bool>, QtMocHelpers::PropertyData<RootSurfaceContainer*>, QtMocHelpers::PropertyData<float>, QtMocHelpers::PropertyData<Helper::OutputMode>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<TogglableGesture*>, QtMocHelpers::PropertyData<SurfaceWrapper*>, QtMocHelpers::PropertyData<Workspace*>, QtMocHelpers::PropertyData<TreelandConfig*>, QtMocHelpers::PropertyData<bool> >::copyTo<void, QtMocHelpers::MetaObjectContents<255, 112, 807, 45> >(QtMocHelpers::MetaObjectContents<255, 112, 807, 45>&, size_t, uint&) const::<lambda(const auto:60&)>(entry.QtMocHelpers::detail::UintDataEntry<8, QtMocHelpers::PropertyData<TreelandConfig*> >::entry)’
/usr/include/qt6/QtCore/qmetatype.h:1209:55: error: static assertion failed: Pointer Meta Types must either point to fully-defined types or be declared with Q_DECLARE_OPAQUE_POINTER(T *)
 1209 |             static_assert(is_complete<Pointed, void>::value,
      |                                                       ^~~~~
/usr/include/qt6/QtCore/qmetatype.h:1209:55: note: ‘std::integral_constant<bool, false>::value’ evaluates to false
/usr/include/qt6/QtCore/qmetatype.h: In instantiation of ‘constexpr bool QtPrivate::checkTypeIsSuitableForMetaType() [with X = TreelandConfig]’:
/usr/include/qt6/QtCore/qmetatype.h:2678:49:   required from ‘static constexpr QMetaType QMetaType::fromType() [with T = TreelandConfig]’
 2678 |     QtPrivate::checkTypeIsSuitableForMetaType<T>();
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/include/qt6/QtCore/qtmochelpers.h:559:88:   required from ‘constexpr auto QtMocHelpers::metaObjectData(uint, const Strings&, const Methods&, const Properties&, const Enums&, const Constructors&, const ClassInfo&) [with ObjectType = TreelandConfig; Unique = {anonymous}::qt_meta_tag_ZN14TreelandConfigE_t; Strings = StringRefStorage<char [15], char [15], char [752], char [16], char [20], char [19], char [4], char [23], char [1], char [20], char [7], char [24], char [13], char [4], char [9], char [6], char [19], char [24], char [19], char [23], char [18], char [23], char [25], char [24], char [27], char [23], char [12], char [16], char [27], char [28], char [21], char [18], char [20], char [37], char [16], char [38], char [40], char [32], char [36], char [37], char [31], char [35], char [37], char [26], char [20], char [18], char [18], char [17], char [28], char [24], char [21], char [20], char [23], char [28], char [34], char [28], char [28], char [20], char [19], char [15], char [8], char [15], char [26], char [31], char [26], char [30], char [25], char [30], char [32], char [31], char [34], char [30], char [19], char [23], char [34], char [35], char [28], char [25], char [27], char [44], char [23], char [45], char [47], char [39], char [43], char [44], char [38], char [42], char [44], char [33], char [27], char [25], char [25], char [24], char [35], char [31], char [28], char [27], char [30], char [35], char [41], char [35], char [35], char [12], char [17], char [12], char [16], char [11], char [16], char [18], char [17], char [20], char [16], char [5], char [9], char [20], char [21], char [14], char [11], char [13], char [30], char [9], char [31], char [33], char [25], char [29], char [30], char [24], char [28], char [30], char [19], char [13], char [11], char [11], char [10], char [21], char [17], char [14], char [13], char [16], char [21], char [27], char [21], char [21]>; Methods = UintData<SignalData<void(Dtk::Core::DConfig*)>, SignalData<void(Dtk::Core::DConfig*)>, SignalData<void(const QString&, const QVariant&)>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, SignalData<void()>, MethodData<Dtk::Core::DConfig*() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<QList<QString>() const>, MethodData<bool(const QString&) const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const>, MethodData<bool() const> >; Properties = UintData<PropertyData<QString>, PropertyData<long long int>, PropertyData<bool>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<QString>, PropertyData<QString>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<QString>, PropertyData<long long int>, PropertyData<bool>, PropertyData<long long int>, PropertyData<QString>, PropertyData<QString>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<QString>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<double>, PropertyData<double>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<bool>, PropertyData<bool>, PropertyData<QString>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int>, PropertyData<long long int> >; Enums = UintData<>; Constructors = UintData<>; ClassInfo = ClassInfos<3>; uint = unsigned int]’
  559 |     result.relocatingData.metaTypes[metatypeoffset++] = QMetaType::fromType<ObjectType>().iface();
      |                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/build/treeland/src/treeland/src/libtreeland_autogen/EWIEGA46WW/moc_treelandconfig.cpp:482:91:   required from here
  482 |     return QtMocHelpers::metaObjectData<TreelandConfig, qt_meta_tag_ZN14TreelandConfigE_t>(QMC::MetaObjectFlag{}, qt_stringData,
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  483 |             qt_methods, qt_properties, qt_enums, qt_constructors, qt_classinfo);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/qt6/QtCore/qmetatype.h:1203:51: error: static assertion failed: Meta Types must be fully defined
 1203 |         static_assert(is_complete<T, void>::value || std::is_void_v<T>,
      |                                             ~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/qt6/QtCore/qmetatype.h:1203:51: note: ‘(((bool)std::integral_constant<bool, false>::value) || ((bool)std::is_void_v<TreelandConfig>))’ evaluates to false
```
2025-10-09 09:55:27 +08:00
JiDe Zhang 232cf374c2 fix: include Qt private modules for Qt 6.11
This commit explicitly includes `GuiPrivate` and `QuickPrivate` Qt
modules in `CMakeLists.txt` for both the `waylib` and `waylib/src/
server` directories. This is necessary because Qt 6.11 and later
versions no longer implicitly include these private modules. Failing
to include them results in build failures due to missing headers and
symbols.

Log: Fixed build issue with Qt 6.11 and later versions by explicitly
including necessary private Qt modules.

Influence:
1. Verify that the project builds successfully with Qt versions 6.11
and later.
2. Ensure that all functionalities relying on Qt private modules
(e.g., custom QML components, internal Qt API usage) continue to work
as expected.
3. Test on different platforms (Linux, Windows, macOS) where Qt is used.

fix: 为 Qt 6.11 包含 Qt 私有模块

此提交在 `waylib` 和 `waylib/src/server` 目录的 `CMakeLists.txt` 中显式
包含 `GuiPrivate` 和 `QuickPrivate` Qt 模块。 这是必要的,因为 Qt 6.11
及更高版本不再隐式包含这些私有模块。 未能包含它们会导致由于缺少头文件和
符号而导致构建失败。

Log: 通过显式包含必要的私有 Qt 模块,修复了 Qt 6.11 及更高版本的构建
问题。

Influence:
1. 验证项目是否可以使用 Qt 6.11 及更高版本成功构建。
2. 确保所有依赖于 Qt 私有模块的功能(例如,自定义 QML 组件、内部 Qt API
使用)继续按预期工作。
3. 在使用 Qt 的不同平台(Linux、Windows、macOS)上进行测试。
2025-09-29 20:33:10 +08:00
Lu YaNing 16240cba52 feat: add real-time FPS display
Introduces an on-screen FPS overlay with timer-based sampling aligned
to the active screen’s refresh rate. automatic refresh-rate handling
on screen changes.
2025-09-26 11:04:13 +08:00
April & May 8fdd5703a6 feat: support start sessions other than treeland
This commit fixed the SessionModel and SessionList, and enabled session
selection by adding a button to ControlAction.qml. Thus treeland can act
as a greeter of ddm, guide the start of other desktop environment.
2025-09-26 10:33:25 +08:00
miruku d9cd9e855d feat: implement ext-session-lock-v1 support
This commit adds support for the ext-session-lock-v1 protocol to
Treeland compositor.

The implementation allows for a grace delay of 300ms for client to
properly setup locking surfaces before sending locking.
The implementation also disables animation for locking triggered by
ext-session-lock-v1.
When the lock is abandoned, if lockscreen plugin is loaded, treeland
automaticly replace lock surfaces with that provided by the plugin.
If else, the session will remain locked forever.

Implementation Details:
1. lockscreen.cpp: extend the LockScreen class to handle locking
initiated by WSessionLock object.
2. qmlengine: add a fallback LockScreen of solid grey color, in case
if the locking client erronously deleted a lock surface before unlock.
3. treeland.cpp: allow loading the lockscreen plugin without DDM support.
4. output.cpp: allow session lock surfaces to ignore exclusive zones.
5. helper.cpp: attaches WSessionLockManager and handle screen lock logics.
6. surfacewrapper.cpp: added the LockScreen type to SurfaceWrapper
2025-09-26 10:23:25 +08:00
miruku 84379d1ca5 feat(waylib): implement ext-session-lock-v1 protocol support
This commit adds support for the Wayland ext-session-lock-v1 protocol.

1. Added Class
    - WSessionLockManager
    - WSessionLock
    - WSessionLockSurface

2. Implementation Details
Lifecycle of WSessionLock is managed by the WSessionLockManager.

Lifecycle of WSessionLockSurface is managed by its WSessionLock.

WSessionLock handles identification of all possible states a session lock
object can experiance, they are listed as follows:
- Created: default state
- Locked: session locked (after send_locked() is sent)
- Unlocked: client sent unlock_and_destroy()
- Finished: locking denyed by server sending finish()
- Canceled: lock destroyed by client before send_locked() is sent
- Abandoned: lock abnormally destroyed by client after locking

3. tinywl
An example usage is provided in the updated tinywl compositor.
2025-09-26 10:23:25 +08:00
miruku 0544ca405a fix(waylib): Add missing override specifier in wlayersurface
This commit added the override specifier for waylandClient() and
instantRelease() methods in class WLayerSurfacePirvate.

waylandClient() is a virtual function in class WObjectPrivate,
instantRelease() is a virtual function in clas WWrapObjectPrivate.
2025-09-26 10:23:25 +08:00
miruku b10c1f427b fix(qwlroots): allow server side destruction of qw_session_lock_v1
This commit exposes wlr_session_lock_v1_destroy as
qw_session_lock_v1::destroy(), which allows the compositor
to send finished() event on an ext_session_lock_v1 object.

qw_session_lock_v1 objects are not the owner of their handles,
thus cannot be properly destroyed via operator delete. Exposing
the destroy() method as public is necessary.

According to wayland protocol, compositor should have the ability
to deny a session lock request.
2025-09-26 10:23:25 +08:00
Lu YaNing 5b4d7b5de5 fix: Delete useless display text in copy mode
Remove debug display text in copy mode
2025-09-26 10:01:53 +08:00
Lu YaNing e843122e9e fix: enhance output validation in restore copy mode
Add invalid output detection to prevent crashes
2025-09-26 10:01:53 +08:00
April & May f4386256ca fix: use separate TreelandConfig for each user
This should work as intended.
2025-09-24 15:30:16 +08:00
JiDe Zhang b0601f90d1 fix: Ensure proper object destruction before app exit
This commit addresses an issue where the application would fail with
an assertion failure related to `qw_buffer` objects not being properly
released upon exiting the application. The previous implementation
directly called `QCoreApplication::exit` or `QCoreApplication::quit`,
which would trigger the destruction of various `QObject` instances
(such as `Helper` and `QmlEngine`) *after* the Qt event loop had already
exited.

Since many of these objects relied on `deleteLater` for their
destruction, and `deleteLater` calls are ineffective once the event loop
has terminated, these objects were not being fully destructed, leading
to resource leaks and the aforementioned assertion failure.

The solution involves ensuring that all necessary objects are
explicitly destroyed *before* calling `QCoreApplication::exit` or
`QCoreApplication::quit`.  Specifically:

1.  A `quit()` method has been added to the `Treeland` class, which
disconnects the object from all signals and slots, and then resets the
`d_ptr` (unique pointer to the private implementation) to ensure all
Treeland related objects are properly deleted. This cleanup happens
before calling `qApp->quit()`.
2.  The signal connection between `QQmlEngine::quit` and
`QCoreApplication::quit` is changed to a `Qt::QueuedConnection` to avoid
potential issues when the quit call originates from within an event
handler (e.g., a cursor button press/release event).
3.  A new signal `requestQuit()` is introduced in `Helper` and emitted
instead of directly calling `qApp->quit()`.  This signal is then
connected to the `Treeland::quit()` method using `Qt::QueuedConnection`.
4.  In the `tinywl` example, the `QmlEngine` object is now
dynamically allocated and explicitly deleted before `app.exit()`
is called. The `Helper::requestQuit` signal is also connected to
`QmlEngine::deleteLater`.

These changes ensure that all relevant objects have been properly
cleaned up before the application terminates, resolving the assertion
failure and preventing potential resource leaks.

Influence:
1. Verify that the application exits cleanly without any assertion
failures related to `qw_buffer` or other resources.
2. Test exiting the application using various methods (e.g., the window
close button, a menu item, or a keyboard shortcut).
3. Ensure that all application data is saved correctly before exiting.
4. Test that the `LockScreen` object is properly destroyed by manually
creating and destroying a LockScreen object with the setLockScreenImpl
call in Helper.

修复程序退出前对象未正确销毁的问题

此提交修复了应用程序退出时,由于 `qw_buffer` 对象未正确释放而导
致的断言失败问题。 之前的实现直接调用 `QCoreApplication::exit` 或
`QCoreApplication::quit`,导致各种 `QObject` 实例(例如 `Helper` 和
`QmlEngine`)在 Qt 事件循环结束后才被销毁。

由于许多这些对象依赖于 `deleteLater` 进行销毁,并且一旦事件循环终止,
`deleteLater` 调用将无效,因此这些对象没有被完全销毁,从而导致资源泄漏和
前面提到的断言失败。

解决方案包括确保在调用 `QCoreApplication::exit` 或
`QCoreApplication::quit` 之前显式销毁所有必要的对象。 具体来说:

1.  在 `Treeland` 类中添加了一个 `quit()` 方法,该方法断开对象与所有
信号和槽的连接,然后重置 `d_ptr`(指向私有实现的唯一指针),以确保与
Treeland 相关的所有对象都得到正确删除。 此清理发生在调用 `qApp->quit()`
之前。
2.  `QQmlEngine::quit` 和 `QCoreApplication::quit` 之间的信号连接已更改
为 `Qt::QueuedConnection`,以避免在退出调用源自事件处理程序内(例如,光
标按钮按下/释放事件)时出现潜在问题。
3.  在 `Helper` 中引入了一个新的信号 `requestQuit()`,并发出该信号而不是
直接调用 `qApp->quit()`。 然后使用 `Qt::QueuedConnection` 将此信号连接到
`Treeland::quit()` 方法。
4. 在`tinywl`示例中,`QmlEngine` 对象现在是动态分配的,并在调
用 `app.exit()` 之前显式删除。 `Helper::requestQuit` 信号也连接到
`QmlEngine::deleteLater`。

这些更改确保在应用程序终止之前已正确清理所有相关对象,从而解决了断言失败
并防止了潜在的资源泄漏。

Influence:
1. 验证应用程序是否干净地退出,而不会出现与 `qw_buffer` 或其他资源相关的
任何断言失败。
2. 使用各种方法(例如,窗口关闭按钮、菜单项或键盘快捷键)测试退出应用
程序。
3. 确保在退出之前正确保存所有应用程序数据。
4. 通过使用 Helper 中的 setLockScreenImpl 调用手动创建和销毁 LockScreen
对象来测试 LockScreen 对象是否已正确销毁。
2025-09-24 11:38:46 +08:00
JiDe Zhang 801e2fbf24 fix: improve resource management for RenderControl
1.  Changed the destruction timing of RenderControl. Using deleteLater()
on RenderControl caused a crash when OpenGL makeCurrent() was called.
This is because the RenderControl was being deleted in a deferred
manner, potentially after the OpenGL context was already being used
or destroyed.
2.  Switched to immediate deletion of RenderControl in the
WOutputRenderWindow destructor to avoid the crash.
3.  Modified WBufferRenderer to use std::unique_ptr for buffer
management to ensure timely unlocking.

Influence:
1.  Verify that applications using WOutputRenderWindow do not crash
on shutdown.
2.  Check resource usage related to graphics buffers to ensure proper
allocation and deallocation.
3.  Run performance tests to ensure that the change in deletion timing
does not negatively impact rendering performance.
4.  Test the texture provider to verify the buffer is handled correctly.

fix: 改善 RenderControl 的资源管理

1.  更改了 RenderControl 的销毁时机。在 RenderControl 上使用
deleteLater() 会导致调用 OpenGL makeCurrent() 时崩溃。这是因为
RenderControl 以延迟方式被删除,可能在 OpenGL 上下文已经被使用或销毁
之后。
2.  切换到在 WOutputRenderWindow 析构函数中立即删除 RenderControl,以避
免崩溃。
3.  修改 WBufferRenderer 以使用 std::unique_ptr 进行缓冲区管理,以确保及
时解锁。

Influence:
1.  验证使用 WOutputRenderWindow 的应用程序在关闭时不会崩溃。
2.  检查与图形缓冲区相关的资源使用情况,以确保正确分配和释放。
3.  运行性能测试以确保删除时机的变化不会对渲染性能产生负面影响。
4.  测试纹理提供程序以验证缓冲区是否已正确处理。
2025-09-24 11:38:46 +08:00
JiDe Zhang 5d16c8cada fix: fix heap-use-after-free on exit
The WQuickCursor was using a raw pointer to WCursor, which could be
accessed after the WCursor object had been destroyed during application
shutdown, leading to a heap-use-after-free error. This change replaces
the raw pointer with a QPointer, ensuring that the WQuickCursor only
accesses the WCursor object if it is still valid.

Influence:
1. Run the application and exit to ensure no heap-use-after-free error
occurs.
2. Test cursor functionalities to ensure they still work as expected.

fix: 修复程序退出时堆释放后使用问题

WQuickCursor 使用指向 WCursor 的原始指针,该指针可能在应用程序关闭期间
WCursor 对象被销毁后被访问,从而导致堆释放后使用错误。此更改将原始指针替
换为 QPointer,确保 WQuickCursor 仅在 WCursor 对象仍然有效时才访问它。

Influence:
1. 运行应用程序并退出,确保不会发生堆释放后使用错误。
2. 测试光标功能,确保它们仍然按预期工作。
2025-09-24 11:38:46 +08:00
rewine 2bc9ef62fe chore(debian): update version to 0.7.3
bug fix
2025-09-23 17:38:53 +08:00
April & May fc6d684513 fix: fix WorkspaceSelectionList animation's highlight border size
The calculation of the rectangle is incorrect, and the rectangle will be
wider than its content. Fix it using correct calculation.
2025-09-23 17:23:26 +08:00
April & May 5c701f8767 fix: fix MultitaskView display problem
workspaceDelegateHeight property is removed from new TreelandConfig.
This commit adapt the change and fixed the MultitaskView display
problem.
2025-09-23 17:22:24 +08:00
JiDe Zhang 51f403769e refactor: reduce cursor-related log verbosity
The verbosity of cursor input and touch event logs has been reduced
from `QtDebugMsg` to `QtInfoMsg`.  The high volume of debug logs was
overwhelming during development and debugging, making it difficult to
identify important information.  By reducing the default log level,
only essential cursor-related information will be displayed unless debug
logging is specifically enabled. This change improves the clarity and
usability of log output during development.

Influence:
1. Verify cursor functionality remains unaffected by the log level
change.
2. Confirm that important cursor events are still logged at the
`QtInfoMsg` level.
3. Enable debug logging to ensure detailed cursor information is
available when needed.
4. Test with different input devices (mouse, touchpad, touch screen) to
ensure consistent behavior.

refactor: 降低光标相关日志的详细程度

光标输入和触摸事件日志的详细程度已从 `QtDebugMsg` 降低到 `QtInfoMsg`。
大量的调试日志在开发和调试过程中造成了信息过载,难以识别重要信息。 通过
降低默认日志级别,除非专门启用调试日志记录,否则只会显示基本的光标相关信
息。 此更改提高了开发期间日志输出的清晰度和可用性。

Influence:
1. 验证光标功能是否未受日志级别更改的影响。
2. 确认重要的光标事件仍然以 `QtInfoMsg` 级别记录。
3. 启用调试日志记录以确保在需要时可以使用详细的光标信息。
4. 使用不同的输入设备(鼠标、触摸板、触摸屏)进行测试,以确保行为一致。
2025-09-23 16:49:23 +08:00
April & May e03fd2fdb3 fix: fix MultitaskView display problem caused by refactoring TreelandConfig
This commit cleans up changes left from refactoring TreelandConfig,
which caused MultitaskView display incorrectly.
2025-09-23 15:26:17 +08:00
transifex-integration[bot] 4ef86fc3fd
Updates for project TreeLand (#563) 2025-09-21 15:05:11 +08:00
rewine f2ac25fc05 chore(debian): update version to 0.7.2
fix: crash on startup due to uninitialized m_config
2025-09-19 11:34:44 +08:00
Lu YaNing 6ec120d449 fix: crash on startup due to uninitialized m_config pointer
The m_config member variable contained garbage value instead of
nullptr because C++ doesn't auto-initialize pointer members.
This caused invalid memory access and crash during startup.

Initialize m_config to nullptr to ensure proper initial state.
2025-09-19 10:02:58 +08:00
rewine 03094c5d8a chore(debian): update version to 0.7.1
Update Debian packaging
2025-09-18 13:21:42 +08:00
rewine 04bf8b3ddc fix: Fix socket blocking issue in Wayland server connection handling
1. Set server socket to non-blocking mode to prevent accept() calls from
blocking the main thread indefinitely.
2. Improved wl_os_accept_cloexec function to use accept4 with SOCK_CLOEXEC
flag as the preferred method on modern Linux systems, with fallback to
traditional accept() + fcntl approach for compatibility.
3. Added proper error handling for ENOSYS case when accept4 is not supported.

The blocking issue occurred when the Wayland server was waiting for client
connections, causing the entire compositor to freeze. This fix follows the
same pattern used in libwayland for robust socket handling.

Log: Fixed Wayland server socket blocking in accept() calls

Influence:
1. Test server startup and client connection establishment
2. Verify proper handling of multiple concurrent client connections
3. Check compatibility on systems without accept4 support
4. Ensure no regression in socket file descriptor management

修复:修复Wayland服务器连接处理中的socket阻塞问题

1. 将服务器socket设置为非阻塞模式,防止accept()调用无限期阻塞主线程。
2. 改进wl_os_accept_cloexec函数,在现代Linux系统上优先使用带SOCK_CLOEXEC
标志的accept4方法,同时为兼容性保留传统的accept() + fcntl方法作为后备。
3. 为不支持accept4的ENOSYS情况添加了适当的错误处理。

当Wayland服务器等待客户端连接时会发生阻塞问题,导致整个合成器冻结。此修复
遵循libwayland中用于健壮socket处理的相同模式。

Log: 修复Wayland服务器socket在accept()调用中的阻塞问题

Influence:
1. 测试服务器启动和客户端连接建立
2. 验证多个并发客户端连接的正确处理
3. 检查在不支持accept4的系统上的兼容性
4. 确保socket文件描述符管理中没有回归
2025-09-17 14:32:44 +08:00
rewine 794124ba68 fix: correct window title visibility condition
Changed the visibility condition for window titles in the multitask view
from checking 'highlighted' to checking the surfaceItemDelegate state.
This ensures titles are only shown when in taskview mode, not during
other states like window dragging or animation transitions.

The previous implementation could show titles during transitions when
they shouldn't be visible, causing visual artifacts. The new condition
properly aligns with the intended UI behavior where titles should only
appear in the stable taskview state.

Log: Fixed window titles appearing during transitions in multitask view

Influence:
1. Test multitask view to verify titles only appear in taskview state
2. Check window dragging and transitions to ensure titles remain hidden
3. Verify title visibility with empty/non-empty titles
4. Test with different window states and transitions

fix: 修正窗口标题可见性条件

将多任务视图中窗口标题的可见性条件从检查'highlighted'改为检查
surfaceItemDelegate状态。这确保标题仅在taskview模式下显示,而不是在窗口
拖动或动画过渡等其他状态时显示。

之前的实现在不应显示标题的过渡期间可能会显示标题,导致视觉伪影。新条件正
确符合预期的UI行为,即标题应仅在稳定的taskview状态下出现。

Log: 修复多任务视图中窗口标题在过渡期间出现的问题

Influence:
1. 测试多任务视图,验证标题仅在taskview状态下显示
2. 检查窗口拖动和过渡,确保标题保持隐藏
3. 验证空/非空标题的可见性
4. 测试不同窗口状态和过渡
2025-09-16 14:12:54 +08:00
JiDe Zhang 9556ef8950 fix: Fix client crash when created via security context
1. Fixed a crash issue where clients created through the security
context could not obtain the corresponding WClient object.
2. Clients created via security context use a new socket connection,
which is not managed by WSocket by default.
3. The wlroots protocol provides limited information for monitoring
such wl_clients.
4. This commit adapts the wlroots implementation: in
`security_context_handle_commit`, a new WSocket object is created for
the listening socket, and the new wl_client object created from this
socket is added to WClient for management.

Influence:
1. Test the creation of clients using the security context.
2. Verify that the created clients can correctly obtain the WClient
object.
3. Ensure that newly created sockets are correctly managed.

修复:修复通过安全上下文创建的客户端崩溃问题

1. 修复了通过安全上下文创建的客户端无法获取对应的 WClient 对象导致崩溃的
问题。
2. 通过安全上下文创建的客户端使用新的套接字连接,默认情况下不由 WSocket
管理。
3. wlroots 协议为监控此类 wl_clients 提供的相关信息有限。
4. 本次提交采纳了 wlroots 的实现:在 `security_context_handle_commit`
中,为监听的套接字创建一个新的 WSocket 对象,并将由此套接字创建的新
wl_client 对象添加到 WClient 中进行管理。

Influence:
1. 测试使用安全上下文创建客户端的过程。
2. 验证创建的客户端能否正确获取 WClient 对象。
3. 确保新创建的套接字能够得到正确的管理。
2025-09-15 14:48:34 +08:00
YaoBing Xiao 23192a4b14 feat: add security-context support
create security-context gloabl.

Log:
2025-09-11 19:07:10 +08:00
April & May fa1e1e6a18 fix: Separate DConfig object creation to another thread to avoid blocking
DConfig object creation involves D-Bus communication, which may block
when placed in the main thread. This commit adapt dconfig2cpp tool to
generate DConfig wrapper safely running in another thread, to avoid this
problem.
2025-09-11 19:06:22 +08:00
April & May e66c0a1b74 fix: move DBus call to separate thread to avoid blocking
Since obtaining DBus interface & calling DBus functions may block
current thread, it's better to place DBus-related codes out of the main
thread. This commit puts DBus call to separate thread if possible.
2025-09-11 19:04:47 +08:00
miruku 1411fb2ef7 fix: fixing some trivial memory management bugs. 2025-09-10 13:34:11 +08:00
rewine a43e0ed3d4 feat(core): Add support for XDG toplevel surface and XDG shell in RootSurfaceContainer
- Added include for `wxdgtoplevelsurface.h`
- Added include for `qwxdgshell.h`
- Handled initialization check for XDG toplevel surface
- Updated logic to set owns output and ensure surface position validity for XDG toplevel surface
- Added support to set Xwayland position from surface when initialized

Background:
When the window is destroyed while being dragged, `endMoveResize` is triggered. If `config` function is called after the window is destroyed, it will crash. Therefore, the check for `initialized` is added due to its reset in `reset_xdg_surface` where an `xdg_surface` implementation is reset under the following conditions:
1) A surface is unmapped due to a commit with NULL buffer
2) The `xdg_surface` role object is destroyed
3) `wlr_xdg_surface` is destroyed
2025-09-10 13:28:36 +08:00
JiDe Zhang 1cbcd3e402 fix: correct refresh rate on multi-monitor
1. Fixed an issue where the client window's refresh rate was incorrect
when using multiple monitors.
2. The problem was caused by sending `frame_done` notifications to the
client window regardless of which screen refreshed. This resulted in
double the `frame_done` notifications being sent when using two screens.
3. The solution is to only send `frame_done` notifications to the
surface when the screen with the highest refresh rate, where the surface
is located, commits. This behavior is consistent with how wlroots and
mutter handle it.
4. The code was modified in `WOutputRenderWindow::doRender` to track
which outputs were actually committed and then the `WSurfaceItem` checks
that it only sends `notifyFrameDone` if the `framePacingOutput` was
committed.
5. Added logging for when there is no `WOutputRenderWindow`.

Influence:
1. Test with multiple monitors with different refresh rates.
2. Verify that the client window's refresh rate matches the refresh rate
of the screen it's primarily on.
3. Use a tool like http://testufo.com/ to visually confirm the correct
refresh rate.
4. Test moving the window between screens with different refresh rates
and observe the refresh rate change.

fix: 修复多显示器刷新率错误问题

1. 修复了使用多个显示器时客户端窗口刷新率不正确的问题。
2. 问题的原因是无论哪个屏幕刷新,都会向客户端窗口发送 `frame_done` 通
知。这导致在使用两个屏幕时发送双倍的 `frame_done` 通知。
3. 解决方案是仅在表面所在的具有最高刷新率的屏幕提交时才向该表面发送
`frame_done` 通知。此行为与 wlroots 和 mutter 的处理方式一致。
4. 修改了 `WOutputRenderWindow::doRender` 中的代码以跟踪实际提交的输出,
然后 `WSurfaceItem` 检查它是否仅在 `framePacingOutput` 已提交时才发送
`notifyFrameDone`。
5. 添加了在没有 `WOutputRenderWindow` 时的日志记录。

Influence:
1. 使用具有不同刷新率的多个显示器进行测试。
2. 验证客户端窗口的刷新率与其主要所在的屏幕的刷新率相匹配。
3. 使用 http://testufo.com/ 等工具以直观地确认正确的刷新率。
4. 测试在具有不同刷新率的屏幕之间移动窗口并观察刷新率的变化。
2025-09-08 11:18:20 +08:00
JiDe Zhang 90e2762dcc fix: redraw when frame callback list updates
1.  The previous logic only redrew the surface when the buffer changed,
which is insufficient.
2.  Firefox frequently updates the frame callback list using
`WLR_SURFACE_STATE_FRAME_CALLBACK_LIST`. Receiving such commits should
also trigger a redraw to trigger the frame done event for the surface.
3.  This fixes an issue where Firefox windows would often not refresh
until the mouse was moved.

Influence:
1. Verify that Firefox windows now refresh correctly without requiring
mouse movement.
2. Ensure that other applications are not negatively affected by this
change.
3. Check for any performance regressions related to the increased redraw
frequency.

fix: 当帧回调列表更新时重绘

1. 之前的逻辑仅在缓冲区更改时才重绘表面,这不足够。
2. Firefox 经常使用 `WLR_SURFACE_STATE_FRAME_CALLBACK_LIST` 更新帧回调列
表。收到此类提交也应触发重绘,以触发表面的帧完成事件。
3. 这修复了 Firefox 窗口经常不刷新直到鼠标移动的问题。

Influence:
1. 验证 Firefox 窗口现在可以正确刷新,而无需移动鼠标。
2. 确保其他应用程序不会受到此更改的负面影响。
3. 检查与增加的重绘频率相关的任何性能下降。
2025-09-08 11:18:20 +08:00
rewine e7d27a914c chore(debian): update version to 0.7.0
Log: new tag
2025-08-29 12:05:50 +08:00
April & May 8a8bb8dec5 fix: fix treeland get stuck in lockscreen after crash recovery
Treeland will stuck in lockscreen after crash recovery, which is caused
by unintended login request for (for DDM) already logined user. This
commit adds a new DaemonMessages type, which is used to convey logined
users from DDM after socket connected, to avoid this problem.
2025-08-28 22:06:39 +08:00
YaoBing Xiao 69c55e454f fix: occasional crash during stop preview item handling
Add shellSurface() check in stopPreviewing.

Fixes linuxdeepin/treeland#536 crash3

Log:
2025-08-28 17:15:23 +08:00
April & May 18026e2c1a fix: refine TTY switching
1. Add callback for disableRender, to ensure render is exactly disabled
before DDM doing further actions;
2. Revoke all evdev devices before VT switch (at disableRender()), to
prevent accidental input events during switch;
3. Refine logic of switchToUser, take care of showing lockscreen after
switch;
4. Make event function args const
2025-08-28 13:52:41 +08:00
JiDe Zhang 81f014bf20 refactor: improve code robustness
This commit aims to improve the overall robustness of the code,
potentially addressing a rare crash scenario related to window
animations. While the exact cause of the crash is difficult to
reproduce, the changes implemented here are believed to mitigate the
issue. Specifically, the commit includes two key modifications:

1.  **SurfaceWrapper Destruction:** Enhanced the `SurfaceWrapper`
destructor to properly handle and delete animation objects
(`m_minimizeAnimation`, `m_showDesktopAnimation`). Additionally,
disconnect signals before deleting m_decoration and m_titleBar.
This ensures that these objects are properly cleaned up when the
`SurfaceWrapper` is destroyed, preventing potential dangling pointers
or memory leaks that could lead to crashes, especially in scenarios
involving complex window state transitions.
2.  **QmlEngine Component Ownership:** Modified the ownership
of objects created using `QmlEngine::createComponent`.
The ownership is now explicitly set to follow the parent
object using `QQmlEngine::setObjectOwnership(item,
QQmlEngine::objectOwnership(parent))`. This change ensures that the
QML engine correctly manages the lifecycle of these objects, preventing
potential issues related to object deletion or memory management if the
parent object is destroyed before the created component.

These changes are intended to make the application more stable and
resilient to unexpected conditions, particularly those involving
animations and object lifetime management within the QML engine.

Influence:
1. Thoroughly test window animations, including opening, closing,
minimizing, maximizing, and transitioning between different window
states.
2. Test application under heavy load and stress conditions to trigger
potential race conditions or memory leaks related to object creation
and destruction.
3. Monitor application logs for any warnings or errors related to QML
component creation or object lifetime management.
4. Try to reproduce corner cases when animations are interrupted.

重构: 提高代码健壮性

本次提交旨在提高代码的整体健壮性,可能修复与窗口动画相关的罕见崩溃情况。
虽然崩溃的确切原因难以重现,但相信此处实现的更改可以缓解该问题。具体来
说,此提交包括两个关键修改:

1.  **SurfaceWrapper 析构:** 增强了 `SurfaceWrapper` 析构函数,可以正确
处理和删除动画对象(`m_minimizeAnimation`, `m_showDesktopAnimation`)。此
外,在删除 m_decoration 和 m_titleBar 之前断开信号连接。这样可以确保在销
毁 `SurfaceWrapper` 时正确清理这些对象,防止潜在的悬空指针或内存泄漏,否
则可能导致崩溃,尤其是在涉及复杂窗口状态转换的情况下。
2.  **QmlEngine 组件所有权:** 修改了使用 `QmlEngine::createComponent`
创建的对象的所有权。现在,使用 `QQmlEngine::setObjectOwnership(item,
QQmlEngine::objectOwnership(parent))` 将所有权显式设置为跟随父对象。此更
改确保 QML 引擎正确管理这些对象的生命周期,防止在父对象在创建的组件之前
被销毁时,可能导致与对象删除或内存管理相关的问题。

这些更改旨在使应用程序更加稳定并能够适应意外情况,尤其是涉及 QML 引擎内
动画和对象生命周期管理的情况。

Influence:
1. 全面测试窗口动画,包括打开、关闭、最小化、最大化以及在不同窗口状态之
间转换。
2. 在高负载和压力条件下测试应用程序,以触发与对象创建和销毁相关的潜在竞
争条件或内存泄漏。
3. 监视应用程序日志,查找与 QML 组件创建或对象生命周期管理相关的任何警告
或错误。
4. 尝试重现动画中断时的极端情况。

Fixes: linuxdeepin/treeland#528
2025-08-28 13:51:53 +08:00
YaoBing Xiao 0072a5513a fix: occasional crash when closing x window
the crash originates from improper signal-slot disconnection and object
deletion order, leading to use-after-free scenarios in QObject desructor
chain, especially involving SurfaceWrapper.

Fixes: linuxdeepin/treeland#528

Log:
2025-08-28 13:13:33 +08:00
rewine e344a1e60f fix: resolve brief black screen during standby
1. Move D-Bus includes to fix potential header conflicts
2. Add new D-Bus signal handler for systemd-logind's PrepareForSleep
3. Implement onPrepareForSleep slot to manage rendering during hibernate
4. Improve session management with proper signal connections
5. Add logging for better debugging of power management events

The changes address the brief black screen issue that occurs during
system standby/hibernate transitions by properly managing the rendering
state through systemd-logind's PrepareForSleep signal. When entering
hibernate, we now explicitly disable rendering to prevent visual
artifacts, and re-enable it after waking up. The D-Bus signal handlers
have been reorganized for better maintainability and proper header
inclusion order.

fix: 解决待机时短暂黑屏问题

1. 移动 D-Bus 头文件包含位置以修复潜在的头文件冲突
2. 添加对 systemd-logind PrepareForSleep 信号的新 D-Bus 处理器
3. 实现 onPrepareForSleep 槽函数来管理休眠期间的渲染状态
4. 通过改进的信号连接提升会话管理功能
5. 添加日志记录以便更好地调试电源管理事件
2025-08-27 14:58:37 +08:00
rewine 342396e1d6 chore: remove dde portal screen cast configuration
1. Remove dde-portals.conf installation files and configuration
2. Delete portal directory CMake configuration
3. Remove reference to portal in main CMakeLists.txt
4. Configuration was made obsolete by implemented screen recording
functionality

chore: 删除 dde 门户录屏配置

1. 移除 dde-portals.conf 安装文件和配置
2. 删除 portal 目录的 CMake 配置
3. 从主 CMakeLists.txt 中移除 portal 引用
4. 录屏功能已实现,原有配置不再需要
2025-08-21 21:10:10 +08:00
rewine 7bfcba9efd fix: correct log category and add null check for surface activation
1. Change log category from treelandCore to treelandShell for
consistency
2. Add explicit null check for wrapper parameter
3. Add validation for shellSurface() before accessing it
4. Update log category in unmapped surface check

修复表面激活的日志分类并添加空值检查

1. 将日志分类从 treelandCore 改为保持一致性的 treelandShell
2. 为 wrapper 参数添加显式空值检查
3. 在访问 shellSurface() 前添加有效性验证
4. 更新未映射表面检查中的日志分类
2025-08-21 15:57:43 +08:00
rewine e14a6a4935 fix: resolve window resize crash during image capture
1. Add wlr_buffer.h header to access buffer locking functionality
2. Lock buffer during copy operation to prevent race conditions
3. Implement comprehensive validation of source and destination buffers
4. Add dynamic constraint updating when buffer size mismatches occur
5. Handle client buffer source explicitly for better compatibility
6. Add detailed logging for debugging copy operations

The changes fix a critical crash that occurred during window resizing by
ensuring proper buffer synchronization and validation. The fix includes
safety checks to validate buffer dimensions, pointer validity, and
proper constraint handling when sizes change. By locking buffers during
copy operations and properly handling client buffer sources, we prevent
race conditions that could lead to crashes during window resizing.

fix: 修复录窗口时resize崩溃

1. 添加 wlr_buffer.h 头文件以访问缓冲区锁定功能
2. 在复制操作期间锁定缓冲区以防止竞争条件
3. 实现对源缓冲区和目标缓冲区的全面验证
4. 在缓冲区大小不匹配时动态更新约束条件
5. 显式处理客户端缓冲区源以提高兼容性
6. 添加详细的日志记录用于调试复制操作
2025-08-21 11:49:25 +08:00
April & May 3aa68efc92 fix: fix wrong display render issue when switching VT too quickly
When cooperating with DDM, switching VT will not drop DRM FD. This makes
treeland still able to draw to the DRM after VT switch, which will cause
wrong display rendering when switching VT too quickly. This commit
cooperate new treeland-ddm-v1 protocol and expose interface to enable /
disable global rendering, which is used in DDM to control render before
/ after TTY switching, to solve the render issue.
2025-08-21 11:48:26 +08:00
April & May 547da09cbf Totally disable lockscreen animation when switching TTY to prevent stuck for switching too quickly
Treeland will failed to deactivate session when the animation is still
playing, and get the whole VT stuck. Disable all animation to prevent it
as mostly as possible.
2025-08-20 09:45:28 +08:00
April & May c2094e85d2 feat: Support TTY switching with DDM
1. Remove dependence of seatd-dde.service, use system provided seatd
service;
2. Add private wayland protocol treeland-private-protocol.xml for IPC
3. Acquire VT control immediately after first rendering complete;
4. Call DDM to switch VT when Ctrl+Alt+Fx is pressed, if available;
5. Expose wayland request for deactivate and re-activate session to DDM;
2025-08-20 09:45:28 +08:00
transifex-integration[bot] 511473c286
Updates for project TreeLand (#515)
* [skip CI] Translate lockscreen.en_US.ts in fi

77% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'fi'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate lockscreen.en_US.ts in fi

100% translated source file: 'lockscreen.en_US.ts'
on 'fi'.

* [skip CI] Translate wallpaper.en_US.ts in fi

66% of minimum 10% translated source file: 'wallpaper.en_US.ts'
on 'fi'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate wallpaper.en_US.ts in fi

100% translated source file: 'wallpaper.en_US.ts'
on 'fi'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
Co-authored-by: zccrs <zhangjide@deepin.org>
2025-08-19 16:18:46 +08:00
YaoBing Xiao b3e5f82d83 feat(waylib): add WBufferDumper utility for dumping buffer contents to image files
- WBufferDumper provides functionality to dump buffer data as images for debugging and analysis.
2025-08-19 15:03:34 +08:00
rewine cf91ae1312 refactor: use unified CI build preset with Werror
1. Replace manual CMake configuration with --preset ci in all ArchLinux
workflows
2. Add new CI build preset in CMakePresets.json with -Werror enabled
3. Remove redundant per-project CMake configuration steps
4. Simplify workflow steps by combining configure and build phases
5. Maintain compatibility with existing build requirements while
standardizing

The changes standardize build configuration across projects using a
centralized CMake preset. This ensures consistent build behavior while
maintaining the strict -Werror flag for CI builds. The update simplifies
workflow maintenance and improves build reliability by using CMake's
modern preset system.
2025-08-18 16:01:51 +08:00
rewine d1adcf4739 build: enable -Werror compiler flag
1. Added -Werror compiler flag to treat warnings as errors
2. This enforces stricter code quality standards
3. Helps catch potential issues early in development
4. Improves overall code reliability and maintainability

build: 启用 -Werror 编译器标志

1. 添加 -Werror 编译器标志将警告视为错误
2. 这执行了更严格的代码质量标准
3. 有助于在开发早期发现潜在问题
4. 提高整体代码的可靠性与可维护性
2025-08-15 10:14:06 +08:00
rewine 4cb9bd7c47
fix: prevent crash during preview item handling (#512)
1. Replace WWrapPointer with QPointer for SurfaceWrapper
2. Add shellSurface() check before accessing preview item properties
3. Fix race condition where SurfaceWrapper might be invalid

The changes prevent a crash that occurred when accessing a
SurfaceWrapper object after it had been invalidated. Using QPointer
with an explicit shellSurface() validity check ensures we don't access
dangling pointers, as the SurfaceWrapper::aboutToBeInvalidated signal
doesn't nullify WWrapPointer in time.

fix: 修复预览项处理时的崩溃问题

1. 将 SurfaceWrapper 的指针类型从 WWrapPointer 改为 QPointer
2. 在访问预览项属性前增加 shellSurface() 有效性检查
3. 解决 SurfaceWrapper 被标记为无效后仍被访问的竞态条件

这些修改解决了在 SurfaceWrapper 对象被销毁后仍然尝试访问其属性导致的崩溃
问题。使用 QPointer 并配合显式的 shellSurface() 有效性检查,可以确保不会
访问到悬空指针,因为 SurfaceWrapper::aboutToBeInvalidated 信号无法及时将
WWrapPointer 置空。
2025-08-14 16:37:04 +08:00
zccrs 10652f2741
fix: prevent cursor flicker during screen recording
1.  Remove `WBufferRenderer::resetTextureProvider` to avoid accidentally
cleaning the cached buffer in `WBufferRenderer` when switching from a
software cursor to a hardware cursor.
2.  The root cause was that switching from a software cursor
to a hardware cursor inadvertently cleared the cached buffer
in `WBufferRenderer`, causing the buffer referenced by
`BufferRendererProxy` to become null.
3.  The `resetTextureProvider` function was originally introduced in
the `WOutputLayer` implementation (https://github.com/vioken/waylib/
commit/ea814c44), and the buffer lock/unlock mechanism was introduced
in https://github.com/vioken/waylib/commit/35fdcb72. The lock/unlock
mechanism is a new design, so manually resetting the buffer is no longer
necessary.
4.  Update `WSGTextureProvider::setBuffer` to emit `textureChanged()`
signal when `buffer` is not null and the buffer object is not changed,
but maybe the buffer's content is changed.

Influence:
1.  Verify that the cursor no longer flickers during screen recording,
especially when switching between software and hardware cursors.
2.  Test screen sharing and ensure that the shared content is displayed
correctly without any visual artifacts.
3.  Check the buffer management to ensure that buffers are properly
locked and unlocked, and that no memory leaks occur.

fix: 修复录屏时光标闪烁问题

1.  移除 `WBufferRenderer::resetTextureProvider` 以避免在从软光标切换到
硬光标时意外清理 `WBufferRenderer` 中的缓存 buffer。
2.  根本原因是,从软光标切换到硬光标时,无意中清除了 `WBufferRenderer`
中的缓存 buffer,导致 `BufferRendererProxy` 引用的 buffer 变为 null。
3.  `resetTextureProvider` 函数最初是在 `WOutputLayer` 实现中引入的
(https://github.com/vioken/waylib/commit/ea814c44),buffer 锁/解锁机制是
在 https://github.com/vioken/waylib/commit/35fdcb72 中引入的。 锁/解锁机
制是一种新的设计,因此不再需要手动重置 buffer。
4.  更新 `WSGTextureProvider::setBuffer`,当 `buffer` 不为 null 且
buffer 对象没有更改时,发出 `textureChanged()` 信号,但 buffer 的内容可
能会更改。

Influence:
1.  验证在屏幕录制过程中,尤其是在软件和硬件光标之间切换时,光标不再
闪烁。
2.  测试屏幕共享,确保共享内容显示正确,没有任何视觉伪影。
3.  检查 buffer 管理,确保 buffer 被正确锁定和解锁,并且没有发生内存
泄漏。
2025-08-12 20:48:50 +08:00
rewine 672fdba375 docs: add comprehensive logging guidelines and update module logging
Add detailed logging guidelines for both treeland and waylib modules,
and update logging implementation across multiple files to follow the
new standards.

1. Create comprehensive logging documentation covering:
   - Category organization patterns for treeland and waylib
   - Log level usage guidelines
   - Best practices for message formatting and context
   - Implementation examples for both module types
   - Debugging tips and common mistakes to avoid

2. Update waylib modules with new logging categories:
   - wcursor.cpp: Add detailed cursor-related categories and update
logging statements
   - winputdevice.cpp: Add input device category and improve debug
messages
   - woutput.cpp: Add output-related categories and enhance buffer/
output logging
   - wseat.cpp: Replace old logging categories with new structured ones
   - wsocket.cpp: Add socket management category and improve connection
logging

3. Remove outdated logging categories:
   - Remove lcGeneral from wglobal.cpp
   - Remove obsolete qLcWlrCursor and related categories

4. Improve logging quality throughout:
   - Add contextual information to log messages
   - Use appropriate log levels for different message types
   - Add missing debug statements for important state changes
   - Fix incorrect
2025-08-11 18:21:02 +08:00
rewine af951c4194 feat: add centralized logging system and standardize log usage
1. Added new centralized logging system in common/treelandlogging.h
and .cpp
2. Replaced local logging categories with standardized ones across all
modules
3. Added comprehensive logging category definitions covering all system
components
4. Updated CMakeLists.txt to include new logging files
5. Modified multiple source files to use the standardized logging
categories

The changes provide a unified logging framework across the entire
codebase, enabling better log management and filtering. The centralized
system improves maintainability and ensures consistent log formatting
across different components.

feat: 添加集中化日志系统并规范日志使用

1. 在 common/treelandlogging.h 和 .cpp 中添加了新的集中化日志系统
2. 替换所有模块中的本地日志分类为标准化分类
3. 添加了涵盖所有系统组件的综合日志分类定义
4. 更新 CMakeLists.txt 以包含新的日志文件
5. 修改多个源文件以使用标准化日志分类

这些更改提供了统一的日志框架,改进了整个代码库的日志管理能力。集中化的系
统提高了可维护性,并确保不同组件之间日志格式的一致性。
2025-08-11 18:21:02 +08:00
YaoBing Xiao 501533e4c8 feat: ssd title bar displays the window title information
Fixes: linuxdeepin/treeland#501

Log:
2025-08-11 11:25:21 +08:00
YaoBing Xiao 7642cb91cf fix: maximize/restore icon in the SSD title bar displays incorrectly
updates the condition to use surface.shellSurface.isMaximized, ensuring the icon
accurately reflects the window's maximized state when using the shell surface.

Fixes: linuxdeepin/treeland#501

Log:
2025-08-11 11:25:21 +08:00
transifex-integration[bot] b48e9f3a7d [skip CI] Translate lockscreen.en_US.ts in es
90% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format
2025-08-08 10:19:35 +08:00
transifex-integration[bot] c48f8dcf6a [skip CI] Translate lockscreen.en_US.ts in es
90% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format
2025-08-08 10:19:35 +08:00
transifex-integration[bot] 3ac5fb78b4 [skip CI] Translate lockscreen.en_US.ts in es
90% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format
2025-08-08 10:19:35 +08:00
rewine 6c921b8ed4 fix: resolve multiple compiler warnings
1. Fix multiple compiler warning issues across various header files
2. Corrected template typedef naming in qobject.h for better clarity
3. Removed semicolons after QW_FUNC_MEMBER macros in several header
files
4. Added missing compiler warning disables for -Wreorder in
qtwaylandscanner.cpp
5. Fixed Q_DECLARE_FLAGS macro usage in surfacewrapper.h
6. Fixed W_DECLARE_PUBLIC macro usage in winputdevice.cpp

These changes eliminate compiler warnings during the build process while
maintaining full functionality and improving code consistency across
the codebase.

修复: 解决多个编译器警告

1. 修复多个头文件中的编译器警告问题
2. 在 qobject.h 中修正了模板类型定义名称以提高清晰度
3. 在多个头文件中移除了 QW_FUNC_MEMBER 宏后的分号
4. 在 qtwaylandscanner.cpp 中添加了缺失的 -Wreorder 警告禁用指令
5. 修正了 surfacewrapper.h 中的 Q_DECLARE_FLAGS 宏使用
6. 修正了 winputdevice.cpp 中的 W_DECLARE_PUBLIC 宏使用

这些修改在保持完整功能的同时消除了构建过程中的编译器警告
2025-08-08 10:03:45 +08:00
YaoBing Xiao a1895f9161 fix(waylib): prevent duplicate signal connections using Qt::UniqueConnection
- Initialize Content pointer to nullptr for safety.
- Use Qt::UniqueConnection when connecting BlitTextureProvider::textureChanged
to Content::update, both in Content and WRenderBufferBlitterPrivate, to avoid
multiple identical connections and ensure the slot is triggered only once per
signal emission.
2025-08-08 10:01:54 +08:00
YaoBing Xiao 7176521287 fix(waylib): prevent crash by safely managing textureChanged connection
- Add QMetaObject::Connection and QMutex members to WQuickTextureProxyPrivate
to track and protect the textureChanged signal connection.
- Disconnect previous textureChanged connections in initSourceItem to
avoid dangling or duplicate connections.
- Use a mutex to ensure thread-safety when establishing the textureChanged
connection in updatePaintNode.

This change helps prevent occasional crashes when moving the cursor by ensuring
signals are properly managed and connections are safely handled.

Fixes: #494

Log:
2025-08-08 10:01:54 +08:00
rewine d2df8a0a11 fix: use exec to replace process and avoid duplicate logs in treeland.sh
- Use exec to replace treeland.sh process with treeland, avoiding dual processes
- Include all user arguments in --try-exec test for environment consistency
- Disable systemd logs from treeland.sh to prevent duplicate journal entries
- Add English comments explaining the process replacement logic

This resolves the issue where treeland.sh and treeland would run as separate
processes, and eliminates duplicate log entries in journalctl.
2025-08-07 21:41:46 +08:00
YaoBing Xiao 26b0e3eebb fix(waylib): Occasional crash when moving the cursor
Use the q pointer as the context object host.
Use QPointer to prevent crash when WOutputCursor is
destroyed during signal handling.

Fixes: linuxdeepin/treeland#490

Log:
2025-08-07 19:10:41 +08:00
rewine 1e6625bd9b fix: improve type safety in render buffer node
1. Replace generic static_assert with Qt-specific type check
2. Use QtPrivate::HasQ_OBJECT_Macro to ensure proper QObject inheritance
3. Add explicit QObject include for better header dependency management
4. Maintain existing functionality while improving compile-time safety

The change replaces a generic type trait check with Qt's specific type
validation mechanism, ensuring that template parameters properly inherit
from QObject. This provides better error messages and stronger type
safety guarantees during compilation.

fix: 改进渲染缓冲节点的类型安全性

1. 用 Qt 特定的类型检查替换通用的 static_assert
2. 使用 QtPrivate::HasQ_OBJECT_Macro 确保正确的 QObject 继承关系
3. 添加显式的 QObject 包含头文件以改善头文件依赖管理
4. 在保持现有功能的同时提高编译时的安全性

该修改将通用类型特征检查替换为 Qt 的特定类型验证机制,确保模板参数正确地
继承自 QObject。这提供了更好的错误提示信息,并在编译时提供了更强的类型安
全保证。
2025-08-07 19:08:26 +08:00
rewine aa645014b8 chore: enable Qt logging context and adjust cursor shape manager version
1. Added QT_MESSAGELOGCONTEXT definition to enable detailed logging in
Qt applications
2. Downgraded cursor shape manager protocol version from 2 to 1
temporarily due to wlroots version constraints
3. The changes help with debugging while maintaining compatibility with
current wlroots version (pre-0.20)

chore: 启用 Qt 日志上下文并调整光标形状管理器版本

1. 添加 QT_MESSAGELOGCONTEXT 定义以启用 Qt 应用程序的详细日志记录功能
2. 由于 wlroots 版本限制(尚未升级到 0.20),临时将光标形状管理器协议版
本从 2 降级为 1
3. 这些更改有助于调试,同时保持与当前 wlroots 版本的兼容性
2025-08-07 19:08:26 +08:00
rewine 795309a4aa refactor: update cursor shape manager version to 2
Update the version number of the CURSOR_SHAPE_MANAGER_V1 protocol from
1 to 2 to reflect recent implementation changes and ensure protocol
version consistency across components.

refactor: 更新光标形状管理器版本至 2

将 CURSOR_SHAPE_MANAGER_V1 协议的版本号从 1 更新至 2,以反映最近的实现更
改,并确保组件间的协议版本一致性。
2025-08-07 19:08:26 +08:00
rewine bba9eca457 fix: remove unused setOutputProxy function
1. Remove setOutputProxy method from Helper class
2. Delete corresponding declaration in header file
3. The function was never implemented and not used anywhere in the
codebase
4. Cleaning up unused code improves code maintainability and reduces
technical debt

fix: 移除未使用的 setOutputProxy 函数

1. 从 Helper 类中移除 setOutputProxy 方法
2. 同时删除头文件中的相应声明
3. 该函数从未被实现且代码库中没有任何使用
4. 清理未使用的代码可提高代码可维护性并减少技术债务
2025-08-07 19:08:26 +08:00
rewine 3a013bcf5a fix: replace Q_EMIT and Q_SLOTS with signals/slots
Replace all instances of Q_EMIT with the modern signal
emission syntax
and replace Q_SLOTS with the modern slots syntax. Also add
[[maybe_unused]] attributes to parameters that are intentionally unused.

fix: 替换 Q_EMIT 和 Q_SLOTS 为 Qt5 风格的信号/槽

替换所有 Q_EMIT 为现代风格的信号发射语法,并将 Q_SLOTS 替换为现代风格的槽语法。
同时为故意未使用的参数添加 [[maybe_unused]] 属性。
2025-08-07 19:08:26 +08:00
rewine 4cb0da6d21 fix: resolve compilation warnings and improve code structure
1. Fix order of member variable initialization in qw_interface
constructor
2. Move add_compile_options after ASAN flags to ensure proper priority
3. Fix member variable order in TreelandConfig to match declaration
4. Add [[maybe_unused]] attribute to unused function parameters
5. Fix surface wrapper bitfield member ordering
6. Fix cursor image index comparison type mismatch
7. Fix various minor code style and structure issues

fix: 解决编译警告并改进代码结构

1. 修复 qw_interface 构造函数中成员变量的初始化顺序
2. 将 add_compile_options 移至 ASAN 标志之后以确保优先级
3. 修复 TreelandConfig 中成员变量顺序以匹配声明
4. 为未使用的函数参数添加 [[maybe_unused]] 属性
5. 修复 surface wrapper 位域成员顺序
6. 修复光标图像索引比较的类型不匹配问题
7. 解决其他次要的代码风格和结构问题
2025-08-07 19:08:26 +08:00
rewine 97c07bd06f chore(debian): update version to 0.6.2
log: 0.6.2
2025-08-04 18:19:28 +08:00
YaoBing Xiao 78ee985666 fix(waylib): the screen flickering issue during screencopy
Added resetGlState() call immediately after ending frame to ensure correct
OpenGL state before committing outputs in doRender(), improving GPU context
handling, prevent gles2-render exception in wlroots.

Fixes: linuxdeepin/treeland#488

Log:
2025-08-04 18:18:53 +08:00
rewine ce2c4057b4 fix: resolve library versioning and installation path issues
1. Add proper versioning to libtreeland and capture module with VERSION
and SOVERSION properties
2. Remove duplicate and unnecessary qml directory installation commands
that were causing conflicts
3. Add XCB dependency to libtreeland target_link_libraries for improved
X11 compatibility
4. Clean up commented-out installation code that was no longer needed

fix: 解决库版本和安装路径问题

1. 为 libtreeland 和 capture 模块添加正确的版本信息,使用 VERSION 和
SOVERSION 属性
2. 移除导致冲突的重复 qml 目录安装命令
3. 在 libtreeland 的 target_link_libraries 中添加 XCB 依赖以提升 X11 兼
容性
4. 清理不再需要的注释掉的安装代码
2025-08-04 17:41:01 +08:00
rewine e4ca014d0e chore(debian): update version to 0.6.1
log: 0.6.1
2025-08-01 13:58:04 +08:00
rewine 0ef3153e20 fix: improve D-Bus connection handling and QML hover visibility
1. Add proper boolean parameter passing in LockScreen component method
calls
2. Fix QML hover state reference to use correct item ID
3. Add error handling for D-Bus connection failure in Helper class
4. Improve logging for D-Bus connection issues

The changes address three different issues:
- LockScreen component methods now properly pass boolean parameters
- QML hover state visualization was incorrectly referencing the parent
container
- D-Bus connection failure handling was missing proper error reporting

fix: 改进 D-Bus 连接处理和 QML 悬停可见性

1. 在 LockScreen 组件方法调用中添加正确的布尔参数传递
2. 修复 QML 悬停状态引用以使用正确组件ID
3. 在 Helper 类中添加 D-Bus 连接失败的错误处理
4. 增强 D-Bus 连接问题的日志记录

这些修改解决了三个不同问题:
- LockScreen 组件方法现在能正确传递布尔参数
- QML 悬停状态显示错误引用了父容器的问题已修复
- D-Bus 连接失败处理缺少错误报告的问题得到解决
2025-08-01 13:32:16 +08:00
YaoBing Xiao f96555f5e3 feat: CLI option: switch from --disable-debug-view to --enable-debug-view
- Replace `disableDebugView` logic with `enableDebugView` for improved clarity.
- Avoid displaying debug view during Debug compilation

Log:
2025-08-01 13:06:55 +08:00
YaoBing Xiao b7b6708a4b fix(waylib): Specify required rendering flags in WSGRenderFootprintNode
The QRhi-based render() implementation in WSGRenderFootprintNode relies on explicit rendering
flags to ensure correct and efficient rendering behavior. This commit introduces an override
for the flags() method, returning a combination of QSGRenderNode::NoExternalRendering and
QSGRenderNode::BoundedRectRendering. These flags clarify the rendering node's capabilities
to the Qt scene graph, preventing potential rendering issues or crashes.
This change may address issues reported in https://github.com/linuxdeepin/treeland/issues/478.

Log:
2025-08-01 10:16:45 +08:00
rewine 7e13237fd7 chore(debian): update version to 0.6.0
Log: New version adapt to wlroots-0.19
2025-07-31 21:38:28 +08:00
rewine 5cee95f2aa fix: improve image capture error handling and code structure
1. Replace Q_ASSERT with proper error handling in image capture code
2. Add comprehensive validation checks for null pointers and invalid
states
3. Replace manual memory management with RAII-style helper classes
4. Move constraint building logic to dedicated helper struct
5. Add proper copyright headers to source files
6. Update CMakeLists.txt with consistent TODO markers
7. Implement WPixmanRegion class for automatic region management
8. Add detailed debug logging for capture operations

The changes enhance code reliability by properly handling error
conditions instead of relying on assertions, improve memory safety
through better resource management, and make the code more maintainable

with clearer structure and documentation.

fix: 改进图像捕获错误处理和代码结构

1. 在图像捕获代码中替换 Q_ASSERT 为适当的错误处理
2. 添加全面的空指针和无效状态验证检查
3. 使用 RAII 风格的辅助类替代手动内存管理
4. 将约束构建逻辑移至专用辅助结构体
5. 为源文件添加正确的版权标头
6. 在 CMakeLists.txt 中使用一致的 TODO 标记
7. 实现 WPixmanRegion
2025-07-31 20:37:24 +08:00
rewine a503276e46 feat: add foreign toplevel image capture support
1. Added support for Wayland foreign toplevel image capture protocol
2. Implemented capture source creation and handling in Helper class
3. Added new protocol files for ext-image-capture-source and ext-
foreign-toplevel-list
4. Created WExtImageCaptureSourceV1Impl for handling actual image
capture logic
5. Added findSurfaceByHandle method to support reverse lookup from
protocol handles
6. Implemented frame scheduling and buffer copying with format
constraints handling

feat: 添加外部顶层窗口图像捕获支持

1. 添加对 Wayland 外部顶层窗口图像捕获协议的支持
2. 在 Helper 类中实现捕获源创建和处理逻辑
3. 添加了 ext-image-capture-source 和 ext-foreign-toplevel-list 的新协议
文件
4. 创建 WExtImageCaptureSourceV1Impl 类来处理实际的图像捕获逻辑
5. 添加 findSurfaceByHandle 方法以支持从协议句柄进行反向查找
6. 实现帧调度和缓冲区复制,并处理格式约束条件
2025-07-31 20:37:24 +08:00
rewine 72f4ff54a6 feat: add image capture source support
1. Add new header files for ext_image_capture_source_v1
2. Implement QW_CLASS_OBJECT for ext_image_capture_source_v1 with
signals and methods
3. Add interface header for ext_image_capture_source_v1
4. Improve ext_image_copy_capture_frame_v1 with proper object model
and methods

feat: 添加图像捕获源支持

1. 为 ext_image_capture_source_v1 添加新头文件
2. 使用信号和方法实现 ext_image_capture_source_v1 的 QW_CLASS_OBJECT
3. 添加 ext_image_capture_source_v1 的接口头文件
4. 通过正确的对象模型和方法改进 ext_image_copy_capture_frame_v1
2025-07-31 20:37:24 +08:00
April & May c3501eac2b chore: Use parameter to control lockscreen animation instead of property
Use parameter to control lockscreen animation instead of QML property.
2025-07-31 19:29:34 +08:00
April & May 5f767e541f fix: Check virtual device for QInputEvent
Qt will create virtual device for QInputEvent when no physical device
available (e.g. switched to another VT), which will leads to a failed
assertion and make treeland crash. This commit applies a special guarded
getter for such case.
2025-07-31 19:29:34 +08:00
April & May efa48c3154 fix: Skip lockscreen animation when switching back from TTY
When switching back from TTY the Greeter will be re-created, and somehow
leads to an incorrect lockscreen animation on HiRes screen. This commit
adds skip function to lockscreen animation, and skips the animation when
the first time it adds to an output.
2025-07-31 19:29:34 +08:00
April & May cd0478c044 feat: Support TTY switching
Support TTY switching by calling wlr_session_change_vt(). Currently not
working with ddm because of the VT_BOUND mode.
2025-07-31 19:29:34 +08:00
April & May 5a8e15f1c7 feat: Add qwlroots interface for wl_session object
Add qwlroots interface for wl_session object, which can serve for VT
switching.
2025-07-31 19:29:34 +08:00
JiDe Zhang 60c30ec0db ci: Trigger waylib builds when qwlroots changes
This commit modifies the GitHub Actions workflows for waylib builds to
ensure they are triggered when qwlroots code changes occur, since waylib
depends on qwlroots.

Changes:
1. Added 'qwlroots/**' to the paths trigger for waylib-archlinux-build.yml
2. Added 'qwlroots/**' to the paths trigger for waylib-debian-build.yml
3. Updated README.md to document the CI workflow dependencies
4. Updated README.zh_CN.md to maintain consistency across all language versions

This ensures proper dependency management and prevents build failures
when qwlroots modifications affect waylib compilation.

ci: 当qwlroots代码修改时触发waylib构建

此提交修改了waylib构建的GitHub Actions工作流,确保在qwlroots
代码发生变化时触发waylib构建,因为waylib依赖于qwlroots。

变更内容:
1. 在waylib-archlinux-build.yml的路径触发器中添加'qwlroots/**'
2. 在waylib-debian-build.yml的路径触发器中添加'qwlroots/**'
3. 更新README.md文档记录CI工作流的依赖关系
4. 更新README.zh_CN.md保持所有语言版本文档的一致性

这确保了正确的依赖管理,防止qwlroots修改影响waylib编译时
出现构建失败的情况。
2025-07-30 17:57:57 +08:00
rewine b68ea9f76e fix: remove unused quit full button and add helper activation
1. Remove the unused "quitFullBtn" Loader component that was not visible
2. Add Helper.activateSurface call before maximizing window
3. This ensures proper window activation before state change

fix: 删除未使用的退出全屏按钮并添加窗口激活

1. 移除了未使用的 "quitFullBtn" Loader 组件
2. 在窗口最大化前添加了 Helper.activateSurface 调用
3. 这确保了在状态改变前正确激活窗口
2025-07-30 17:57:37 +08:00
rewine 6c1aab65be fix: prevent title bar and window buttons from stealing focus
1. Added Qt.NoFocus policy to title bar component to prevent keyboard
focus
2. Added focusPolicy to all window control buttons (minimize, close,
maximize)
3. Ensures focus remains with active window content during window
operations
4. Improves accessibility and prevents focus-related UI glitches

fix: 防止标题栏和窗口按钮获取焦点

1. 为标题栏组件添加 Qt.NoFocus 策略以阻止键盘焦点
2. 为所有窗口控制按钮(最小化、关闭、最大化)添加 focusPolicy
3. 确保窗口操作期间焦点保留在活动窗口内容上
4. 提升可访问性并防止焦点相关的界面故障
2025-07-30 16:45:53 +08:00
YaoBing Xiao 837d349e96 feat: add wl_drm support
Add wl_drm protocol
2025-07-30 15:32:25 +08:00
immortalrover a6134c2e40 feat: create ext-data-control manager
support ext-data-control-v1 protocol
2025-07-29 20:33:01 +08:00
zccrs 26b95540cd
fix: Handle VT switching keys (#469)
* fix: Handle VT switching keys

This commit addresses an issue where the XF86Switch_VT_1 to
XF86Switch_VT_12 keys were not properly handled by Qt. Qt does not
directly support these keys. The fix involves converting these keys to
Ctrl+Alt+F1 through Ctrl+Alt+F12 when the Ctrl and Alt modifiers are
already pressed. This enables users to switch virtual terminals within
the Wayland environment using these key combinations, matching the
expected behavior on traditional Linux systems. This conversion only
happens when Ctrl+Alt are already pressed, preventing accidental mapping
of other keys.

fix: 处理 VT 切换键

此提交解决了一个 Qt 无法正确处理 XF86Switch_VT_1 到 XF86Switch_VT_12
键的问题。Qt 不直接支持这些键。此修复包括将这些键转换为 Ctrl+Alt+F1
到 Ctrl+Alt+F12(如果 Ctrl 和 Alt 修改键已被按下)。这使得用户能够在
Wayland 环境中使用这些组合键切换虚拟终端,从而匹配传统 Linux 系统上的预
期行为。此转换仅在 Ctrl+Alt 已被按下时发生,防止意外映射其他键。
2025-07-25 11:00:58 +08:00
rewine 7039d9ede6 feat: add Nix flake support for project configuration
1. Introduce `default.nix` at the root to define Nix packages and
dependencies
2. Migrate CMakeLists.txt to use `option()` and `add_feature_info()` for
better feature management
3. Update `flake.nix` to import and organize Nix modules and packages
4. Modify `nix/default.nix` to use `nix-filter.lib` and add new
dependencies like `qwlroots` and `waylib`
5. Update `waylib/flake.nix` and `waylib/nix/default.nix` to improve
test support and source filtering

feat: 添加 Nix flake 支持以优化项目配置

1. 在项目根目录引入 `default.nix` 来定义 Nix 包及其依赖
2. 将 CMakeLists.txt 中的配置改为使用 `option()` 和 `add_feature_info()`
以更好地管理功能选项
3. 更新 `flake.nix` 以导入并组织 Nix 模块和包
4. 修改 `nix/default.nix` 使用 `nix-filter.lib` 并添加 `qwlroots` 和
`waylib` 等包
2025-07-24 20:07:56 +08:00
rewine 531c316379 fix: prevent workspace moveSurfaceTo crash on null wrapper
1. Add null check for wrapper in WindowSelectionGrid.qml before calling
moveSurfaceTo
2. Add conditional checks in WorkspaceSelectionList.qml to verify both
wrapper and model exist before workspace move
3. Use optional chaining operator (dragManager.item?.wrapper) for safer
null handling
4. Prevent potential crashes when moving surfaces between workspaces
during drag operations

fix: 防止工作区 moveSurfaceTo 在空包装器时崩溃

1. 在 WindowSelectionGrid.qml 中调用 moveSurfaceTo 前添加对 wrapper 的空
值检查
2. 在 WorkspaceSelectionList.qml 中添加条件检查以验证包装器和模型存在后
再进行工作区移动
3. 使用可选链操作符 (dragManager.item?.wrapper) 以更安全地处理空值
4. 防止在拖放操作期间跨工作区移动时出现潜在崩溃
2025-07-24 15:02:29 +08:00
rewine 41aac0ddea fix: remove redundant submodule options and configs
1. Remove duplicate CMake option for WITH_SUBMODULE_WAYLIB that was both
defined and set to ON
2. Eliminate redundant build presets (submodule & submodule-with-clang)
that only differed by compiler settings
3. Simplify CMakePresets.json by keeping only essential configurations
4. Maintain single source of truth for binary directory configuration

fix: 删除冗余的子模块选项和配置

1. 移除重复定义的 WITH_SUBMODULE_WAYLIB 选项,该选项已被设置为 ON
2. 删除冗余的构建预设(submodule 和 submodule-with-clang),这些配置仅编
译器设置不同
3. 简化 CMakePresets.json 文件,保留必要配置
4. 维护单一可信的二进制目录配置来源
2025-07-24 14:46:01 +08:00
rewine 826fe21051 chore: update nix dependencies and clean up configurations
1. Remove redundant seatd service configuration in flake.nix that was
previously used for testing
2. Clean up development shell packages by removing unnecessary Wayland-
related dependencies
3. Update wlroots dependency to wlroots_0_19 in both flake.nix and
default.nix
4. Update project version from 0.2.2 to 0.5-unstable to reflect recent
development progress
5. Add depsBuildBuild input for pkg-config to ensure proper build
environment setup
6. Remove outdated wlroots reference from nativeBuildInputs

chore: 更新 nix 依赖并清理配置

1. 移除 flake.nix 中冗余的 seatd 服务配置(之前用于测试)
2. 清理开发环境中的 shell 包,移除不必要的 Wayland 相关依赖
3. 在 flake.nix 和 default.nix 中将 wlroots 依赖更新为 wlroots_0_19
4. 将项目版本从 0.2.2 更新为 0.5-unstable 以反映最新开发进展
5. 添加 pkg-config 的 depsBuildBuild 输入以确保正确的构建环境
2025-07-23 17:09:40 +08:00
renovate[bot] ffa43d0167 chore(deps): update actions/checkout action to v4 2025-07-23 15:36:31 +08:00
renovate[bot] c4aba6382e chore(deps): update fsfe/reuse-action action to v5 2025-07-23 15:35:30 +08:00
transifex-integration[bot] e321eed150 [skip CI] Translate lockscreen.en_US.ts in uk
100% translated source file: 'lockscreen.en_US.ts'
on 'uk'.
2025-07-23 15:34:37 +08:00
transifex-integration[bot] 9adc345b56 [skip CI] Translate multitaskview.en_US.ts in fr
100% translated source file: 'multitaskview.en_US.ts'
on 'fr'.
2025-07-23 15:34:37 +08:00
transifex-integration[bot] e71660c914 [skip CI] Translate lockscreen.en_US.ts in pl
100% translated source file: 'lockscreen.en_US.ts'
on 'pl'.
2025-07-23 15:34:37 +08:00
transifex-integration[bot] 3a471672c6 [skip CI] Translate wallpaper.en_US.ts in pl
100% translated source file: 'wallpaper.en_US.ts'
on 'pl'.
2025-07-23 15:34:37 +08:00
transifex-integration[bot] 7d4aec0795 [skip CI] Translate multitaskview.en_US.ts in pl
100% translated source file: 'multitaskview.en_US.ts'
on 'pl'.
2025-07-23 15:34:37 +08:00
transifex-integration[bot] 3c6c4c01e9 [skip CI] Translate treeland.en_US.ts in pl
100% translated source file: 'treeland.en_US.ts'
on 'pl'.
2025-07-23 15:34:37 +08:00
April & May 6a7b46ad64 fix: Scaling animation not shown while return from shutdown page
Signed-off-by: April & May <apr3vau@outlook.com>
2025-07-23 15:28:21 +08:00
JiDe Zhang 54e8ed840b chore: Force Ninja build during deb packaging
This commit enforces the use of Ninja as the build system during the
debian package creation process for treeland, qwlroots, and waylib.
This change was made to significantly improve build times, as Ninja
generally offers faster and more efficient builds compared to the
default make system. The changes involve adding `ninja-build` as a
build dependency in the `debian/control` files and adding `-GNinja` to
the `dh_auto_configure` commands in the `debian/rules` files for all
three packages. This ensures that CMake uses Ninja to generate the build
files.

chore: 在 deb 打包过程中强制使用 Ninja 构建

此提交强制在 treeland、qwlroots 和 waylib 的 debian 包创建过程中使用
Ninja 作为构建系统。 此更改旨在显着缩短构建时间,因为与默认的 make 系统
相比,Ninja 通常提供更快、更高效的构建。 更改包括在 `debian/control` 文
件中添加 `ninja-build` 作为构建依赖项,并在所有三个包的 `debian/rules`
文件中的 `dh_auto_configure` 命令中添加 `-GNinja`。 这确保 CMake 使用
Ninja 来生成构建文件。
2025-07-23 15:27:52 +08:00
JiDe Zhang 7c74bf1e17 fix: add timeout to protocol tests
This commit adds a timeout of 3 seconds to several protocol unit tests
in their respective CMakeLists.txt files. These tests were observed
to block indefinitely in certain build environments, specifically
when building deb packages. Adding a timeout ensures that these tests
will not hang the build process, improving overall build reliability
and preventing potential deadlocks. The timeout value of 3 seconds
was chosen to allow sufficient time for the tests to complete under
normal conditions while still providing a reasonable safeguard against
indefinite blocking.

fix: 为协议测试添加超时

此提交在其各自的 CMakeLists.txt 文件中为多个协议单元测试添加了 3 秒的超
时。据观察,这些测试在某些构建环境中(尤其是在构建 deb 软件包时)会无限
期地阻塞。添加超时可确保这些测试不会使构建过程挂起,从而提高整体构建可靠
性并防止潜在的死锁。选择 3 秒的超时值是为了在正常情况下为测试完成留出足
够的时间,同时仍提供合理的保护以防止无限期阻塞。
2025-07-23 15:27:52 +08:00
JiDe Zhang 2427b2025a feat: Upload build artifacts as zip archives
The ArchLinux build workflows for qwlroots, treeland and waylib now
create a zip archive of the installed files in a staging directory
and upload it as an artifact. This allows for easy inspection of the
built files and verification of the build process's correctness. The
zip includes a `PACKAGE_INFO.txt` containing package metadata, build
configuration details, and a list of installed files. Pacman is used to
install the zip tool if it isn't already available.

feat: 上传构建产物为 zip 压缩包

qwlroots、treeland 和 waylib 的 ArchLinux 构建工作流程现在会在暂存目录中
创建已安装文件的 zip 压缩包,并将其作为工件上传。这样可以方便地检查构建
的文件并验证构建过程的正确性。该 zip 包含一个 `PACKAGE_INFO.txt`,其中包
含包元数据、构建配置详细信息和已安装文件列表。 如果 zip 工具尚不可用,则
使用 Pacman 安装它。
2025-07-23 15:27:52 +08:00
JiDe Zhang 644b7315d3 chore: fix CI and enable independent builds
1.  Fixes and updates CI configurations for treeland.
2.  Merges `reuse` files for comprehensive license information.
3.  Updates dependencies in `debian/control` to align with the combined
codebase.
4.  Introduces separate build workflows for `waylib` and `qwlroots` to
ensure they can be built independently.
5.  This ensures modularity and prevents accidental breakages during
future development, maintaining the option to separate these components
again.

chore: 修复 CI 并启用独立构建

1. 修复并更新了 treeland 的 CI 配置。
2. 合并 `reuse` 文件以提供全面的许可证信息。
3. 更新了 `debian/control` 中的依赖项,以与合并的代码库保持一致。
4. 引入了 `waylib` 和 `qwlroots` 的独立构建工作流程,以确保它们可以独立
构建。
5. 确保模块化,防止未来开发过程中意外损坏,保持再次分离这些组件的选项。
2025-07-23 15:27:52 +08:00
JiDe Zhang 2a0093ad46 refactor: merge qwlroots and waylib source code into treeland
Removed qwlroots and waylib from git submodules, and merged their
source code directly into the treeland repository. This change
reduces development overhead during the rapid iteration phase of
treeland, as frequent coordinated changes are required across
treeland, qwlroots, and waylib. By merging them now, we simplify
development and maintenance. In the future, when the project
stabilizes, we may consider splitting them back into independent
repositories.

To prepare for this possible future split, the original directory
structures and all files from qwlroots and waylib are preserved and
placed under separate subdirectories in treeland.

Original project commits at the time of merge:
- qwlroots: https://github.com/vioken/qwlroots(00b09f9047ac0eaf26757e8af3d31f35d22bbce3)
- waylib: https://github.com/vioken/waylib(9564027cc6c89dc5262c03d183f743b71a0e621e)

重构:将 qwlroots 和 waylib 项目代码合并到 treeland

将 qwlroots 和 waylib 从 git 子模块中移除,直接把它们的代码合并
到 treeland 项目中。这样做是为了在 treeland 快速迭代期间减少开发
成本,因为经常需要同时修改 treeland、waylib 和 qwlroots,合并后
开发会更方便,待项目稳定后再考虑重新拆分为独立项目。

为方便将来拆分,保留了原项目的目录结构和全部文件,并使用独立子
目录维护代码。

合并时原项目的提交信息如下:
- qwlroots: https://github.com/vioken/qwlroots(00b09f9047ac0eaf26757e8af3d31f35d22bbce3)
- waylib: https://github.com/vioken/waylib(9564027cc6c89dc5262c03d183f743b71a0e621e)
2025-07-23 15:27:52 +08:00
JiDe Zhang aee46508f7 chore: Use treeland-specific seatd service
This commit modifies the treeland systemd service file to use the
`seatd-dde.service` instead of the generic `seatd.service`. This change
is necessary because treeland now utilizes a dedicated seatd instance,
`seatd-dde`, specifically configured for its requirements.  By switching
to the dedicated service, treeland avoids potential conflicts or
misconfigurations that could arise from sharing a common seatd instance
with other applications or services.

chore: 使用 treeland 专用的 seatd 服务

此提交修改了 treeland systemd 服务文件,以使用 `seatd-dde.service` 而不
是通用的 `seatd.service`。 这一更改是必要的,因为 treeland 现在使用专门
为其需求配置的专用 seatd 实例 `seatd-dde`。 通过切换到专用服务,treeland
可以避免因与其他应用程序或服务共享通用 seatd 实例而可能引起的潜在冲突或
错误配置。
2025-07-21 10:58:17 +08:00
rewine ede2f8230d feat: implement ext-foreign-toplevel-list
Log: need https://github.com/vioken/waylib/pull/640
2025-07-16 10:04:01 +08:00
renovate[bot] df2a7442b2 chore(deps): lock file maintenance 2025-07-15 13:52:09 +08:00
transifex-integration[bot] 2f48f6d110 [skip CI] Translate lockscreen.en_US.ts in es
81% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format
2025-07-15 13:50:00 +08:00
renovate[bot] 1cf99b5540 chore(deps): update waylib digest to 9564027 2025-07-15 13:47:10 +08:00
transifex-integration[bot] 9d4c3cb5cd
i18n: Updates for project TreeLand (#440)
* [skip CI] Translate lockscreen.en_US.ts in pl

27% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'pl'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in pt_BR

100% translated source file: 'treeland.en_US.ts'
on 'pt_BR'.

---------

Log:
2025-07-10 19:30:10 +08:00
JiDe Zhang 1713074802 chore: remove polkit rules for login1
The polkit rules for `org.freedesktop.login1.manage` are no longer
required because the DDE user no longer logs in via the `login1`
interface. This change removes the `misc/polkit-1` directory,
the `debian/treeland.install` reference to polkit rules, and the
corresponding `CMakeLists.txt` entry. This simplifies the codebase and
removes unnecessary configuration files.

chore: 移除 login1 的 polkit 规则

由于 DDE 用户不再通过 `login1` 接口登录,因此不再需要
`org.freedesktop.login1.manage` 的 polkit 规则。此更改移除了 `misc/
polkit-1` 目录、`debian/treeland.install` 中对 polkit 规则的引用以及相应
的 `CMakeLists.txt` 条目。这简化了代码库并删除了不必要的配置文件。
2025-07-09 14:58:24 +08:00
YaoBing Xiao 34c158934e feat: add support for alpha modifier protocol
It allows clients to explicitly communicate their use of
alpha transparency.

Log: add support for alpha modifier protocol
2025-07-02 14:23:43 +08:00
Zhang Dingyuan 6afd8348fa fix: cannot export dbus services
I can't explain this phenomenon. As long as the DLog registration
function is before QApplication, it is impossible to obtain all the
contents registered by dbus.

DTK Team reported that other projects encountered the same problem and
suspected that it was a Qt problem.

Log:
2025-07-02 13:55:32 +08:00
rewine 77d2cd1936 Revert "fix: should not maximize when client set maxsize"
This reverts commit 0d21c93100. which
broken maximize of firefox
2025-07-01 17:39:12 +08:00
transifex-integration[bot] dd7148ee5d
Updates for project TreeLand (#431)
* [skip CI] Translate treeland.en_US.ts in fi

100% translated source file: 'treeland.en_US.ts'
on 'fi'.

* [skip CI] Translate wallpaper.en_US.ts in fr

100% translated source file: 'wallpaper.en_US.ts'
on 'fr'.

* [skip CI] Translate treeland.en_US.ts in fr

100% translated source file: 'treeland.en_US.ts'
on 'fr'.

* [skip CI] Translate lockscreen.en_US.ts in fr

100% translated source file: 'lockscreen.en_US.ts'
on 'fr'.

* [skip CI] Translate multitaskview.en_US.ts in fi

100% translated source file: 'multitaskview.en_US.ts'
on 'fi'.

* [skip CI] Translate lockscreen.en_US.ts in pt_BR

100% translated source file: 'lockscreen.en_US.ts'
on 'pt_BR'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-07-01 13:17:25 +08:00
Zhang Dingyuan da8cf4ad11 fix: Treeland does not exit when logging out of session
only treeland-session-shutdown.service can be clean TREELAND_RUN_MODE.

treeland-session-shutdown.service need TREELAND_RUN_MODE env, but
environment unset before treeland service stop.

Log:
2025-07-01 13:07:37 +08:00
Zhang Dingyuan b9d8d7a756 fix: cannot use treeland user session mode
LightDM will not store the desktop file name used for startup in DESKTOP_SESSION,
so we need a wrapper to provide new environment for treeland user mode.

Log:
2025-07-01 11:14:48 +08:00
rewine 327ab03444 fix: add [[maybe_unused]] attribute to unused parameters
1. Added [[maybe_unused]] attribute to multiple function parameters
across various modules
2. This resolves compiler warnings about unused variables in Wayland
interface implementations
3. The changes affect DDE shell interfaces, foreign toplevel handling,
personalization manager, output management, and other components
4. Modern C++ compilers can now properly ignore these parameters without
generating unnecessary warnings

fix: 为未使用的参数添加 [[maybe_unused]] 属性

1. 在多个模块的函数参数中添加了 [[maybe_unused]] 属性
2. 这解决了Wayland接口实现中关于未使用变量的编译器警告问题
3. 修改涉及DDE shell接口、外部顶层窗口处理、个性化管理器、输出管理以及其
他组件
4. 现代C++编译器现在可以正确忽略这些参数,而不会生成不必要的警告
2025-06-30 13:42:23 +08:00
rewine fb35b0c890 chore: improvement fixes the translation configuration
This improvement fixes the translation configuration to automatically support multiple languages instead of being limited to Chinese and English only.

Created `cmake/TranslationUtils.cmake` file with two main functions:

- `setup_translations(TARGET_NAME TRANSLATION_PREFIX)`: For plugin and example translation configuration
- `setup_main_translations(TARGET_NAME)`: For main program translation configuration

Uses `file(GLOB ...)` command to automatically discover all available translation files, supporting languages including:

- Afrikaans (af)
- Amharic (am_ET)
- Arabic (ar)
- Asturian (ast)
- Azerbaijani (az)
- Bulgarian (bg)
- Bengali (bn)
- Tibetan (bo)
- Bakhtiari (bqi)
- Breton (br)
- Catalan (ca)
- Kurdish (ckb)
- Czech (cs)
- Danish (da)
- German (de)
- Greek (el)
- English (en_US)
- Spanish (es)
- Persian (fa)
- Finnish (fi)
- French (fr)
- Galician (gl_ES)
- Hebrew (he)
- Hindi (hi_IN)
- Croatian (hr)
- Hungarian (hu)
- Indonesian (id)
- Italian (it)
- Japanese (ja)
- Georgian (ka)
- Kabyle (kab)
- Khmer (km_KH)
- Korean (ko)
- Kurdish (ku)
- Lithuanian (lt)
- Malay (ms)
- Norwegian (nb)
- Nepali (ne)
- Dutch (nl)
- Polish (pl)
- Portuguese (pt)
- Brazilian Portuguese (pt_BR)
- Romanian (ro)
- Russian (ru)
- Sinhala (si)
- Slovak (sk)
- Slovenian (sl)
- Albanian (sq)
- Serbian (sr)
- Swedish (sv)
- Tamil (ta)
- Telugu (te)
- Thai (th)
- Turkish (tr)
- Tamazight (tzm)
- Uyghur (ug)
- Ukrainian (uk)
- Vietnamese (vi)
- Simplified Chinese (zh_CN)
- Traditional Chinese (zh_HK, zh_TW)

- `src/CMakeLists.txt`: Main program translation configuration
- `src/plugins/lockscreen/CMakeLists.txt`: Lock screen plugin translation configuration
- `src/plugins/multitaskview/CMakeLists.txt`: Multitask view plugin translation configuration
- `examples/test_set_treeland_wallpaper/CMakeLists.txt`: Wallpaper setting example translation configuration
- `cmake/TranslationUtils.cmake`: New translation utilities file
2025-06-30 13:40:51 +08:00
rewine 71aa66bff3 feat: add popup surface container for handling popup windows
1. Added ninja build tool to nativeBuildInputs in nix/default.nix to
support faster builds
2. Added popupsurfacecontainer files to CMakeLists.txt for proper
compilation
3. Created new PopupSurfaceContainer class to handle popup surfaces with
mouse event detection
4. Modified WindowMenu.qml to set modal property ensuring proper popup
behavior
5. Updated ShellHandler to use PopupSurfaceContainer instead of generic
SurfaceContainer

The changes implement a specialized container for handling
popup surfaces with proper event handling and closure logic. The
PopupSurfaceContainer class provides specific functionality for managing
popup windows, including detecting mouse press events outside popup
areas and closing popups accordingly. This improves the user experience
by ensuring popups are properly dismissed when users interact outside
their boundaries.
2025-06-26 17:55:08 +08:00
transifex-integration[bot] 267bb639ad
Updates for project TreeLand (#427)
* [skip CI] Translate treeland.en_US.ts in af

10% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'af'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in th

20% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'th'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in te

20% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'te'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ku

20% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ku'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in nb

10% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'nb'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in uk [Manual Sync]

100% translated source file: 'treeland.en_US.ts'
on 'uk'.

* [skip CI] Translate wallpaper.en_US.ts in uk [Manual Sync]

66% of minimum 1% translated source file: 'wallpaper.en_US.ts'
on 'uk'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in uk [Manual Sync]

100% translated source file: 'multitaskview.en_US.ts'
on 'uk'.

* [skip CI] Translate multitaskview.en_US.ts in ja

100% translated source file: 'multitaskview.en_US.ts'
on 'ja'.

* [skip CI] Translate treeland.en_US.ts in ja

100% translated source file: 'treeland.en_US.ts'
on 'ja'.

* [skip CI] Translate wallpaper.en_US.ts in ja

100% translated source file: 'wallpaper.en_US.ts'
on 'ja'.

* [skip CI] Translate lockscreen.en_US.ts in ja

100% translated source file: 'lockscreen.en_US.ts'
on 'ja'.

* [skip CI] Translate multitaskview.en_US.ts in ca

100% translated source file: 'multitaskview.en_US.ts'
on 'ca'.

* [skip CI] Translate wallpaper.en_US.ts in ca

100% translated source file: 'wallpaper.en_US.ts'
on 'ca'.

* [skip CI] Translate wallpaper.en_US.ts in uk

100% translated source file: 'wallpaper.en_US.ts'
on 'uk'.

* [skip CI] Translate lockscreen.en_US.ts in uk

59% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'uk'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate wallpaper.en_US.ts in pt_BR

100% translated source file: 'wallpaper.en_US.ts'
on 'pt_BR'.

* [skip CI] Translate wallpaper.en_US.ts in es

100% translated source file: 'wallpaper.en_US.ts'
on 'es'.

* [skip CI] Translate treeland.en_US.ts in es

100% translated source file: 'treeland.en_US.ts'
on 'es'.

* [skip CI] Translate multitaskview.en_US.ts in es

100% translated source file: 'multitaskview.en_US.ts'
on 'es'.

* [skip CI] Translate lockscreen.en_US.ts in pt_BR

95% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'pt_BR'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ca

100% translated source file: 'treeland.en_US.ts'
on 'ca'.

* [skip CI] Translate multitaskview.en_US.ts in pt_BR

100% translated source file: 'multitaskview.en_US.ts'
on 'pt_BR'.

* [skip CI] Translate lockscreen.en_US.ts in ca

100% translated source file: 'lockscreen.en_US.ts'
on 'ca'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-06-26 16:32:01 +08:00
transifex-integration[bot] ad74f7ad57
[skip CI] Updates for project TreeLand (#425)
* [skip CI] Translate treeland.en_US.ts in ja

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ja'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ko

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ko'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in cs

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'cs'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in it

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'it'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in sr

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'sr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in hu

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'hu'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in zh_TW

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'zh_TW'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ro

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ro'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in fi

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'fi'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate wallpaper.en_US.ts in zh_CN

83% of minimum 10% translated source file: 'wallpaper.en_US.ts'
on 'zh_CN'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ms

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ms'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in uk

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'uk'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in sv

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'sv'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in ar

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'ar'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in fr

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'fr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in es

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in he

60% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'he'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in hi_IN

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'hi_IN'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in pl

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'pl'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in az

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'az'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in ka

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'ka'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in gl_ES

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'gl_ES'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in am_ET

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'am_ET'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in bg

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'bg'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in zh_CN

100% translated source file: 'multitaskview.en_US.ts'
on 'zh_CN'.

* [skip CI] Translate multitaskview.en_US.ts in ms

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'ms'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in bg

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'bg'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ta

40% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ta'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in de

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'de'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in zh_HK

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'zh_HK'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in am_ET

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'am_ET'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ne

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ne'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in cs

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'cs'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in si

10% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'si'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in sk

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'sk'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in km_KH

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'km_KH'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in sq

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'sq'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ru

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ru'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in fi

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'fi'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in tr

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'tr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in lt

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'lt'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in id

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'id'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in de

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'de'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate lockscreen.en_US.ts in zh_CN

27% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'zh_CN'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in tzm

30% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'tzm'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in el

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'el'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ka

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ka'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in nl

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'nl'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in zh_TW

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'zh_TW'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in ast

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'ast'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in br

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'br'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in el

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'el'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ca

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ca'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in sq

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'sq'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in hi_IN

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'hi_IN'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in kab

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'kab'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in bo

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'bo'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in sl

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'sl'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in pt_BR

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'pt_BR'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in it

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'it'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in bqi

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'bqi'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in ro

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'ro'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in zh_HK

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'zh_HK'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in hr

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'hr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in uk

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'uk'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in sk

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'sk'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in fa

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'fa'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in vi

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'vi'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in da

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'da'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in id

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'id'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in ja

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'ja'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in ca

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'ca'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in zh_CN

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'zh_CN'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in gl_ES

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'gl_ES'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in ug

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'ug'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in sl

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'sl'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in bo

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'bo'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in sr

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'sr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in hr

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'hr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ar

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ar'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in da

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'da'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in bqi

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'bqi'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in fr

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'fr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in pt

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'pt'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in pt

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'pt'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in hu

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'hu'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in pl

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'pl'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in az

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'az'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ast

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ast'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ckb

20% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ckb'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in tr

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'tr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in bn

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'bn'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in nl

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'nl'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in ug

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'ug'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in pt_BR

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'pt_BR'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in ru

50% of minimum 10% translated source file: 'multitaskview.en_US.ts'
on 'ru'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in es

80% of minimum 10% translated source file: 'treeland.en_US.ts'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate treeland.en_US.ts in zh_CN

100% translated source file: 'treeland.en_US.ts'
on 'zh_CN'.

* [skip CI] Translate multitaskview.en_US.ts in zh_HK

100% translated source file: 'multitaskview.en_US.ts'
on 'zh_HK'.

* [skip CI] Translate treeland.en_US.ts in zh_TW

100% translated source file: 'treeland.en_US.ts'
on 'zh_TW'.

* [skip CI] Translate lockscreen.en_US.ts in zh_TW

27% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'zh_TW'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate multitaskview.en_US.ts in zh_TW

100% translated source file: 'multitaskview.en_US.ts'
on 'zh_TW'.

* [skip CI] Translate treeland.en_US.ts in zh_HK

100% translated source file: 'treeland.en_US.ts'
on 'zh_HK'.

* [skip CI] Translate lockscreen.en_US.ts in zh_HK

27% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'zh_HK'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate wallpaper.en_US.ts in zh_CN

100% translated source file: 'wallpaper.en_US.ts'
on 'zh_CN'.

* [skip CI] Translate lockscreen.en_US.ts in zh_TW

63% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'zh_TW'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate lockscreen.en_US.ts in zh_HK

63% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'zh_HK'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* [skip CI] Translate lockscreen.en_US.ts in zh_CN

63% of minimum 10% translated source file: 'lockscreen.en_US.ts'
on 'zh_CN'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
Co-authored-by: rewine <luhongxu@deepin.org>
2025-06-24 15:12:46 +08:00
rewine 1570936d55 chore: configure translation files and update Chinese translations
1. Add .tx/config file to set up Transifex translation management with
multiple resource configurations for different components
2. Update Simplified Chinese translations in wallpaper plugin by
removing 'type="unfinished"' from several entries
3. Update Simplified Chinese translations in lockscreen plugin by
removing 'type="unfinished"' from multiple translation tags

These changes improve translation management workflow through proper
Transifex configuration and ensure the Chinese translations are marked
as completed rather than unfinished.

chore: 配置翻译文件并更新中文翻译

1. 添加 .tx/config 文件,配置多个组件的 Transifex 翻译资源管理
2. 在壁纸插件中更新简体中文翻译,移除多个条目中的 'type="unfinished"'
3. 在锁屏插件中更新简体中文翻译,移除多个标签中的 'type="unfinished"'

这些更改通过正确的 Transifex 配置改进了翻译管理工作流程,并确保中文翻译
标记为已完成状态而非未完成状态。
2025-06-24 14:43:20 +08:00
rewine 7a12c9ad62 chore: configure transifex translation files
1. Create configuration for Transifex localization workflow
2. Add four translation file filters for different modules:
   - Main treeland translations
   - Lockscreen plugin translations
   - Multitaskview plugin translations
   - Wallpaper example translations
3. Set up QT file format with proper source and target paths
4. Configure PR branch naming pattern for automated updates

chore: 配置 Transifex 翻译文件

1. 创建 Transifex 本地化工作流配置
2. 添加四个翻译文件过滤器,分别对应不同模块:
   - 主程序 treeland 的翻译
   - 锁屏插件 lockscreen 的翻译
   - 多任务视图插件 multitaskview 的翻译
   - 壁纸示例 wallpaper 的翻译
3. 设置 QT 文件格式及对应的源文件和目标路径
4. 配置用于自动化更新的 PR 分支命名规则
2025-06-24 13:36:37 +08:00
YaoBing Xiao 7acf621712 feat: adapt to wlroots-0.19
update waylib submodule
2025-06-23 14:28:13 +08:00
renovate[bot] 28ca983e8d chore(deps): lock file maintenance 2025-06-23 13:23:55 +08:00
renovate[bot] b8b0dc8b9f chore(config): migrate config renovate.json 2025-06-23 13:22:14 +08:00
Lu Hongxu 76f9538656 fix: various compiler warnings
- Adjust member initialization order in `DDEShellSurfaceInterfacePrivate`
- Use `static_cast<size_t>` for type-safe assertion in `CaptureSource::copyBuffer`
- Reorder member variables in `treelandconfig.h` to match initialization order
- Remove unused static functions and redundant friend declarations
2025-06-20 09:53:45 +08:00
rewine e6447c783e refactor: remove jemalloc dependency
1. Removed jemalloc from the build dependencies in debian/control
2. Eliminated jemalloc reference in nix/default.nix
3. Deleted pkg_check_modules(JEMALLOC) call in src/CMakeLists.txt
4. Removed PkgConfig::JEMALLOC from target_link_libraries in src/
CMakeLists.txt
5. This change simplifies the build process and reduces external
dependencies

重构:移除jemalloc依赖

1. 从debian/control中删除jemalloc的构建依赖
2. 在nix/default.nix中消除对jemalloc的引用
3. 删除src/CMakeLists.txt中的pkg_check_modules(JEMALLOC)调用
4. 从src/CMakeLists.txt的target_link_libraries中移除PkgConfig::JEMALLOC
5. 此更改简化了构建过程并减少了外部依赖项
2025-06-18 13:39:00 +08:00
renovate[bot] 9bfa75519e chore(deps): lock file maintenance 2025-05-28 14:20:31 +08:00
renovate[bot] c31cda69cb chore(deps): update waylib digest to 12ff83a 2025-05-28 14:19:48 +08:00
766 changed files with 70820 additions and 3648 deletions

View File

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: export
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

View File

@ -0,0 +1,87 @@
name: Build qwlroots on Arch Linux (independent)
on:
push:
paths:
- 'qwlroots/**'
- '.github/workflows/qwlroots-archlinux-build.yml'
pull_request:
paths:
- 'qwlroots/**'
- '.github/workflows/qwlroots-archlinux-build.yml'
jobs:
container:
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- uses: actions/checkout@v4
- name: Run in container
run: |
pacman-key --init
pacman -Syu --noconfirm
- name: Install dependencies
run: |
pacman -Syu --noconfirm qt6-base cmake pkgconfig wlroots0.19 pixman wayland-protocols wlr-protocols
pacman -Syu --noconfirm clang ninja base-devel git
- name: Configure and build qwlroots
working-directory: qwlroots
run: |
echo "Working directory:" $PWD
cmake --preset ci
cmake --build --preset ci
- name: Install qwlroots to staging directory
working-directory: qwlroots
run: |
echo "Installing qwlroots to staging directory..."
mkdir -p /tmp/qwlroots-install
DESTDIR=/tmp/qwlroots-install cmake --install build
echo "✅ qwlroots installed to staging directory"
echo "Installed files:"
find /tmp/qwlroots-install -type f | head -20
echo "Total files installed: $(find /tmp/qwlroots-install -type f | wc -l)"
- name: Create qwlroots installation package
run: |
cd /tmp/qwlroots-install
# Install zip if not available
pacman -Syu --noconfirm zip
# Create package info
echo "Creating package info..."
cat > PACKAGE_INFO.txt << EOF
Package: qwlroots-archlinux-build
Version: $(date +%Y%m%d-%H%M%S)
Architecture: x86_64
Built-on: Arch Linux
CMake-Config: Default configuration
Installation Instructions:
1. Extract this package to /
2. Run: sudo ldconfig (if libraries are included)
3. Ensure dependencies are installed on target system
Files included in this package:
EOF
find . -type f | sort >> PACKAGE_INFO.txt
# Create the zip package
zip -r /tmp/qwlroots-archlinux-$(date +%Y%m%d-%H%M%S).zip .
echo "✅ qwlroots installation package created"
ls -la /tmp/qwlroots-archlinux-*.zip
- name: Upload qwlroots ArchLinux build artifacts
uses: actions/upload-artifact@v4
with:
name: qwlroots-archlinux-build
path: "/tmp/qwlroots-archlinux-*.zip"
if-no-files-found: error
retention-days: 30

View File

@ -0,0 +1,59 @@
name: Build qwlroots on Debian unstable (independent)
on:
push:
paths:
- 'qwlroots/**'
- '.github/workflows/qwlroots-debian-build.yml'
pull_request:
paths:
- 'qwlroots/**'
- '.github/workflows/qwlroots-debian-build.yml'
jobs:
container:
runs-on: ubuntu-latest
container: debian:unstable
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
working-directory: qwlroots
run: |
# Configure apt sources for unstable
echo "deb http://deb.debian.org/debian unstable main" > /etc/apt/sources.list
echo "deb http://deb.debian.org/debian sid main" >> /etc/apt/sources.list
apt-get update
apt-get install -y devscripts equivs
# Add deepin community repository to install wlr-protocols
echo "deb [trusted=yes] https://community-packages.deepin.com/beige/ crimson main commercial community" > /etc/apt/sources.list.d/deepin-community.list
# Update package lists (ignore signature errors for this temporary repo)
apt-get update --allow-unauthenticated
# Install wlr-protocols package directly
apt-get install -y --allow-unauthenticated wlr-protocols
# Remove deepin repository to avoid system pollution
rm -f /etc/apt/sources.list.d/deepin-community.list
apt-get update
# Install other build dependencies from control file
mk-build-deps --install --remove --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
- name: Build qwlroots deb package
working-directory: qwlroots
run: |
dpkg-buildpackage -uc -us -b
echo "✅ qwlroots deb package built successfully!"
ls -la ../*.deb
- name: Upload qwlroots deb packages as artifacts
uses: actions/upload-artifact@v4
with:
name: qwlroots-deb-packages
path: "*.deb"
if-no-files-found: error
retention-days: 30

View File

@ -0,0 +1,129 @@
name: Build treeland on Arch Linux
# This workflow builds treeland with merged waylib and qwlroots code
# Dependencies are based on the official ArchLinux PKGBUILD plus
# additional dependencies from the integrated waylib and qwlroots code
# treeland-protocols-git is installed from AUR
on:
push:
pull_request:
jobs:
container:
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- name: Run in container
run: |
cat /etc/pacman.d/mirrorlist
pacman-key --init
pacman --noconfirm --noprogressbar -Syu
- name: Install base dependencies
run: |
pacman -Syu --noconfirm --noprogressbar base-devel git cmake ninja pkgconfig clang make
pacman -Syu --noconfirm --noprogressbar fakeroot meson sudo
- name: Install Qt6 dependencies
run: |
# Qt6 dependencies matching qwlroots and waylib builds
pacman -Syu --noconfirm --noprogressbar qt6-base qt6-declarative qt6-wayland qt6-tools
- name: Install graphics and wayland dependencies
run: |
# Core graphics and wayland dependencies (matching qwlroots and waylib builds)
pacman -Syu --noconfirm --noprogressbar pixman vulkan-headers wayland wayland-protocols wlr-protocols
pacman -Syu --noconfirm --noprogressbar wlroots0.19 libinput pam systemd-libs jemalloc gcc-libs glibc
- name: Install additional waylib/qwlroots dependencies
run: |
# Additional dependencies from waylib and qwlroots build configs
pacman -Syu --noconfirm --noprogressbar libdrm xcb-util-errors libxdmcp
- name: Install DTK dependencies
run: |
# Try to install DTK from available packages
# If not available, the build will proceed without them (may fail)
pacman -Syu --noconfirm --noprogressbar dtk6core dtk6declarative dtk6systemsettings
- name: Install DDM dependencies
run: |
# Try to install DDM from available packages
pacman -Syu --noconfirm --noprogressbar ddm
- name: Build and Install treeland-protocols
run: |
echo "Building treeland-protocols from source..."
git clone https://github.com/linuxdeepin/treeland-protocols.git --depth 1
cd treeland-protocols
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
echo "✅ treeland-protocols built and installed from source"
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure and Build treeland with ci preset
run: |
echo "Working directory:" $PWD
echo "Configuring treeland with merged waylib and qwlroots code..."
cmake --preset ci
cmake --build --preset ci
echo "✅ treeland built successfully with merged waylib and qwlroots code!"
- name: Install treeland to staging directory
run: |
echo "Installing treeland to staging directory..."
mkdir -p /tmp/treeland-install
DESTDIR=/tmp/treeland-install cmake --install build
echo "✅ treeland installed to staging directory"
echo "Installed files:"
find /tmp/treeland-install -type f | head -20
echo "Total files installed: $(find /tmp/treeland-install -type f | wc -l)"
- name: Create treeland installation package
run: |
cd /tmp/treeland-install
# Install zip if not available
pacman -Syu --noconfirm zip
# Create package info
echo "Creating package info..."
cat > PACKAGE_INFO.txt << EOF
Package: treeland-archlinux-build
Version: $(date +%Y%m%d-%H%M%S)
Architecture: x86_64
Built-on: Arch Linux
Built-with: merged waylib and qwlroots code
CMake-Config: -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib
Installation Instructions:
1. Extract this package to /
2. Run: sudo ldconfig (if libraries are included)
3. Ensure dependencies are installed on target system
Files included in this package:
EOF
find . -type f | sort >> PACKAGE_INFO.txt
# Create the zip package
zip -r /tmp/treeland-archlinux-$(date +%Y%m%d-%H%M%S).zip .
echo "✅ treeland installation package created"
ls -la /tmp/treeland-archlinux-*.zip
- name: Upload treeland ArchLinux build artifacts
uses: actions/upload-artifact@v4
with:
name: treeland-archlinux-build
path: "/tmp/treeland-archlinux-*.zip"
if-no-files-found: error
retention-days: 30

View File

@ -0,0 +1,100 @@
name: Build waylib on Arch Linux (independent)
on:
push:
paths:
- 'waylib/**'
- 'qwlroots/**'
- '.github/workflows/waylib-archlinux-build.yml'
pull_request:
paths:
- 'waylib/**'
- 'qwlroots/**'
- '.github/workflows/waylib-archlinux-build.yml'
jobs:
container:
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- name: Run in container
run: |
cat /etc/pacman.d/mirrorlist
pacman-key --init
pacman --noconfirm --noprogressbar -Syu
- name: Install dependencies
run: |
pacman -Syu --noconfirm --noprogressbar base-devel qt6-base qt6-declarative cmake pkgconfig pixman vulkan-headers wlroots0.19 wayland-protocols wlr-protocols git
pacman -Syu --noconfirm --noprogressbar clang ninja make
pacman -Syu --noconfirm --noprogressbar fakeroot meson sudo
- uses: actions/checkout@v4
with:
submodules: true
- name: Create qwlroots symlink for waylib
run: |
cd waylib
ln -sf ../qwlroots qwlroots
echo "✅ Created symlink: waylib/qwlroots -> ../qwlroots"
ls -la qwlroots
- name: Configure and Build waylib with ci preset
working-directory: waylib
run: |
echo "Working directory:" $PWD
cmake --preset ci -DWITH_SUBMODULE_QWLROOTS=ON
cmake --build --preset ci
- name: Install waylib to staging directory
working-directory: waylib
run: |
echo "Installing waylib to staging directory..."
mkdir -p /tmp/waylib-install
DESTDIR=/tmp/waylib-install cmake --install build
echo "✅ waylib installed to staging directory"
echo "Installed files:"
find /tmp/waylib-install -type f | head -20
echo "Total files installed: $(find /tmp/waylib-install -type f | wc -l)"
- name: Create waylib installation package
run: |
cd /tmp/waylib-install
# Install zip if not available
pacman -Syu --noconfirm zip
# Create package info
echo "Creating package info..."
cat > PACKAGE_INFO.txt << EOF
Package: waylib-archlinux-build
Version: $(date +%Y%m%d-%H%M%S)
Architecture: x86_64
Built-on: Arch Linux
Built-with: qwlroots submodule enabled
CMake-Config: -DWITH_SUBMODULE_QWLROOTS=ON
Installation Instructions:
1. Extract this package to /
2. Run: sudo ldconfig (if libraries are included)
3. Ensure dependencies are installed on target system
Files included in this package:
EOF
find . -type f | sort >> PACKAGE_INFO.txt
# Create the zip package
zip -r /tmp/waylib-archlinux-$(date +%Y%m%d-%H%M%S).zip .
echo "✅ waylib installation package created"
ls -la /tmp/waylib-archlinux-*.zip
- name: Upload waylib ArchLinux build artifacts
uses: actions/upload-artifact@v4
with:
name: waylib-archlinux-build
path: "/tmp/waylib-archlinux-*.zip"
if-no-files-found: error
retention-days: 30

View File

@ -0,0 +1,84 @@
name: Build waylib on Debian unstable (independent)
on:
push:
paths:
- 'waylib/**'
- 'qwlroots/**'
- '.github/workflows/waylib-debian-build.yml'
pull_request:
paths:
- 'waylib/**'
- 'qwlroots/**'
- '.github/workflows/waylib-debian-build.yml'
jobs:
container:
runs-on: ubuntu-latest
container: debian:unstable
steps:
- uses: actions/checkout@v4
- name: Build qwlroots first
working-directory: qwlroots
run: |
# Configure apt sources for unstable
echo "deb http://deb.debian.org/debian unstable main" > /etc/apt/sources.list
echo "deb http://deb.debian.org/debian sid main" >> /etc/apt/sources.list
apt-get update
apt-get install -y devscripts equivs
# Add deepin community repository to install wlr-protocols
echo "deb [trusted=yes] https://community-packages.deepin.com/beige/ crimson main commercial community" > /etc/apt/sources.list.d/deepin-community.list
# Update package lists (ignore signature errors for this temporary repo)
apt-get update --allow-unauthenticated
# Install wlr-protocols package directly
apt-get install -y --allow-unauthenticated wlr-protocols
# Remove deepin repository to avoid system pollution
rm -f /etc/apt/sources.list.d/deepin-community.list
apt-get update
# Install other build dependencies for qwlroots
mk-build-deps --install --remove --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
# Build qwlroots deb package
dpkg-buildpackage -uc -us -b
echo "✅ qwlroots deb package built successfully!"
ls -la ../*.deb
- name: Install qwlroots deb package
run: |
# Install the built qwlroots package
dpkg -i qwlroots*.deb || apt-get install -f -y
echo "✅ qwlroots package installed!"
- name: Build waylib deb package
working-directory: waylib
run: |
# Install remaining build dependencies for waylib
apt-get install -y devscripts equivs
# Install waylib build dependencies (qwlroots is now available from the installed deb)
mk-build-deps --install --remove --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
# Build waylib with submodule disabled (use system qwlroots)
# Modify debian/rules to disable submodule
sed -i 's/-DCMAKE_INSTALL_PREFIX=\/usr/-DCMAKE_INSTALL_PREFIX=\/usr -DWITH_SUBMODULE_QWLROOTS=OFF/' debian/rules
echo "Modified debian/rules to disable qwlroots submodule:"
cat debian/rules
dpkg-buildpackage -uc -us -b
echo "✅ waylib deb package built successfully!"
ls -la ../*.deb
- name: Upload waylib deb packages as artifacts
uses: actions/upload-artifact@v4
with:
name: waylib-deb-packages
path: "*.deb"
if-no-files-found: error
retention-days: 30

5
.gitignore vendored
View File

@ -1,6 +1,7 @@
.vscode/
.cache/
build*/
.qtcreator/
*.user
@ -49,3 +50,7 @@ debian/files
debian/*.substvars
debian/*.debhelper.log
obj-*-linux-gnu/
# ai
.cursor
.specstory

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "waylib"]
path = waylib
url = https://github.com/vioken/waylib

26
.tx/config Normal file
View File

@ -0,0 +1,26 @@
[main]
host = https://www.transifex.com
[o:linuxdeepin:p:treeland:r:f56f82288bfe7a231b1be25f7b0cb008]
file_filter = translations/treeland.<lang>.ts
source_file = translations/treeland.en_US.ts
source_lang = en_US
type = QT
[o:linuxdeepin:p:treeland:r:b675317802ed042606e0660179b6b04f]
file_filter = src/plugins/lockscreen/translations/lockscreen.<lang>.ts
source_file = src/plugins/lockscreen/translations/lockscreen.en_US.ts
source_lang = en_US
type = QT
[o:linuxdeepin:p:treeland:r:7309e9da01b4b7fbf5c2ac9c2a2d23a6]
file_filter = src/plugins/multitaskview/translations/multitaskview.<lang>.ts
source_file = src/plugins/multitaskview/translations/multitaskview.en_US.ts
source_lang = en_US
type = QT
[o:linuxdeepin:p:treeland:r:1eff66bc82bf8f288b9c56e8c724ea20]
file_filter = examples/test_set_treeland_wallpaper/translations/wallpaper.<lang>.ts
source_file = examples/test_set_treeland_wallpaper/translations/wallpaper.en_US.ts
source_lang = en_US
type = QT

23
.tx/transifex.yaml Normal file
View File

@ -0,0 +1,23 @@
filters:
- filter_type: file
source_file: translations/treeland.en_US.ts
file_format: QT
source_language: en_US
translation_files_expression: translations/treeland.<lang>.ts
- filter_type: file
source_file: src/plugins/lockscreen/translations/lockscreen.en_US.ts
file_format: QT
source_language: en_US
translation_files_expression: src/plugins/lockscreen/translations/lockscreen.<lang>.ts
- filter_type: file
source_file: src/plugins/multitaskview/translations/multitaskview.en_US.ts
file_format: QT
source_language: en_US
translation_files_expression: src/plugins/multitaskview/translations/multitaskview.<lang>.ts
- filter_type: file
source_file: examples/test_set_treeland_wallpaper/translations/wallpaper.en_US.ts
file_format: QT
source_language: en_US
translation_files_expression: examples/test_set_treeland_wallpaper/translations/wallpaper.<lang>.ts
settings:
pr_branch_name: transifex_update_<br_unique_id>

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.25.0)
project(Treeland
VERSION 0.2.2
VERSION 0.7.0
LANGUAGES CXX C)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@ -16,10 +16,10 @@ include(FeatureSummary)
include(cmake/DefineTarget.cmake)
option(WITH_SUBMODULE_WAYLIB "Use the waylib from git submodule" OFF)
option(WITH_SUBMODULE_WAYLIB "Use the waylib from git submodule" ON)
add_feature_info(submodule_waylib WITH_SUBMODULE_WAYLIB "Use waylib from submodule")
option(ADDRESS_SANITIZER "Enable address sanitize" OFF)
option(ADDRESS_SANITIZER "Enable address sanitizer" OFF)
add_feature_info(ASanSupport ADDRESS_SANITIZER "https://github.com/google/sanitizers/wiki/AddressSanitizer")
option(BUILD_TREELAND_EXAMPLES "Build clients demo to test treeland" OFF)
@ -31,16 +31,33 @@ if (DISABLE_DDM)
add_compile_definitions("DISABLE_DDM")
endif()
# Alternative lock mechanism: Wayland ext-session-lock
option(EXT_SESSION_LOCK_V1 "Enable Wayland ext-session-lock support (alternative to DDM)" ON)
add_feature_info(ext_session_lock_v1 EXT_SESSION_LOCK_V1 "Enable ext-session-lock-v1 protocol support in Treeland")
if (EXT_SESSION_LOCK_V1)
add_compile_definitions("EXT_SESSION_LOCK_V1")
endif()
# Heads-up if both are enabled: ext-session-lock is intended as an alternative to DDM
if (NOT EXT_SESSION_LOCK_V1 AND DISABLE_DDM)
message(WARNING "no ext-session-lock support and no DDM, treeland will not have session locking ability.")
endif()
if (ADDRESS_SANITIZER)
add_compile_options(-fsanitize=address -fno-optimize-sibling-calls -fno-omit-frame-pointer)
add_link_options(-fsanitize=address)
endif()
# NOTE: Qt keywords conflict with wlroots. but dtksystemsettings still uses it.
# add_definitions("-DQT_NO_KEYWORDS")
# NOTE: Enable Qt logging with context.
add_definitions("-DQT_MESSAGELOGCONTEXT")
set(LOCAL_QML_IMPORT_PATH "${PROJECT_BINARY_DIR}/qt/qml")
if(WITH_SUBMODULE_WAYLIB)
set(WITH_SUBMODULE_QWLROOTS ON)
include(${CMAKE_CURRENT_SOURCE_DIR}/waylib/qwlroots/cmake/WaylandScannerHelpers.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/qwlroots/cmake/WaylandScannerHelpers.cmake)
add_subdirectory(waylib)
list(APPEND LOCAL_QML_IMPORT_PATH "${PROJECT_BINARY_DIR}/waylib/src/server")
else()
@ -53,9 +70,7 @@ set(QML_IMPORT_PATH "${LOCAL_QML_IMPORT_PATH}" CACHE STRING "For LSP" FORCE)
find_package(PkgConfig REQUIRED)
find_package(Qt6 CONFIG REQUIRED Core DBus Gui Qml Quick QuickControls2 LinguistTools Test QuickTest)
set(wlr wlroots-0.18)
set(WLROOTS_MINIMUM_REQUIRED 0.18.0)
pkg_check_modules(WLROOTS REQUIRED IMPORTED_TARGET ${wlr}>=${WLROOTS_MINIMUM_REQUIRED})
pkg_check_modules(WLROOTS REQUIRED IMPORTED_TARGET wlroots-0.19)
qt_standard_project_setup(REQUIRES 6.8)

View File

@ -12,13 +12,7 @@
"displayName": "Default Config",
"description": "Default build using Ninja generator",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"WITH_SUBMODULE_WAYLIB": {
"type": "BOOL",
"value": "OFF"
}
}
"binaryDir": "${sourceDir}/build"
},
{
"name": "clang",
@ -27,41 +21,51 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"WITH_SUBMODULE_WAYLIB": {
"type": "BOOL",
"value": "OFF"
},
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "submodule",
"displayName": "use submodule",
"description": "Default build using Ninja generator with git submodule",
"name": "ci",
"displayName": "CI Build Config",
"description": "Build configuration with warnings as errors",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"WITH_SUBMODULE_WAYLIB": {
"type": "BOOL",
"value": "ON"
}
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Werror -Wno-stringop-overflow",
"CMAKE_C_FLAGS": "-Wall -Wextra -Werror -Wno-stringop-overflow"
}
},
{
"name": "submodule-with-clang",
"displayName": "use submodule with clang",
"description": "Default build using Ninja generator with git submodule",
"name": "deb",
"displayName": "Debian Package Build Config",
"description": "Build configuration for Debian packaging with examples enabled",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"WITH_SUBMODULE_WAYLIB":{
"type": "BOOL",
"value": "ON"
},
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Werror -Wno-stringop-overflow",
"CMAKE_C_FLAGS": "-Wall -Wextra -Werror -Wno-stringop-overflow",
"BUILD_TREELAND_EXAMPLES": "ON"
}
}
],
"buildPresets": [
{
"name": "default",
"configurePreset": "default"
},
{
"name": "clang",
"configurePreset": "clang"
},
{
"name": "ci",
"configurePreset": "ci"
},
{
"name": "deb",
"configurePreset": "deb"
}
]
}

1
LICENSES/HPND.txt Symbolic link
View File

@ -0,0 +1 @@
../waylib/LICENSES/HPND.txt

23
LICENSES/MIT.txt Normal file
View File

@ -0,0 +1,23 @@
MIT License
Copyright (c) 2017, 2018 Drew DeVault
Copyright (c) 2014 Jari Vetoniemi
Copyright (c) 2023 The wlroots contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -10,7 +10,7 @@ Core build dependencies:
- [waylib](https://github.com/vioken/waylib): A Wayland compositor development library based on wlroots and QtQuick
- Qt >= 6.8.0
- wlroots = 0.18
- wlroots = 0.19
- [treeland-protocols](https://github.com/linuxdeepin/treeland-protocols): Private Wayland protocols used by treeland
Recommended runtime dependencies:
@ -48,6 +48,16 @@ $ sudo apt build-dep . # install build dependencies
$ dpkg-buildpackage -uc -us -nc -b # build binary package(s)
```
## GitHub Actions / CI
This project uses GitHub Actions for continuous integration. The following workflows are configured:
- **qwlroots builds**: Triggered when `qwlroots/**` files are modified
- **waylib builds**: Triggered when `waylib/**` or `qwlroots/**` files are modified (since waylib depends on qwlroots)
- **treeland builds**: Main project builds
The waylib workflows are configured to also trigger when qwlroots code changes, ensuring that waylib builds remain compatible with qwlroots modifications.
## Getting Involved
- [Code contribution via GitHub](https://github.com/linuxdeepin/treeland/)

View File

@ -10,7 +10,7 @@ treeland 是一个基于 wlroots 和 QtQuick 开发的 Wayland 合成器,旨
- [waylib](https://github.com/vioken/waylib) 整合 wlroots 和 QtQuick 的 Wayland 合成器开发库
- Qt >= 6.8.0
- wlroots = 0.18
- wlroots = 0.19
- [treeland-protocols](https://github.com/linuxdeepin/treeland-protocols) treeland 使用的私有 wayland 协议
推荐的运行时依赖:
@ -47,6 +47,16 @@ $ sudo apt build-dep . # 安装构建依赖
$ dpkg-buildpackage -uc -us -nc -b # 构建二进制软件包
```
## GitHub Actions / 持续集成
本项目使用 GitHub Actions 进行持续集成。配置了以下工作流:
- **qwlroots 构建**:当 `qwlroots/**` 文件被修改时触发
- **waylib 构建**:当 `waylib/**``qwlroots/**` 文件被修改时触发(因为 waylib 依赖于 qwlroots
- **treeland 构建**:主项目构建
waylib 工作流配置为在 qwlroots 代码变化时也会触发,确保 waylib 构建与 qwlroots 修改保持兼容。
## 参与贡献
- [通过 GitHub 发起代码贡献](https://github.com/linuxdeepin/treeland/)
@ -54,4 +64,4 @@ $ dpkg-buildpackage -uc -us -nc -b # 构建二进制软件包
## 许可协议
**Treeland** 使用 Apache-2.0, LGPL-3.0-only, GPL-2.0-only 或 GPL-3.0-only 许可协议进行发布。
**Treeland** 使用 Apache-2.0, LGPL-3.0-only, GPL-2.0-only 或 GPL-3.0-only 许可协议进行发布。

View File

@ -3,7 +3,7 @@ SPDX-PackageName = "treeland"
SPDX-PackageDownloadLocation = "https://github.com/linuxdeepin/treeland"
[[annotations]]
path = [".github/**", ".obs/**.yml", "garnix.yaml"]
path = [".github/**", ".obs/**.yml", "garnix.yaml", ".tx/*"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
@ -61,3 +61,192 @@ path = ["src/greeter/**.h", "src/greeter/**.cpp"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "GPL-2.0-only"
[[annotations]]
path = ["qwlroots/**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "Apache-2.0"
# ===== WAYLIB REUSE Configuration =====
# CI and build files for waylib
[[annotations]]
path = ["waylib/.github/**", "waylib/.obs/**.yml", "waylib/renovate.json"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# Gitignore and git modules for waylib
[[annotations]]
path = ["waylib/.gitignore", "waylib/.gitmodules"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# Project files for waylib
[[annotations]]
path = ["waylib/**.cmake", "waylib/*CMakeLists.txt", "waylib/**.pc.in", "waylib/**cmake.in"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# README for waylib
[[annotations]]
path = ["waylib/README.md", "waylib/README.zh_CN.md"]
precedence = "aggregate"
SPDX-FileCopyrightText = "JiDe Zhang"
SPDX-License-Identifier = "CC-BY-4.0"
# Nix Develop files for waylib
[[annotations]]
path = ["waylib/**.nix", "waylib/.envrc", "waylib/flake.lock"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# Debian package for waylib
[[annotations]]
path = ["waylib/debian/**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# C++ pch files for waylib
[[annotations]]
path = ["waylib/src/server/pch/pch.hxx"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# Core waylib files
[[annotations]]
path = [
"waylib/examples/tinywl/qml.qrc",
"waylib/tests/manual/cursor/cursor.qrc",
"waylib/src/server/kernel/WBackend",
"waylib/src/server/kernel/WCursor",
"waylib/src/server/kernel/WInputDevice",
"waylib/src/server/kernel/WInputEvent",
"waylib/src/server/kernel/WOutput",
"waylib/src/server/kernel/WSeat",
"waylib/src/server/kernel/WEvent",
"waylib/src/server/kernel/WServer",
"waylib/src/server/kernel/WServerInterface",
"waylib/src/server/kernel/WSurface",
"waylib/src/server/kernel/WSurfaceLayout",
"waylib/src/server/kernel/WTexture",
"waylib/src/server/kernel/WXdgShell",
"waylib/src/server/kernel/WXdgSurface",
"waylib/src/server/kernel/WLayerSurface",
"waylib/src/server/qtquick/WQuickRenderControl",
"waylib/src/server/qtquick/WSurfaceItem",
"waylib/src/server/utils/WSignalConnector",
"waylib/src/server/utils/WThreadUtils",
"waylib/src/server/utils/WCursorImage",
"waylib/src/server/utils/WWrapPointer",
"waylib/tests/main.cpp",
"waylib/tests/test.h"
]
precedence = "aggregate"
SPDX-FileCopyrightText = "JiDe Zhang"
SPDX-License-Identifier = "Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"
# Waylib protocol files
[[annotations]]
path = [
"waylib/src/server/protocols/WCursorShapeManagerV1",
"waylib/src/server/protocols/WForeignToplevel",
"waylib/src/server/protocols/WInputMethodHelper",
"waylib/src/server/protocols/WLayerSurface",
"waylib/src/server/protocols/WOutputManagerV1",
"waylib/src/server/protocols/WXdgOutput",
"waylib/src/server/protocols/WXdgShell",
"waylib/src/server/protocols/WXdgSurface",
"waylib/src/server/protocols/WLayerShell",
"waylib/src/server/protocols/WInputPopupSurface",
"waylib/src/server/protocols/WXWayland",
"waylib/src/server/protocols/WXWaylandSurface",
"waylib/src/server/protocols/WXdgDecorationManager",
"waylib/src/server/protocols/WSessionLock",
"waylib/src/server/protocols/WSessionLockManager",
"waylib/src/server/protocols/WSessionLockSurface"
]
precedence = "aggregate"
SPDX-FileCopyrightText = "UnionTech Software Technology Co., Ltd."
SPDX-License-Identifier = "Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"
# Misc files for waylib
[[annotations]]
path = [
"waylib/tests/manual/cursor/res/HandCursor.png",
"waylib/examples/tinywl/res/xx.jpg"
]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# Protocol files with HPND license for waylib
[[annotations]]
path = ["waylib/src/server/protocols/private/text-input-unstable-v2.xml"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "HPND"
# ===== QWLROOTS REUSE Configuration =====
# CI for qwlroots
[[annotations]]
path = ["qwlroots/.github/**", "qwlroots/.obs/**.yml", "qwlroots/garnix.yaml"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# Project files for qwlroots
[[annotations]]
path = [
"qwlroots/**.cmake",
"qwlroots/*CMakeLists.txt",
"qwlroots/**.pc.in",
"qwlroots/**cmake.in",
"qwlroots/.gitignore",
"qwlroots/.cursorindexingignore",
"qwlroots/.cursor/rules/**.mdc",
"qwlroots/.gitmodules"
]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# Simple header files for qwlroots
[[annotations]]
path = [
"qwlroots/**/qwkeyboard.h",
"qwlroots/**/qwpointer.h",
"qwlroots/**/qwswitch.h",
"qwlroots/**/qwtablet.h",
"qwlroots/**/qwtabletpad.h",
"qwlroots/**/qwtouch.h"
]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# README and documentation for qwlroots
[[annotations]]
path = ["qwlroots/README.md", "qwlroots/README.zh_CN.md", "qwlroots/doc/ai/**.md"]
precedence = "aggregate"
SPDX-FileCopyrightText = "JiDe Zhang"
SPDX-License-Identifier = "CC-BY-4.0"
# Nix Develop files for qwlroots
[[annotations]]
path = ["qwlroots/**.nix", "qwlroots/.envrc", "qwlroots/flake.lock"]
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"
# Debian package for qwlroots
[[annotations]]
path = ["qwlroots/debian/**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2023 rewine <luhongxu@outlook.com>"
SPDX-License-Identifier = "Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"

View File

@ -0,0 +1,62 @@
# TranslationUtils.cmake
# Provides common functions for handling translation files
function(setup_translations TARGET_NAME TRANSLATION_PREFIX)
# Automatically discover all translation files
file(GLOB TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/translations/${TRANSLATION_PREFIX}.*.ts")
# Filter out non-translation files (if any)
list(FILTER TS_FILES INCLUDE REGEX ".*\\.ts$")
# Set translation files variable
set(TRANSLATED_FILES)
# Add lupdate target
qt_add_lupdate(
SOURCE_TARGETS ${TARGET_NAME}
TS_FILES ${TS_FILES}
NO_GLOBAL_TARGET
)
# Add lrelease target
qt_add_lrelease(
TS_FILES ${TS_FILES}
QM_FILES_OUTPUT_VARIABLE TRANSLATED_FILES
)
# Install translation files
install(FILES ${TRANSLATED_FILES} DESTINATION ${TREELAND_COMPONENTS_TRANSLATION_DIR})
# Set TRANSLATED_FILES variable to parent scope
set(TRANSLATED_FILES ${TRANSLATED_FILES} PARENT_SCOPE)
endfunction()
function(setup_main_translations TARGET_NAME)
# Automatically discover all main translation files
file(GLOB TS_FILES "${CMAKE_SOURCE_DIR}/translations/treeland.*.ts")
# Filter out non-translation files (if any)
list(FILTER TS_FILES INCLUDE REGEX ".*\\.ts$")
# Set translation files variable
set(TRANSLATED_FILES)
# Add lupdate target
qt_add_lupdate(
SOURCE_TARGETS ${TARGET_NAME}
TS_FILES ${TS_FILES}
NO_GLOBAL_TARGET
)
# Add lrelease target
qt_add_lrelease(
TS_FILES ${TS_FILES}
QM_FILES_OUTPUT_VARIABLE TRANSLATED_FILES
)
# Install translation files
install(FILES ${TRANSLATED_FILES} DESTINATION ${TREELAND_COMPONENTS_TRANSLATION_DIR})
# Set TRANSLATED_FILES variable to parent scope
set(TRANSLATED_FILES ${TRANSLATED_FILES} PARENT_SCOPE)
endfunction()

163
debian/changelog vendored
View File

@ -1,14 +1,165 @@
treeland (0.5.21.2-test-multi-seat) unstable; urgency=medium
treeland (0.7.6) unstable; urgency=medium
* feat: Add FPS display.
* refactor: implement atomic multi-output configuration
* fix: occasional crash during recording toplevel
* fix: use safeConnect for aboutToBeInvalidated
* i18n: Updates for project TreeLand (#601)
* refactor: Convert Session to shared_ptr and simplify session
lifecycle
* chore: Remove unused code & Add document
* feat: Manage per-user Wayland/XWayland sessions via Helper::Session
* feat: Add per-user XWayland session management
* chore: add ASAN environment variables
* feat: Expose XWayland surface process ID
* chore: change Debian build environment to unstable
* refactor: remove branch filter for workflow triggers
* fix: fix build when treeland examples are enabled
* fix: fix build failure on Arch Linux
* fix: Disable minimize / maximize animation for window that doesn't
belongs to current user
* fix: fix private module inclusion on lower version of Qt
* fix: compile errors on Arch for forward declared class
* fix: include Qt private modules for Qt 6.11
* feat: add real-time FPS display
* feat: support start sessions other than treeland
* feat: implement ext-session-lock-v1 support
* feat(waylib): implement ext-session-lock-v1 protocol support
* fix(waylib): Add missing override specifier in wlayersurface
* fix(qwlroots): allow server side destruction of qw_session_lock_v1
* fix: Delete useless display text in copy mode
* fix: enhance output validation in restore copy mode
* fix: use separate TreelandConfig for each user
* fix: Ensure proper object destruction before app exit
* fix: improve resource management for RenderControl
* fix: fix heap-use-after-free on exit
-- Lu YaNing <luyaning@uniontech.com> Tue, 26 Aug 2025 20:52:43 +0800
-- rewine <luhongxu@uniontech.com> Thu, 30 Oct 2025 14:04:56 +0800
treeland (0.5.21.1) unstable; urgency=medium
treeland (0.7.3) unstable; urgency=medium
* feat: Add multi-seat support.
* fix: fix WorkspaceSelectionList animation's highlight border size
* fix: fix MultitaskView display problem
* refactor: reduce cursor-related log verbosity
* fix: fix MultitaskView display problem caused by refactoring
TreelandConfig
* Updates for project TreeLand (#563)
-- Lu YaNing <luyaning@uniontech.com> Fri, 25 Jul 2025 08:34:28 +0800
-- rewine <luhongxu@uniontech.com> Tue, 23 Sep 2025 17:24:35 +0800
treeland (0.7.2) unstable; urgency=medium
* fix: crash on startup due to uninitialized m_config pointer
-- rewine <luhongxu@uniontech.com> Fri, 19 Sep 2025 10:06:51 +0800
treeland (0.7.1) unstable; urgency=medium
* fix: Fix socket blocking issue in Wayland server connection handling
* fix: correct window title visibility condition
* fix: Fix client crash when created via security context
* feat: add security-context support
* fix: Separate DConfig object creation to another thread to avoid
blocking
* fix: move DBus call to separate thread to avoid blocking
* fix: fixing some trivial memory management bugs.
* feat(core): Add support for XDG toplevel surface and XDG shell in
RootSurfaceContainer
* fix: correct refresh rate on multi-monitor
* fix: redraw when frame callback list updates
-- rewine <luhongxu@uniontech.com> Thu, 18 Sep 2025 11:46:00 +0800
treeland (0.7.0) unstable; urgency=medium
* fix: fix treeland get stuck in lockscreen after crash recovery
* fix: occasional crash during stop preview item handling
* refactor: improve code robustness
* fix: occasional crash when closing x window
* fix: resolve brief black screen during standby
* chore: remove dde portal screen cast configuration
* fix: correct log category and add null check for surface activation
* fix: resolve window resize crash during image capture
* fix: fix wrong display render issue when switching VT too quickly
* Totally disable lockscreen animation when switching TTY to prevent
stuck for switching too quickly
* feat: Support TTY switching with DDM
* Updates for project TreeLand (#515)
* feat(waylib): add WBufferDumper utility for dumping buffer contents
to image files
* refactor: use unified CI build preset with Werror
* build: enable -Werror compiler flag
* fix: prevent crash during preview item handling (#512)
* fix: prevent cursor flicker during screen recording
* docs: add comprehensive logging guidelines and update module logging
* feat: add centralized logging system and standardize log usage
* feat: ssd title bar displays the window title information
* fix: maximize/restore icon in the SSD title bar displays incorrectly
* fix: resolve multiple compiler warnings
* fix(waylib): prevent duplicate signal connections using
Qt::UniqueConnection
* fix(waylib): prevent crash by safely managing textureChanged
connection
* fix: use exec to replace process and avoid duplicate logs in
treeland.sh
* fix(waylib): Occasional crash when moving the cursor
-- rewine <luhongxu@uniontech.com> Fri, 29 Aug 2025 10:23:45 +0800
treeland (0.6.2) unstable; urgency=medium
* fix: resolve library versioning and installation path issues
-- rewine <luhongxu@uniontech.com> Mon, 04 Aug 2025 17:42:40 +0800
treeland (0.6.1) unstable; urgency=medium
* fix: improve D-Bus connection handling and QML hover visibility
* feat: CLI option: switch from --disable-debug-view to --enable-debug-
view
* fix(waylib): Specify required rendering flags in
WSGRenderFootprintNode
-- rewine <luhongxu@uniontech.com> Fri, 01 Aug 2025 13:33:07 +0800
treeland (0.6.0) unstable; urgency=medium
* fix: improve image capture error handling and code structure
* feat: add foreign toplevel image capture support
* feat: add image capture source support
* fix: remove unused quit full button and add helper activation
* fix: prevent title bar and window buttons from stealing focus
* feat: add wl_drm support
* feat: create ext-data-control manager
* fix: Handle VT switching keys (#469)
* feat: add Nix flake support for project configuration
* fix: prevent workspace moveSurfaceTo crash on null wrapper
* fix: remove redundant submodule options and configs
* chore: update nix dependencies and clean up configurations
* fix: Scaling animation not shown while return from shutdown page
* chore: Force Ninja build during deb packaging
* fix: add timeout to protocol tests
* feat: Upload build artifacts as zip archives
* chore: fix CI and enable independent builds
* refactor: merge qwlroots and waylib source code into treeland
* chore: Use treeland-specific seatd service
* feat: implement ext-foreign-toplevel-list
* i18n: Updates for project TreeLand (#440)
* chore: remove polkit rules for login1
* feat: add support for alpha modifier protocol
* fix: cannot export dbus services
* Revert "fix: should not maximize when client set maxsize"
* Updates for project TreeLand (#431)
* fix: Treeland does not exit when logging out of session
* fix: cannot use treeland user session mode
* fix: add [[maybe_unused]] attribute to unused parameters
* chore: improvement fixes the translation configuration
* feat: add popup surface container for handling popup windows
* chore: configure translation files and update Chinese translations
* chore: configure transifex translation files
* feat: adapt to wlroots-0.19
* refactor: remove jemalloc dependency
-- rewine <luhongxu@uniontech.com> Thu, 31 Jul 2025 20:40:50 +0800
treeland (0.5.21) unstable; urgency=medium

19
debian/control vendored
View File

@ -3,8 +3,10 @@ Priority: optional
Maintainer: rewine <luhongxu@deepin.org>
Build-Depends: cmake (>= 3.4~),
debhelper-compat (= 13),
ninja-build,
extra-cmake-modules (>= 1.4.0~),
libddm-dev,
libdtk6core-bin,
libdtk6core-dev,
libdtk6declarative-dev,
libdtk6gui-dev,
@ -12,23 +14,27 @@ Build-Depends: cmake (>= 3.4~),
libdtkcommon-dev,
libsystemd-dev [linux-any],
systemd,
libwaylib-dev,
libwlroots-0.18-dev,
libwlroots-0.19-dev,
libpixman-1-dev,
libxcb-ewmh-dev,
libdrm-dev,
pkg-config,
qml6-module-qtquick-templates,
qt6-base-dev (>= 6.6.1~),
qt6-base-private-dev (>= 6.6.1~),
qt6-base-dev-tools (>= 6.6.0),
qt6-declarative-dev (>= 6.6.1~),
qt6-declarative-private-dev (>= 6.6.0),
qt6-shadertools-dev,
qt6-tools-dev,
qt6-tools-dev-tools (>= 6.6.1~),
qt6-wayland,
qt6-wayland-dev,
qt6-wayland-private-dev,
qwlroots,
wayland-protocols,
wlr-protocols,
treeland-protocols,
libpam0g-dev,
libjemalloc-dev,
Standards-Version: 4.6.0
Section: dde
Homepage: https://github.com/linuxdeepin/treeland.git
@ -45,6 +51,9 @@ Depends: qml6-module-qtquick-layouts,
treeland-data (= ${source:Version}),
xwayland,
${shlibs:Depends},
Conflicts: libwaylib, qwlroots
Replaces: libwaylib, qwlroots
Recommends: ddm,
Description: a Wayland compositor based on wlroots and QML, designed with an attractive and elegant appearance.
Package: treeland-dev
@ -52,6 +61,8 @@ Section: libdevel
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends}, treeland( =${source:Version}),
Conflicts: libwaylib-dev, qwlroots
Replaces: libwaylib-dev, qwlroots
Description: a Wayland compositor based on wlroots and QML, designed with an attractive and elegant appearance.
Package: treeland-examples

6
debian/rules vendored
View File

@ -8,14 +8,12 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
TREELAND_CMAKE_ARGS = -DBUILD_TREELAND_EXAMPLES=ON
%:
dh $@
override_dh_auto_configure:
dh_auto_configure -- ${TREELAND_CMAKE_ARGS}
dh_auto_configure -- --preset deb

View File

@ -1,4 +1,3 @@
usr/share/dsg/configs/*
usr/share/treeland/shortcuts/*
usr/share/wayland-sessions/treeland.desktop
etc/xdg-desktop-portal/dde-portals.conf

View File

@ -1,2 +1,5 @@
usr/include/*
usr/lib/*/cmake/*
usr/lib/*/cmake/*
usr/lib/*/pkgconfig/*
usr/lib/*/lib*.so
usr/lib/*/lib*.a

View File

@ -1 +1,2 @@
usr/share/wayland-sessions/treeland-user.desktop
usr/bin/treeland-user-wrapper

View File

@ -5,7 +5,6 @@ usr/lib/systemd/system/*
usr/libexec/*
usr/share/*/translations/*
usr/share/dbus-1/system.d/*
usr/share/polkit-1/rules.d/*
usr/lib/*/lib*
usr/lib/*/lib*.so.*
usr/lib/*/treeland/plugins/lib*.so
usr/share/treeland/qml

27
default.nix Normal file
View File

@ -0,0 +1,27 @@
{
pkgs ? import <nixpkgs> { },
nix-filter,
ddm,
treeland-protocols,
}:
rec {
qwlroots = pkgs.qt6Packages.callPackage ./qwlroots/nix {
inherit nix-filter;
wlroots = pkgs.wlroots_0_19;
};
waylib = pkgs.qt6Packages.callPackage ./waylib/nix {
inherit nix-filter qwlroots;
makeTest = import (pkgs.path + "/nixos/tests/make-test-python.nix");
};
treeland = pkgs.qt6Packages.callPackage ./nix {
inherit
nix-filter
ddm
treeland-protocols
qwlroots
waylib
;
};
}

177
docs/logging-guidelines.md Normal file
View File

@ -0,0 +1,177 @@
# Logging Guidelines for Treeland Project
This document provides guidelines for logging in the Treeland project, covering both treeland and waylib modules.
## Overview
The Treeland project uses Qt's logging system with customized categories. There are two different approaches for treeland and waylib modules:
- **treeland**: Uses centralized logging categories defined in `treelandlogging.h/.cpp`
- **waylib**: Uses local logging category definitions in each file
## Logging Categories
### Treeland Module Categories
All logging categories for the treeland module are centrally defined in `src/common/treelandlogging.h`:
```cpp
// Core functionality
Q_DECLARE_LOGGING_CATEGORY(treelandCore)
// Input device handling
Q_DECLARE_LOGGING_CATEGORY(treelandInput)
// Output/display management
Q_DECLARE_LOGGING_CATEGORY(treelandOutput)
// Plugin system
Q_DECLARE_LOGGING_CATEGORY(treelandPlugin)
// And more...
```
### Waylib Module Categories
Waylib modules define their categories locally in each file. The category naming follows this pattern:
`waylib.<module>.<component>[.<subcomponent>]`
Example from wcursor.cpp:
```cpp
// Cursor management and movement
Q_LOGGING_CATEGORY(waylibCursor, "waylib.server.cursor", QtInfoMsg)
// Cursor input events
Q_LOGGING_CATEGORY(waylibCursorInput, "waylib.server.cursor.input", QtDebugMsg)
// Cursor gesture events
Q_LOGGING_CATEGORY(waylibCursorGesture, "waylib.server.cursor.gesture", QtDebugMsg)
```
## Log Levels
Use appropriate log levels based on the message importance:
- **Debug (qCDebug)**: Detailed information for debugging
- **Info (qCInfo)**: General operational information
- **Warning (qCWarning)**: Potentially harmful situations
- **Critical (qCCritical)**: Critical errors that need immediate attention
Example:
```cpp
qCDebug(waylibCursor) << "Processing cursor motion at" << position;
qCWarning(waylibCursorInput) << "Invalid button code:" << code;
qCCritical(treelandCore) << "Failed to initialize core component";
```
## Best Practices
1. **Clear and Contextual Messages**
- Include relevant context in log messages
```cpp
// Good
qCDebug(waylibCursor) << "Cursor moved from" << oldPos << "to" << newPos;
// Bad
qCDebug(waylibCursor) << "Cursor moved";
```
2. **Appropriate Log Levels**
- Debug: Development and troubleshooting
- Info: Normal operations
- Warning: Unexpected but recoverable
- Critical: Serious errors
3. **Category Organization**
- Use specific categories for better filtering
```cpp
// Instead of
qCDebug(waylibCursor) << "Touch event received";
// Use
qCDebug(waylibCursorTouch) << "Touch event received";
```
4. **State Changes**
- Log important state changes with before/after values
```cpp
qCDebug(waylibCursor) << "Visibility changed from" << oldVisible << "to" << newVisible;
```
5. **Error Handling**
- Include error details and potential impact
```cpp
qCWarning(waylibCursor) << "Failed to attach device" << device->name()
<< "- not a pointing device";
```
## Implementation Examples
### Treeland Module
```cpp
#include "treelandlogging.h"
void ExampleClass::processEvent()
{
qCDebug(treelandCore) << "Processing event:" << eventType;
if (error) {
qCWarning(treelandCore) << "Event processing failed:" << errorDetails;
}
}
```
### Waylib Module
```cpp
// Local category definition
Q_LOGGING_CATEGORY(waylibExample, "waylib.module.example", QtInfoMsg)
void ExampleClass::processEvent()
{
qCDebug(waylibExample) << "Processing event:" << eventType;
if (error) {
qCWarning(waylibExample) << "Event processing failed:" << errorDetails;
}
}
```
## Debugging Tips
1. **Enable/Disable Categories**
```bash
export QT_LOGGING_RULES="waylib.server.cursor.debug=true"
export QT_LOGGING_RULES="waylib.*.debug=false"
```
2. **Log to File**
```bash
export QT_LOGGING_TO_FILE=1
export QT_LOGGING_OUTPUT=/path/to/logfile.txt
```
## Common Mistakes to Avoid
1. **Don't expose sensitive information**
```cpp
// Bad
qCDebug(treelandCore) << "User password:" << password;
```
2. **Don't mix categories inappropriately**
```cpp
// Bad
qCDebug(treelandInput) << "Cursor position changed"; // Should use cursor category
```
3. **Don't overuse Critical level**
```cpp
// Bad
qCCritical(waylibCursor) << "Minor position adjustment failed";
```
## Contributing
When contributing to the project:
1. Follow the established category naming patterns
2. Use appropriate log levels
3. Provide clear and contextual messages
4. Add new categories through proper channels (centralized for treeland, local for waylib)
For questions about logging, please refer to this guide or contact the maintainers.

View File

@ -0,0 +1,177 @@
# Treeland 项目日志指南
本文档提供了 Treeland 项目的日志指南,涵盖了 treeland 和 waylib 模块。
## 概述
Treeland 项目使用 Qt 的日志系统并自定义了日志类别。treeland 和 waylib 模块采用了两种不同的方式:
- **treeland**:使用在 `treelandlogging.h/.cpp` 中集中定义的日志类别
- **waylib**:在各个文件中本地定义日志类别
## 日志类别
### Treeland 模块类别
所有 treeland 模块的日志类别都集中定义在 `src/common/treelandlogging.h` 中:
```cpp
// 核心功能
Q_DECLARE_LOGGING_CATEGORY(treelandCore)
// 输入设备处理
Q_DECLARE_LOGGING_CATEGORY(treelandInput)
// 输出/显示管理
Q_DECLARE_LOGGING_CATEGORY(treelandOutput)
// 插件系统
Q_DECLARE_LOGGING_CATEGORY(treelandPlugin)
// 更多...
```
### Waylib 模块类别
Waylib 模块在各自的文件中定义类别。类别命名遵循以下模式:
`waylib.<模块>.<组件>[.<子组件>]`
来自 wcursor.cpp 的示例:
```cpp
// 光标管理和移动
Q_LOGGING_CATEGORY(waylibCursor, "waylib.server.cursor", QtInfoMsg)
// 光标输入事件
Q_LOGGING_CATEGORY(waylibCursorInput, "waylib.server.cursor.input", QtDebugMsg)
// 光标手势事件
Q_LOGGING_CATEGORY(waylibCursorGesture, "waylib.server.cursor.gesture", QtDebugMsg)
```
## 日志级别
根据消息的重要性使用适当的日志级别:
- **Debug (qCDebug)**:调试信息,用于开发调试
- **Info (qCInfo)**:一般操作信息
- **Warning (qCWarning)**:潜在的有害情况
- **Critical (qCCritical)**:需要立即关注的严重错误
示例:
```cpp
qCDebug(waylibCursor) << "正在处理光标移动,位置:" << position;
qCWarning(waylibCursorInput) << "无效的按钮代码:" << code;
qCCritical(treelandCore) << "核心组件初始化失败";
```
## 最佳实践
1. **清晰和上下文相关的消息**
- 在日志消息中包含相关上下文
```cpp
// 好的做法
qCDebug(waylibCursor) << "光标从" << oldPos << "移动到" << newPos;
// 不好的做法
qCDebug(waylibCursor) << "光标移动";
```
2. **适当的日志级别**
- Debug开发和故障排除
- Info正常操作
- Warning意外但可恢复的情况
- Critical严重错误
3. **类别组织**
- 使用特定类别以便更好地过滤
```cpp
// 不要这样
qCDebug(waylibCursor) << "收到触摸事件";
// 应该这样
qCDebug(waylibCursorTouch) << "收到触摸事件";
```
4. **状态变化**
- 记录重要的状态变化,包含前后的值
```cpp
qCDebug(waylibCursor) << "可见性从" << oldVisible << "变更为" << newVisible;
```
5. **错误处理**
- 包含错误详情和潜在影响
```cpp
qCWarning(waylibCursor) << "设备" << device->name()
<< "附加失败 - 不是指针设备";
```
## 实现示例
### Treeland 模块
```cpp
#include "treelandlogging.h"
void ExampleClass::processEvent()
{
qCDebug(treelandCore) << "正在处理事件:" << eventType;
if (error) {
qCWarning(treelandCore) << "事件处理失败:" << errorDetails;
}
}
```
### Waylib 模块
```cpp
// 本地类别定义
Q_LOGGING_CATEGORY(waylibExample, "waylib.module.example", QtInfoMsg)
void ExampleClass::processEvent()
{
qCDebug(waylibExample) << "正在处理事件:" << eventType;
if (error) {
qCWarning(waylibExample) << "事件处理失败:" << errorDetails;
}
}
```
## 调试技巧
1. **启用/禁用类别**
```bash
export QT_LOGGING_RULES="waylib.server.cursor.debug=true"
export QT_LOGGING_RULES="waylib.*.debug=false"
```
2. **日志输出到文件**
```bash
export QT_LOGGING_TO_FILE=1
export QT_LOGGING_OUTPUT=/path/to/logfile.txt
```
## 常见错误避免
1. **不要暴露敏感信息**
```cpp
// 错误
qCDebug(treelandCore) << "用户密码:" << password;
```
2. **不要混用类别**
```cpp
// 错误
qCDebug(treelandInput) << "光标位置改变"; // 应该使用光标类别
```
3. **不要过度使用 Critical 级别**
```cpp
// 错误
qCCritical(waylibCursor) << "轻微的位置调整失败";
```
## 贡献指南
在为项目贡献代码时:
1. 遵循既定的类别命名模式
2. 使用适当的日志级别
3. 提供清晰和上下文相关的消息
4. 通过正确的方式添加新类别treeland 集中定义waylib 本地定义)
如有关于日志的问题,请参考本指南或联系维护者。

View File

@ -274,7 +274,7 @@ void TreelandCaptureManager::setRecord(bool newRecord)
if (m_record == newRecord)
return;
m_record = newRecord;
emit recordChanged();
Q_EMIT recordChanged();
}
bool TreelandCaptureManager::recordStarted() const

View File

@ -89,7 +89,7 @@ int main(int argc, char *argv[])
QObject::connect(&engine,
&QQmlApplicationEngine::objectCreated,
manager,
[&app, manager, captureWithMask](QObject *object, const QUrl &url) {
[&app, manager, captureWithMask](QObject *object, const QUrl &) {
if (auto canvasWindow = qobject_cast<QQuickWindow *>(object)) {
auto waylandWindow = static_cast<QtWaylandClient::QWaylandWindow *>(
canvasWindow->handle());

View File

@ -60,7 +60,7 @@ void Player::setCaptureContext(TreelandCaptureContext *context)
Q_EMIT captureContextChanged();
}
QSGNode *Player::updatePaintNode(QSGNode *old, UpdatePaintNodeData *data)
QSGNode *Player::updatePaintNode(QSGNode *old, [[maybe_unused]] UpdatePaintNodeData *data)
{
ensureDebugLogger();
if (!m_captureContext || !m_captureContext->session()
@ -119,7 +119,7 @@ static const char *eglGetErrorString(EGLint error)
}
}
static const char *drmFormatString(int fourcc)
[[maybe_unused]] static const char *drmFormatString(int fourcc)
{
switch (fourcc) {
CASE_STR(DRM_FORMAT_R8)

View File

@ -11,7 +11,7 @@ class SubWindow : public QQuickWindow
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QQuickWindow *parent READ parent WRITE setParent NOTIFY parentChanged FINAL)
signals:
Q_SIGNALS:
void parentChanged();
public:

View File

@ -95,7 +95,7 @@ int main(int argc, char *argv[])
if (!seat)
qFatal("Failed to get wl_seat from QtWayland QPA!");
TreelandDDEActiveV1 *active =
[[maybe_unused]] TreelandDDEActiveV1 *active =
new TreelandDDEActiveV1(manager->get_treeland_dde_active(seat));
}
});

View File

@ -1,4 +1,5 @@
find_package(Qt6 REQUIRED COMPONENTS WaylandClient Quick)
find_package(Qt6 COMPONENTS WaylandClientPrivate QUIET)
find_package(TreelandProtocols REQUIRED)
set(BIN_NAME test-multitaskview)

View File

@ -12,7 +12,8 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
const QUrl url(u"qrc:/qt/qml/pinchhandler/Main.qml"_qs);
using namespace Qt::StringLiterals;
const QUrl url(u"qrc:/qt/qml/pinchhandler/Main.qml"_s);
#else
const QUrl url(u"qrc:/pinchhandler/Main.qml"_qs);
#endif

View File

@ -5,6 +5,9 @@ find_package(TreelandProtocols REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_get_variable(WAYLAND_PROTOCOLS wayland-protocols pkgdatadir)
# Include translation utilities
include(${CMAKE_SOURCE_DIR}/cmake/TranslationUtils.cmake)
set(BIN_NAME test-set-treeland-wallpaper)
qt_add_executable(${BIN_NAME}
@ -36,24 +39,8 @@ qt_add_qml_module(${BIN_NAME}
SOURCES imagehelper.h imagehelper.cpp
)
set(TRANSLATED_FILES)
qt_add_lupdate(
SOURCE_TARGETS ${BIN_NAME}
TS_FILES
translations/wallpaper.zh_CN.ts
translations/wallpaper.en_US.ts
NO_GLOBAL_TARGET
)
qt_add_lrelease(
TS_FILES
translations/wallpaper.zh_CN.ts
translations/wallpaper.en_US.ts
QM_FILES_OUTPUT_VARIABLE TRANSLATED_FILES
)
install(FILES ${TRANSLATED_FILES} DESTINATION ${TREELAND_COMPONENTS_TRANSLATION_DIR})
# Use translation utilities to setup translations
setup_translations(${BIN_NAME} wallpaper)
target_link_libraries(${BIN_NAME}
PRIVATE

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="ca">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation>Imatge local</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation>Mostra-ho tot</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation>Imatge del sistema</translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation>Fons de pantalla</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation>Fons actual</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation>Mètode de visualització del fons de pantalla</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation>Estira</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation>Preserva&apos;n l&apos;aspecte</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation>Si us plau, trieu un fitxer</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation>Afegiu-hi un fons de pantalla</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation>Afegiu-hi un directori</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation>Paràmetres del fons de pantalla</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="es">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation>Imagen local</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation>Mostrar todo</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation>Imagen del sistema</translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation>Fondo de pantalla</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation>Fondo de pantalla actual</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation>Modo de visualización de fondo de pantalla</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation>Estirar</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation>Conservar aspecto</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation>Seleccione un archivo</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation>Agregar fondo de pantalla</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation>Agregar directorio</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation>Configuración del fondo de pantalla</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="fi">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation>Valokuva</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation>Näytä kaikki</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation>Valokuva</translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation>Taustakuva</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation>Nykyinen taustakuva</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation>Taustakuvan näyttötapa</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation>Venytetty</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation>Säilytä kuvasuhde</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation>Valitse tiedosto</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation>Lisää taustakuva</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation>Lisää kansio</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation>Taustakuvan asetukset</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="fr">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation>Image locale</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation>Afficher tout</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation>Image système</translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation>Fond d&apos;écran</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation>Fond d&apos;écran actuel</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation>Méthode d&apos;affichage du fond d&apos;écran</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation>Étirement</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation>Conserver l&apos;aspect</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation>Veuillez choisir un fichier</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation>Ajouter un fond d&apos;écran</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation>Ajouter un répertoire</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation>Paramètres du fond d&apos;écran</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="ja">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation></translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation></translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation></translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation></translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation></translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation></translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation></translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation></translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation></translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation></translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="pl">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation>Zdjęcie lokalne</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation>Pokaż wszystkie</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation>Zdjęcie systemowe</translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation>Tapeta</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation>Bieżąca tapeta</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation>Wyświetlanie tapety</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation>Rozciągnij</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation>Dopasuj</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation>Wybierz plik</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation>Dodaj tapetę</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation>Dodaj katalog</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation>Ustawienia tapety</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="pt_BR">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation>Imagem local</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation>Mostrar tudo</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation>Imagem do sistema</translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation>Papel de parede</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation>Papel de parede atual</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation>Método de exibição de papel de parede</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation>Esticado</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation>Preservar o ajuste do aspecto</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation>Por favor escolha um arquivo</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation>Adicionar papel de parede</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation>Adicionar diretório</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation>Configurações de papel de parede</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="ru">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation>Показать все</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation>Обои</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation>Текущие обои</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation>Метод отображения обоев</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation>Пожалуйста, выберите файл</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation>Добавить обои</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation>Добавить папку</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation>Настройки обоев</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="sq">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation>Foto Vendore</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation>Shfaqi Krejt</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation>Foto Sistemi</translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation>Sfond</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation>Sfond i Tanishëm</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation>Metodë Shfaqjeje Sfondi</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation>Shformoje</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation>Ju lutemi, zgjidhni një kartelë</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation>Shtoni Sfond</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation>Shtoni Drejtori</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation>Rregullime Sfondi</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="uk">
<context>
<name>Wallpaper</name>
<message>
<location filename="../Wallpaper.qml" line="48"/>
<source>Local Picture</source>
<translation>Локальне зображення</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="49"/>
<location filename="../Wallpaper.qml" line="62"/>
<source>Show All</source>
<translation>Показати все</translation>
</message>
<message>
<location filename="../Wallpaper.qml" line="61"/>
<source>System Picture</source>
<translation>Загальносистемне зображення</translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
<message>
<location filename="../WallpaperSetting.qml" line="29"/>
<source>Wallpaper</source>
<translation>Фонове зображення</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="83"/>
<source>Current Wallpaepr</source>
<translation>Поточне фонове зображення</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="93"/>
<source>Wallpaper Display Method</source>
<translation>Спосіб показу фонового зображення</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="100"/>
<source>Stretch</source>
<translation>Розтягнути</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="101"/>
<source>Preserve Aspect Fit</source>
<translation>Зберегти співвідношення розмірів</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation>Будь ласка, виберіть файл</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
<source>Add Wallpaper</source>
<translation>Додати фонове зображення</translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation>Додати каталог</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="14"/>
<source>Wallpaper Settings</source>
<translation>Параметри фонових зображень</translation>
</message>
</context>
</TS>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="zh_CN">
<context>
<name>Wallpaper</name>
<message>
@ -19,10 +17,6 @@
<source>System Picture</source>
<translation></translation>
</message>
<message>
<source>Show All </source>
<translation type="vanished"></translation>
</message>
</context>
<context>
<name>WallpaperSetting</name>
@ -54,7 +48,7 @@
<message>
<location filename="../WallpaperSetting.qml" line="111"/>
<source>Please choose a file</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../WallpaperSetting.qml" line="126"/>
@ -64,7 +58,7 @@
<message>
<location filename="../WallpaperSetting.qml" line="135"/>
<source>Add Directory</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@ -75,4 +69,4 @@
<translation></translation>
</message>
</context>
</TS>
</TS>

View File

@ -11,10 +11,10 @@ DDEShelSurfaceWindow::DDEShelSurfaceWindow(TestMode mode, QWidget *parent)
: QWidget{ parent }
, m_mode(mode)
{
QLineEdit *l = new QLineEdit(this);
[[maybe_unused]] QLineEdit *l = new QLineEdit(this);
}
void DDEShelSurfaceWindow::showEvent(QShowEvent *event)
void DDEShelSurfaceWindow::showEvent([[maybe_unused]] QShowEvent *event)
{
if (isVisible()) {
apply();

View File

@ -20,7 +20,7 @@ class VirtualOutputManager
public:
explicit VirtualOutputManager();
void virtual_output_manager_v1_virtual_output_list(wl_array *names) { }
void virtual_output_manager_v1_virtual_output_list([[maybe_unused]] wl_array *names) { }
};
VirtualOutputManager::VirtualOutputManager()
@ -36,7 +36,7 @@ class VirtualOutput
public:
explicit VirtualOutput(struct ::treeland_virtual_output_v1 *object);
void virtual_output_v1_outputs(const QString &name, wl_array *outputs)
void virtual_output_v1_outputs(const QString &name, [[maybe_unused]] wl_array *outputs)
{
qInfo() << "Screen group name: " << name;
}

View File

@ -13,11 +13,11 @@
]
},
"locked": {
"lastModified": 1737432823,
"narHash": "sha256-pty5k1MQ9Fh68dscINllJ3Df3mzUgcB0HgBGFvw1Xgs=",
"lastModified": 1753066592,
"narHash": "sha256-jtFBL0yT1fBwatqvRuCvp0LjKOChU4YGmZvMpIIrAmE=",
"owner": "linuxdeepin",
"repo": "ddm",
"rev": "4cfcaf4184a47780b248ea9a43e38563ae0d55ab",
"rev": "e3a27b23cefe51adbfab973043b26959136ea4ad",
"type": "github"
},
"original": {
@ -61,11 +61,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1739866667,
"narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=",
"lastModified": 1752950548,
"narHash": "sha256-NS6BLD0lxOrnCiEOcvQCDVPXafX1/ek1dfJHX1nUIzc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680",
"rev": "c87b95e25065c028d31a94f06a62927d18763fdf",
"type": "github"
},
"original": {
@ -75,41 +75,13 @@
"type": "github"
}
},
"qwlroots": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nix-filter": [
"nix-filter"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1739876530,
"narHash": "sha256-nYLzX1MJ8/R5lSc/m0I/BnjXLjyJWQd4t1ucUfQvmJY=",
"owner": "vioken",
"repo": "qwlroots",
"rev": "6e2ec4e6d7dce46232a11dd1f12adf5f6106f41b",
"type": "github"
},
"original": {
"owner": "vioken",
"repo": "qwlroots",
"type": "github"
}
},
"root": {
"inputs": {
"ddm": "ddm",
"flake-utils": "flake-utils",
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs",
"qwlroots": "qwlroots",
"treeland-protocols": "treeland-protocols",
"waylib": "waylib"
"treeland-protocols": "treeland-protocols"
}
},
"systems": {
@ -152,35 +124,6 @@
"repo": "treeland-protocols",
"type": "github"
}
},
"waylib": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nix-filter": [
"nix-filter"
],
"nixpkgs": [
"nixpkgs"
],
"qwlroots": [
"qwlroots"
]
},
"locked": {
"lastModified": 1740038587,
"narHash": "sha256-oPeJh/0jSWEk07p8MjkNj1N73VXHDvX5LKZ7vdJP9zs=",
"owner": "vioken",
"repo": "waylib",
"rev": "327cfe62d681ff188c6b3177120146c047128bb6",
"type": "github"
},
"original": {
"owner": "vioken",
"repo": "waylib",
"type": "github"
}
}
},
"root": "root",

View File

@ -5,19 +5,6 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
qwlroots = {
url = "github:vioken/qwlroots";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.nix-filter.follows = "nix-filter";
};
waylib = {
url = "github:vioken/waylib";
inputs.qwlroots.follows = "qwlroots";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.nix-filter.follows = "nix-filter";
};
ddm = {
url = "github:linuxdeepin/ddm";
inputs.nixpkgs.follows = "nixpkgs";
@ -32,49 +19,19 @@
};
};
outputs = { self, nixpkgs, flake-utils, nix-filter, waylib, ddm, qwlroots, treeland-protocols }@input:
outputs = { self, nixpkgs, flake-utils, nix-filter, ddm, treeland-protocols }@input:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" "riscv64-linux" ]
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
treeland = pkgs.qt6Packages.callPackage ./nix {
nix-filter = nix-filter.lib;
qwlroots = qwlroots.packages.${system}.default;
waylib = waylib.packages.${system}.default.override {
debug = false;
};
ddm = ddm.packages.${system}.default;
treeland-protocols = treeland-protocols.packages.${system}.default;
};
in
{
rec {
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
{
imports = [ "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ];
# TODO: allow set Environment in services.seatd
users.groups.seat = { };
systemd.services.seatd = {
description = "Seat management daemon";
documentation = [ "man:seatd(1)" ];
wantedBy = [ "multi-user.target" ];
restartIfChanged = false;
serviceConfig = {
Type = "notify";
NotifyAccess = "all";
SyslogIdentifier = "seatd";
ExecStart = "${pkgs.sdnotify-wrapper}/bin/sdnotify-wrapper ${pkgs.seatd.bin}/bin/seatd -n 1 -u dde -g dde -l debug";
RestartSec = 1;
Restart = "always";
Environment = "SEATD_VTBOUND=0";
};
};
environment.systemPackages = with pkgs; [
foot
gdb
@ -200,10 +157,16 @@
];
};
packages = {
default = treeland;
qemu = self.nixosConfigurations.${system}.vm.config.system.build.vm;
};
packages = (import ./default.nix {
inherit pkgs nix-filter;
ddm = ddm.packages.${system}.default;
treeland-protocols = treeland-protocols.packages.${system}.default;
}) // {
qemu = self.nixosConfigurations.${system}.vm.config.system.build.vm;
};
treeland = packages.default;
apps.qemu = {
type = "app";
@ -212,14 +175,27 @@
devShells.default = pkgs.mkShell {
packages = with pkgs; [
# For submodule build
libinput
# For submodule waylib and qwlroots
wayland
wlroots
wayland-protocols
wlr-protocols
vulkan-loader
xorg.libXdmcp
xorg.xcbutilerrors
seatd
wlroots_0_19
mesa
libdrm
vulkan-loader
seatd
];
inputsFrom = [
self.packages.${system}.default
self.packages.${system}.treeland.override {
#It's submodule, prevent infinite loop calls
waylib = null;
qwlroot = null;
}
];
shellHook =
@ -230,8 +206,8 @@
''
#export QT_LOGGING_RULES="*.debug=true;qt.*.debug=false"
#export WAYLAND_DEBUG=1
export QT_PLUGIN_PATH=${makeQtpluginPath (with pkgs.qt6; [ qtbase qtdeclarative qtquick3d qtimageformats qtwayland qt5compat qtsvg ])}
export QML2_IMPORT_PATH=${makeQmlpluginPath (with pkgs; with qt6; [ qtdeclarative qtquick3d qt5compat deepin.dtk6declarative ] )}
export QT_PLUGIN_PATH=${makeQtpluginPath (with pkgs.qt6; [ qtbase qtdeclarative qtimageformats qtwayland qtsvg ])}
export QML2_IMPORT_PATH=${makeQmlpluginPath (with pkgs; with qt6; [ qtdeclarative deepin.dtk6declarative ] )}
export QML_IMPORT_PATH=$QML2_IMPORT_PATH
'';
};

View File

@ -2,6 +2,4 @@ add_subdirectory(dbus)
add_subdirectory(dconfig)
add_subdirectory(systemd)
add_subdirectory(wayland-sessions)
add_subdirectory(portal)
add_subdirectory(polkit-1)
add_subdirectory(cmake)

View File

@ -276,6 +276,183 @@
"description[zh_CN]": "当没有设置壁纸时,设置默认显示的壁纸",
"permissions": "readwrite",
"visibility": "public"
},
"workspaceThumbHeight": {
"value": 144,
"serial": 0,
"flags": ["global"],
"name": "Workspace thumbnail height",
"name[zh_CN]": "工作区缩略图高度",
"description": "Workspace thumbnail height",
"description[zh_CN]": "工作区缩略图高度",
"permissions": "readonly",
"visibility": "private"
},
"workspaceThumbMargin": {
"value": 20,
"serial": 0,
"flags": ["global"],
"name": "Workspace thumbnail margin",
"name[zh_CN]": "工作区缩略图边距",
"description": "Workspace thumbnail margin",
"description[zh_CN]": "工作区缩略图边距",
"permissions": "readonly",
"visibility": "private"
},
"workspaceThumbCornerRadius": {
"value": 8,
"serial": 0,
"flags": ["global"],
"name": "Workspace thumbnail corner radius",
"name[zh_CN]": "工作区缩略图圆角弧度",
"description": "Workspace thumbnail corner radius",
"description[zh_CN]": "工作区缩略图圆角弧度",
"permissions": "readonly",
"visibility": "private"
},
"highlightBorderWidth": {
"value": 4,
"serial": 0,
"flags": ["global"],
"name": "Highlight border width",
"name[zh_CN]": "高亮边框宽度",
"description": "Highlight border width",
"description[zh_CN]": "高亮边框宽度",
"permissions": "readonly",
"visibility": "private"
},
"minMultitaskviewSurfaceHeight": {
"value": 232,
"serial": 0,
"flags": ["global"],
"name": "Multitask view surface minimal height",
"name[zh_CN]": "多任务视图表面最小高度",
"description": "Multitask view surface minimal height",
"description[zh_CN]": "多任务视图表面最小高度",
"permissions": "readonly",
"visibility": "private"
},
"titleBoxCornerRadius": {
"value": 8,
"serial": 0,
"flags": ["global"],
"name": "Title box corner radius",
"name[zh_CN]": "标题框圆角弧度",
"description": "Title box corner radius",
"description[zh_CN]": "标题框圆角弧度",
"permissions": "readonly",
"visibility": "private"
},
"normalWindowHeight": {
"value": 720,
"serial": 0,
"flags": ["global"],
"name": "Normal window height",
"name[zh_CN]": "正常窗口高度",
"description": "Normal window height",
"description[zh_CN]": "正常窗口高度",
"permissions": "readonly",
"visibility": "private"
},
"windowHeightStep": {
"value": 15,
"serial": 0,
"flags": ["global"],
"name": "Window height step",
"name[zh_CN]": "窗口高度梯度",
"description": "Window height step",
"description[zh_CN]": "窗口高度梯度",
"permissions": "readonly",
"visibility": "private"
},
"multitaskviewPaddingOpacity": {
"value": 0.1,
"serial": 0,
"flags": ["global"],
"name": "Multitaskview padding opacity",
"name[zh_CN]": "多任务视图内边距不透明度",
"description": "Multitask view padding opacity",
"description[zh_CN]": "多任务视图内边距不透明度",
"permissions": "readonly",
"visibility": "private"
},
"multitaskviewAnimationDuration": {
"value": 300,
"serial": 0,
"flags": ["global"],
"name": "Multitaskview animation duration",
"name[zh_CN]": "多任务视图动画时长",
"description": "Multitaskview animation duration",
"description[zh_CN]": "多任务视图动画时长",
"permissions": "readonly",
"visibility": "private"
},
"multitaskviewEasingCurveType": {
"value": 22,
"serial": 0,
"flags": ["global"],
"name": "Multitaskview easing curve type",
"name[zh_CN]": "多任务视图缓动曲线类型",
"description": "Multitaskview easing curve type, enumerate value of QEasingCurve::Type",
"description[zh_CN]": "多任务视图缓动曲线类型其值为QEasingCurve::Type类型的枚举值",
"permissions": "readonly",
"visibility": "private"
},
"multitaskviewTopContentMargin": {
"value": 40,
"serial": 0,
"flags": ["global"],
"name": "Multitaskview top content margin",
"name[zh_CN]": "多任务视图内容顶边距",
"description": "Multitaskview top content margin",
"description[zh_CN]": "多任务视图内容顶边距",
"permissions": "readonly",
"visibility": "private"
},
"multitaskviewBottomContentMargin": {
"value": 60,
"serial": 0,
"flags": ["global"],
"name": "Multitaskview bottom content margin",
"name[zh_CN]": "多任务视图内容底边距",
"description": "Multitaskview bottom content margin",
"description[zh_CN]": "多任务视图内容底边距",
"permissions": "readonly",
"visibility": "private"
},
"multitaskviewHorizontalMargin": {
"value": 20,
"serial": 0,
"flags": ["global"],
"name": "Multitaskview horizontal margin",
"name[zh_CN]": "多任务视图横向边距",
"description": "Multitaskview horizontal margin",
"description[zh_CN]": "多任务视图横向边距",
"permissions": "readonly",
"visibility": "private"
},
"multitaskviewCellPadding": {
"value": 12,
"serial": 0,
"flags": ["global"],
"name": "Multitaskview cell padding",
"name[zh_CN]": "多任务视图单元格间距",
"description": "Multitaskview cell padding",
"description[zh_CN]": "多任务视图单元格间距",
"permissions": "readonly",
"visibility": "private"
},
"multitaskviewLoadFactor": {
"value": 0.6,
"serial": 0,
"flags": ["global"],
"name": "Multitaskview load factor",
"name[zh_CN]": "多任务视图加载因子",
"description": "Multitaskview load factor",
"description[zh_CN]": "多任务视图加载因子",
"permissions": "readonly",
"visibility": "private"
}
}
}

View File

@ -1,4 +0,0 @@
install(FILES
"org.freedesktop.login1.rules"
DESTINATION "${CMAKE_INSTALL_DATADIR}/polkit-1/rules.d/"
)

View File

@ -1,5 +0,0 @@
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.manage" && subject.user == "dde") {
return polkit.Result.YES;
}
});

View File

@ -1,5 +0,0 @@
install(FILES
"dde-portals.conf"
DESTINATION
"${CMAKE_INSTALL_SYSCONFDIR}/xdg-desktop-portal"
)

View File

@ -1,3 +0,0 @@
[preferred]
default=dde
org.freedesktop.impl.portal.ScreenCast=wlr

View File

@ -20,7 +20,7 @@ PartOf=dde-session-pre.target
Before=dde-session-pre.target
[Service]
ExecCondition=/bin/sh -c 'test "$XDG_SESSION_DESKTOP" = "treeland-user" || exit 2'
ExecCondition=/bin/sh -c 'test "$TREELAND_RUN_MODE" = "user" || exit 2'
Type=dbus
BusName=org.deepin.Compositor1
UnsetEnvironment=DISPLAY

View File

@ -2,8 +2,9 @@
Description=Treeland shutdown session service
[Service]
ExecCondition=/bin/sh -c 'test "$XDG_SESSION_DESKTOP" = "treeland-user" || exit 2'
ExecCondition=/bin/sh -c 'test "$TREELAND_RUN_MODE" = "user" || exit 2'
Type=oneshot
ExecStart=/usr/bin/systemctl --user unset-environment XDG_SESSION_DESKTOP
ExecStart=/usr/bin/systemctl --user unset-environment DESKTOP_SESSION
ExecStart=/usr/bin/systemctl --user unset-environment XDG_SESSION_TYPE
ExecStart=/usr/bin/systemctl --user unset-environment TREELAND_RUN_MODE

View File

@ -11,6 +11,13 @@ After=seatd.service
User=dde
Environment=LIBSEAT_BACKEND=seatd
Environment=DSG_APP_ID=org.deepin.dde.treeland
Environment=ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer
# For Debug: if enable asan, you can't get it's log from journalctl, so ensure the log to a file
Environment=ASAN_OPTIONS=log_path=/tmp/treeland-asan:detect_leaks=0:abort_on_error=1:symbolize=1
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/treeland.sh --lockscreen
Restart=on-failure
RestartSec=1s
# Disable logs from treeland.sh to avoid duplicate entries in journalctl
# since exec replaces the process, logs would appear from both treeland.sh and treeland
StandardOutput=null
StandardError=null

View File

@ -1,5 +1,6 @@
configure_file(treeland-user.desktop.in treeland-user.desktop)
configure_file(treeland.desktop.in treeland.desktop)
configure_file(treeland-user-wrapper.in treeland-user-wrapper)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/treeland.desktop
@ -10,3 +11,8 @@ install(FILES
${CMAKE_CURRENT_BINARY_DIR}/treeland-user.desktop
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions"
)
install(PROGRAMS
${CMAKE_CURRENT_BINARY_DIR}/treeland-user-wrapper
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)

View File

@ -0,0 +1,5 @@
#!/bin/bash
export TREELAND_RUN_MODE=user
exec ${CMAKE_INSTALL_FULL_BINDIR}/dde-session

View File

@ -1,7 +1,7 @@
[Desktop Entry]
Name=Treeland
Name=Treeland User
Comment=This session is DDE single wayland
Exec=${CMAKE_INSTALL_FULL_BINDIR}/dde-session
Exec=${CMAKE_INSTALL_FULL_BINDIR}/treeland-user-wrapper
TryExec=${CMAKE_INSTALL_FULL_BINDIR}/treeland
Type=Application
DesktopNames=Treeland

View File

@ -3,6 +3,7 @@
lib,
nix-filter,
cmake,
ninja,
extra-cmake-modules,
pkg-config,
wayland-scanner,
@ -13,27 +14,27 @@
qtimageformats,
qtwayland,
qtsvg,
qwlroots,
ddm,
deepin,
waylib,
wayland,
wayland-protocols,
wlr-protocols,
wlroots_0_19,
treeland-protocols,
pixman,
pam,
libxcrypt,
libinput,
jemalloc,
nixos-artwork,
qwlroots,
waylib,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "treeland";
version = "0.2.2";
version = "0.5-unstable";
src = nix-filter.filter {
src = nix-filter.lib.filter {
root = ./..;
exclude = [
@ -42,7 +43,7 @@ stdenv.mkDerivation (finalAttrs: {
"LICENSES"
"README.md"
"README.zh_CN.md"
(nix-filter.matchExt "nix")
(nix-filter.lib.matchExt "nix")
];
};
@ -55,8 +56,11 @@ stdenv.mkDerivation (finalAttrs: {
done
'';
depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [
cmake
ninja
extra-cmake-modules
pkg-config
wayland-scanner
@ -70,29 +74,31 @@ stdenv.mkDerivation (finalAttrs: {
qtimageformats
qtwayland
qtsvg
qwlroots
ddm
deepin.dtk6core
deepin.dtk6declarative
deepin.dtk6systemsettings
waylib
wayland
wayland-protocols
wlr-protocols
treeland-protocols
wlroots_0_19
pixman
pam
libxcrypt
libinput
jemalloc
qwlroots
waylib
];
cmakeFlags = [
"-DQT_IMPORTS_DIR=${placeholder "out"}/${qtbase.qtQmlPrefix}"
"-DCMAKE_INSTALL_SYSCONFDIR=${placeholder "out"}/etc"
"-DSYSTEMD_SYSTEM_UNIT_DIR=${placeholder "out"}/lib/systemd/system"
"-DSYSTEMD_SYSUSERS_DIR=${placeholder "out"}/lib/sysusers.d"
"-DSYSTEMD_TMPFILES_DIR=${placeholder "out"}/lib/tmpfiles.d"
"-DDBUS_CONFIG_DIR=${placeholder "out"}/share/dbus-1/system.d"
(lib.cmakeFeature "QT_IMPORTS_DIR" "${placeholder "out"}/${qtbase.qtQmlPrefix}")
(lib.cmakeFeature "CMAKE_INSTALL_SYSCONFDIR" "${placeholder "out"}/etc")
(lib.cmakeFeature "SYSTEMD_SYSTEM_UNIT_DIR" "${placeholder "out"}/lib/systemd/system")
(lib.cmakeFeature "SYSTEMD_SYSUSERS_DIR" "${placeholder "out"}/lib/sysusers.d")
(lib.cmakeFeature "SYSTEMD_TMPFILES_DIR" "${placeholder "out"}/lib/tmpfiles.d")
(lib.cmakeFeature "DBUS_CONFIG_DIR" "${placeholder "out"}/share/dbus-1/system.d")
(lib.cmakeBool "WITH_SUBMODULE_WAYLIB" false)
];
env.PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";

View File

@ -0,0 +1,3 @@
# Don't index SpecStory auto-save files, but allow explicit context inclusion via @ references
.specstory/**

3
qwlroots/.envrc Normal file
View File

@ -0,0 +1,3 @@
watch_file default.nix
watch_file nix/default.nix
use flake

View File

@ -0,0 +1,32 @@
name: Build on archlinux
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
container:
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- uses: actions/checkout@v4
- name: Run in container
run: |
pacman-key --init
pacman -Syu --noconfirm
- name: Install dep
run: |
pacman -Syu --noconfirm qt6-base cmake pkgconfig wlroots0.19 pixman wayland-protocols wlr-protocols clazy
pacman -Syu --noconfirm clang ninja
- name: Configure CMake
run: |
mkdir -p ${{github.workspace}}/build
cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_CXX_COMPILER=clazy
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build

View File

@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
# SPDX-License-Identifier: CC0-1.0
name: REUSE Compliance Check
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v5

68
qwlroots/.gitignore vendored Normal file
View File

@ -0,0 +1,68 @@
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# QtCreator 4.8< compilation database
compile_commands.json
# QtCreator local machine specific files for imported projects
*creator.user*
build*/
# nix
.direnv/
result
# clangd
.cache/
# vscode
.vscode/
qwlroots.code-workspace
# cursor
.specstory

3
qwlroots/.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "wlroots"]
path = wlroots
url = https://gitlab.freedesktop.org/wlroots/wlroots.git

View File

@ -0,0 +1,34 @@
test_build:
steps:
- link_package:
source_project: vioken
source_package: %{SCM_REPOSITORY_NAME}
target_project: vioken:CI
- configure_repositories:
project: vioken:CI
repositories:
- name: deepin_ci
paths:
- target_project: vioken
target_repository: deepin_develop
architectures:
- x86_64
- aarch64
- name: debian
paths:
- target_project: vioken
target_repository: Debian_Sid
architectures:
- x86_64
filters:
event: pull_request
commit_build:
steps:
- trigger_services:
project: vioken
package: %{SCM_REPOSITORY_NAME}
filters:
event: push

View File

@ -0,0 +1,41 @@
test_build:
steps:
- link_package:
source_project: home:rewine:vioken
source_package: %{SCM_REPOSITORY_NAME}
target_project: home:rewine:vioken:CI
- configure_repositories:
project: home:rewine:vioken:CI
repositories:
- name: Arch
paths:
- target_project: home:rewine:vioken
target_repository: Arch
architectures:
- x86_64
#- name: Fedora_Rawhide
# paths:
# - target_project: home:rewine:vioken
# target_repository: Fedora_Rawhide
# architectures:
# - x86_64
- name: openSUSE_Tumbleweed
paths:
- target_project: home:rewine:vioken
target_repository: openSUSE_Tumbleweed
architectures:
- x86_64
- aarch64
filters:
event: pull_request
commit_build:
steps:
- trigger_services:
project: home:rewine:vioken
package: %{SCM_REPOSITORY_NAME}
filters:
event: push

34
qwlroots/.reuse/dep5 Normal file
View File

@ -0,0 +1,34 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: qwlroots
Upstream-Contact: JiDe Zhang <zccrs@live.com>
Source: https://github.com/vioken/qwlroots
# ci
Files: .github/* .obs/*.yml garnix.yaml
Copyright: None
License: CC0-1.0
# Project file
Files: *.cmake *CMakeLists.txt *.pc.in *cmake.in .gitignore .cursorindexingignore .cursor/rules/*.mdc .gitmodules
Copyright: None
License: CC0-1.0
# Simple header files, only used to include qwinputdevice.h
Files: */qwkeyboard.h */qwpointer.h */qwswitch.h */qwtablet.h */qwtabletpad.h */qwtouch.h
Copyright: None
License: CC0-1.0
# README and documentation
Files: README.md README.zh_CN.md doc/ai/*.md
Copyright: JiDe Zhang
License: CC-BY-4.0
# Nix Develop files
Files: *.nix .envrc flake.lock
Copyright: None
License: CC0-1.0
# deb package
Files: debian/*
Copyright: 2023 rewine <luhongxu@outlook.com>
License: Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

40
qwlroots/CMakeLists.txt Normal file
View File

@ -0,0 +1,40 @@
cmake_minimum_required(VERSION 3.21)
project(QWlroots
VERSION 0.5.3
LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
option(PREFER_QT_5 "Prefer to use Qt 5 even if we have Qt 6" OFF)
option(USE_WLROOTS_19 "Use wlroots 0.19 version" ON)
option(QWLROOTS_USE_PERCOMPILE_HEADERS "Use precompile headers to build qwlroots" OFF)
option(DISABLE_WLR_PROTOCOLS "Disable support for wlr protocols, such as wlr-layer-shell" OFF)
option(DISABLE_XWAYLAND "Disable the xwayland support" OFF)
if(PREFER_QT_5)
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core)
else()
find_package(QT NAMES Qt6 QUIET COMPONENTS Core)
if (NOT QT_FOUND)
message(FATAL_ERROR "Not found Qt6, set `PREFER_QT_5` option if you want to use Qt5")
endif()
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
include(PackageVersionHelper)
include(WaylandScannerHelpers)
# For Unix/Linux
include(GNUInstallDirs)
add_subdirectory(src)
enable_testing()
add_subdirectory(tests)
add_subdirectory(examples)

View File

@ -0,0 +1,24 @@
{
"version": 3,
"configurePresets": [
{
"name": "ci",
"displayName": "CI Build Config",
"description": "Build configuration with warnings as errors",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Werror",
"CMAKE_C_FLAGS": "-Wall -Wextra -Werror"
}
}
],
"buildPresets": [
{
"name": "ci",
"configurePreset": "ci",
"jobs": 0
}
]
}

View File

@ -0,0 +1,61 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,156 @@
Creative Commons Attribution 4.0 International
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors.
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensors permission is not necessary for any reasonfor example, because of any applicable exception or limitation to copyrightthen that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public.
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part; and
B. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. Downstream recipients.
A. Offer from the Licensor Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.

View File

@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

187
qwlroots/README.md Normal file
View File

@ -0,0 +1,187 @@
# qwlroots
## Language
[简体中文](./README.zh_CN.md)
## Introduction
qwlroots is a binding of [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots) that provides a Qt style development interface. It aims to simplify the process of calling wlroots API within Qt projects. In qwlroots, each wlroots struct is wrapped as a C++ class with corresponding member functions. Additionally, wl_signals in Wayland are wrapped as Qt signals.
## Supported wlroots versions
As wlroots is still under development and has not yet released its 1.0 version, significant changes may occur at any time. Therefore, the latest code of qwlroots is only guaranteed to be compatible with the latest version of wlroots and the next release version (i.e., the version currently in development); compatibility with historical versions is not guaranteed. Similarly, like wlroots, qwlroots currently does not provide long-term support for interface compatibility.
Currently, qwlroots is compatible with the following versions of wlroots: 0.18.x, 0.19.x
## Supported Environments
* Arch Linux
* Debian
* deepin
* openSUSE
* NixOS
> Other environments have not been tested yet.
## Build
Step 1: Compile and Install wlroots
Follow the instructions in [building wlroots](https://gitlab.freedesktop.org/wlroots/wlroots#building) to compile and install wlroots.
> You can also install wlroots using a system package manager, but pay attention to the version.
Step 2: Install Dependencies
For Debian
````shell
apt install pkg-config cmake qt6-base-private-dev qt6-base-dev-tools wayland-protocols libpixman-1-dev
````
For Arch Linux
````shell
pacman -Syu --noconfirm qt6-base cmake pkgconfig pixman wayland-protocols ninja
````
Step 3: Run the Following Commands
```shell
cmake -B build
cmake --build build
```
We also use the Open Build Service and Garnix to provide automated build and testing services for openSUSE, deepin, and NixOS. See the [openSUSE](https://build.opensuse.org/package/show/home:rewine:vioken/qwlroots), [deepin](https://build.deepin.com/package/show/vioken/qwlroots) and [NixOS](https://garnix.io/docs/caching) for package downloads.
## How to contribute
We assume the you have already had experience with `Qt` and `wlroots` libraries. To better integrate Qt with wlroots, qwlroots follows the Qt specifications in terms of interface style, adheres to wlroots' design philosophy regarding low-level design concepts (e.g., module separation), and adopts Qt's "encapsulation + hierarchy" design philosophy for high-level components that are not directly related to wlroots.
You are free to submit as many code contributions to this project as you like, as long as you follow the design philosophy of qwlroots and the guidelines below.
### Coding Style
* When modifying existing code, adhere to the current coding style.
* There is no absolute right or wrong code style; consider the project as a whole rather than focusing on small parts.
### Code Quality
* Simplicity and understandability come first.
* Add comments in important areas, whether you are modifying or adding code.
* Security > Compatibility > Scalability >= Performance
### Commit Guidelines
* Commit Steps:
1. First, you need to log in to your GitHub account and fork this project.
2. Use `git clone` to get the forked project locally
3. Push new commits to your project with `git push`
4. Submit your code to the upstream project with the "Pull Request" function on Github.
* Commit Message Guidelines: Follow the conventions used in Qt projects and write in English. Be sure to clearly describe "what the commit does" and "why this approach was taken."
* Each commit should perform a single task; the smaller the changes to the code, the more likely the commit will be accepted. For large code changes, try to split the commit into multiple smaller commits (while satisfying the principles of git commits).
* Please conduct testing and code reviews on your own before submitting your code, and only submit the pull request after confirming that the code is error-free.
## Wrapping Coverage Status
qwlroots provides Qt-style bindings for wlroots types. The following table shows the current wrapping coverage based on wlroots 0.19.0:
| Category | Wrapped | Total Available | Coverage |
| --------------- | ------------ | --------------- | --------------- |
| Types | 67 | 74 | 90.5% |
| Util | 3 | 6 | 50.0% |
| Render | 5 | 14 | 35.7% |
| Interfaces | 9 | 9 | 100.0% |
| **Total** | **83** | **103** | **80.6%** |
### Unwrapped Types (as of wlroots 0.19.0)
The following wlroots types are not yet wrapped in qwlroots:
**Types (20 remaining):**
- alpha_modifier_v1, color_management_v1, ext_data_control_v1, ext_image_capture_source_v1, ext_image_copy_capture_v1, foreign_toplevel_management_v1
- fractional_scale_v1, gamma_control_v1, linux_drm_syncobj_v1, output_swapchain_manager
- presentation_time, security_context_v1, server_decoration, tablet_tool, transient_seat_v1
- xdg_decoration_v1, xdg_dialog_v1, xdg_system_bell_v1, xdg_toplevel_icon_v1
**Util (3 remaining):**
- addon, edges, log, region, transform
**Render (9 remaining):**
- color, dmabuf, drm_format_set, drm_syncobj, gles2, interface, pass, pixman, vulkan
**Interfaces (9 remaining):**
- buffer, ext_image_capture_source_v1, keyboard, output, pointer, switch, tablet_pad, tablet_tool, touch
> Note: This analysis is based on the wlroots submodule at version 0.19.0. To update this information, run `python3 analyze_coverage.py` in the project root.
### How to Update Coverage Information
Use the provided analysis tool to calculate and update wrapping coverage:
```bash
# Run the coverage analysis script
python3 analyze_coverage.py
```
The script works by:
- Scanning `src/` directories for existing qwlroots wrappers
- Scanning `wlroots/include/wlr/` directories for available wlroots types
- Comparing the two sets to calculate coverage percentages
- Generating detailed lists of unwrapped types
The tool automatically handles naming conventions (e.g., `wlr_compositor.h``qwcompositor.h`) and outputs coverage statistics for each category (types, util, render, interfaces).
## Documentation for AI Assistants
The `doc/ai/` directory contains specialized documentation designed for AI assistants to understand and work with the qwlroots codebase:
- **[qwlroots-wrapping-patterns-best-practices-en.md](./doc/ai/qwlroots-wrapping-patterns-best-practices-en.md)**: Comprehensive English guide covering all four wrapping patterns (QW_CLASS_OBJECT, QW_CLASS_REINTERPRET_CAST, QW_CLASS_BOX, QW_CLASS_INTERFACE) with detailed examples and step-by-step instructions for adding new wrappers.
- **[qwlroots-wrapping-patterns-best-practices.md](./doc/ai/qwlroots-wrapping-patterns-best-practices.md)**: Chinese version of the wrapping patterns guide with the same comprehensive coverage.
These documents serve as reference materials for AI assistants when:
- Adding new wlroots type wrappers
- Understanding the project's architecture and design patterns
- Following consistent coding practices and naming conventions
- Implementing proper version compatibility handling
The AI documentation includes complete workflows, from updating the wlroots submodule to implementing and testing new wrappers, ensuring consistency and maintainability across the codebase.
## General Requirements
### When Wrapping a New wlroots Type
For detailed guidance on wrapping new wlroots types, please refer to our comprehensive [Wrapping Patterns Best Practices Guide](./doc/ai/qwlroots-wrapping-patterns-best-practices-en.md), which covers all four wrapping patterns and provides step-by-step instructions.
We also provide a demo [example of qw_abc](https://github.com/vioken/qwlroots/tree/master/tests/qwobject_test) in unit test for reference when wrapping a new wlroots type.
* First, check if this type provides signals. If so, wrap it with QW_CLASS_OBJECT; otherwise, wrap it with QW_CLASS_REINTERPRET_CAST.
* For wlr_abc, using QW_CLASS_OBJECT(abc) will declare a class named qw_abc based on qw_object(QObject).
* qw_abc provides a handle() function to access the `wlr_abc*` type and supports implicit conversion to the `wlr_abc*` type.
* qw_abc provides a from() function to acquire `qw_abc*` from `wlr_abc*`. If there is no corresponding qw_abc, a new instance will be created.
* qw_abc provides a get() function to acquire `qw_abc*` from `wlr_abc*`. If there is no corresponding qw_abc, it returns nullptr.
* qw_abc will automatically connect to wlr_abc's destroy signal (if it exists) and will be automatically destroyed while emitting the qt signal before_destroy when wlr_abc is destroyed.
* If qw_abc is explicitly destroyed, the wlr_abc handle will only be destroyed if the owner of the handle is qw_abc itself.
* qw_abc created by the from() function is not the owner of its handle; only qw_abc created by the create() function will be its handle's owner.
* QW_CLASS_REINTERPRET_CAST is essentially a cast from the handle. It does not allocate extra memory.
* For types with signals, you should add QW_OBJECT and Q_OBJECT macros to the class, and use QW_SIGNAL to bind signals.
* The first argument of the QW_SIGNAL it the name of signal, followed by the argument list of the signal itself.
* In the example of qw_abc, QW_SIGNAL(set_name, char *) forwards wlr_abc's events.set_name signal to qw::notify_set_name.
* The destroy signal is a special signal that is already handled in the base class qw_object; there is no need for manual binding.
* Use QW_FUNC_STATIC and QW_FUNC_MEMBER to bind functions. Functions should generally be public.
* The arguments of QW_FUNC_MEMBER are the function name, return type and argument list. The first argument is always the handle; there is no need to declare it.
* For example, `QW_FUNC_MEMBER(abc, sum, int)` will bind `int wlr_abc_sum(wlr_abc *)` to `int qw_abc::sum()`.
* QW_FUNC_STATIC differs from QW_FUNC_MEMBER in that the first argument is not the handle; it will declare a static function of class qw_abc.
* If the name of the function forwarded by QW_FUNC_STATIC contains create or get and the return type is the handle type, you should use the qw type as the return value type. For example, `QW_FUNC_STATIC(abc, create, qw_abc*, wl_display*)` will expand to `static qw_abc *qw_abc::create(wl_display *)`, which wraps the function `wlr_abc *wlr_abc_create(wl_display *)`. The return value will be automatically wrapped as a qw type.
* For classes that provide a destroy method, the destructor should generally be protected to prevent non-handle owners from calling it to destroy the handle. The destructor will be called automatically when the qw type is deleted (for cast types) or when the destructor of the qw type is invoked (for qw_object).

183
qwlroots/README.zh_CN.md Normal file
View File

@ -0,0 +1,183 @@
# qwlroots
## 选择语言
[English](./README.md)
## 简介
qwlroots 是一个 [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots) 的绑定,提供 Qt 风格的开发接口。其设计目标是简化在Qt项目中调用 wlroots API 的方式。在 qwlroots 中,每一个 wlroots struct 及其配套的函数被封装为一个 c++ class同时wayland 中的 wl_singal 被封装为 Qt 中的信号。
## 受支持的 wlroots 版本
由于 wlroots 还处于开发中,至今未发布 1.0 版本,可能会随时进行比较大的改动。因此,原则上 qwlroots 的最新代码仅保证兼容 wlroots 的最新版本和下一个即将发布的版本(即目前还处于开发中的版本),对于历史版本一概不保证兼容。同 wlroots 一样qwlroots 目前也不提供长期的接口兼容性保障。
当前 qwlroots 兼容的wlroots版本是 0.18.x, 0.19.x。
## 支持的环境
* Arch Linux
* Debian
* deepin
* openSUSE
* NixOS
> 其它环境未测试
## 构建
步骤一:编译安装 [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots#building)
> 亦可使用系统包管理器安装 wlroots (需注意版本)
步骤二:安装依赖
Debian
````shell
apt install pkg-config cmake qt6-base-private-dev qt6-base-dev-tools wayland-protocols libpixman-1-dev
````
Arch Linux
````shell
pacman -Syu --noconfirm qt6-base cmake pkgconfig pixman wayland-protocols ninja
````
步骤三:运行以下命令
```shell
cmake -B build
cmake --build build
```
此外我们使用 open build service 和 garnix 提供的自动化构建测试, 同时提供了 [openSUSE](https://build.opensuse.org/package/show/home:rewine:vioken/qwlroots), [deepin](https://build.deepin.com/package/show/vioken/qwlroots), [NixOS](https://garnix.io/docs/caching) 的软件包下载。
## 贡献指南
此项目默认您已经拥有 `Qt``wlroots`库的使用经验,为了能更好的融合 Qt 和 wlrootsqwlroots 在接口风格上遵守Qt的相关规范在底层的设计理念如模块划分上遵守 wlroots 的设计思想,上层与 wlroots 无直接关联的部分则遵守 Qt 的“封装+分层”的设计思想。
在遵守 qwlroots 的设计理念和以下几类要求的前提下,您可以自由地向此项目提交任意的代码贡献。
### 编码风格
* qwlroots 代码高度模板化,建议参考当前的代码风格
* 代码风格没有绝对的对与错,请顾全大局,而勿拘于小结
### 代码质量
* 代码以简单明了、容易理解为优先
* 无论是改动或新增代码,均需要在关键节点增加注释
* 安全性 > 兼容性 > 可扩展性 >= 性能
### 提交规范
* 提交步骤:
1. 首先需要登录您的 GitHub 帐号fork 此项目
2. 在本地使用 `git clone`拉取fork之后的项目
3. 将新的提交使用 `git push`推送到您的项目中
4. 在 GitHub 上使用 Pull Requese 功能提交您的代码到上游项目
* commit 信息规范:与 Qt 项目保持一致,统一使用英文。一定要准确描述出这个提交“做了什么”、“为什么要这样做”
* 一个 commit 只做一件事情,代码量改动越小的 commit 越容易被接受。对于较大的代码改动,尽量拆分为多个代码提交(满足 git commit 的原则为前提)
* 在提交代码之前请自行进行测试和代码 Review在确认代码无误后再提交 PR
## 封装覆盖率状态
qwlroots 为 wlroots 类型提供 Qt 风格的绑定。下表显示了基于 wlroots 0.19.0 的当前封装覆盖率:
| 分类 | 已封装 | 总可用数 | 覆盖率 |
| -------------- | ------------ | ------------- | --------------- |
| Types | 66 | 74 | 89.2% |
| Util | 3 | 6 | 50.0% |
| Render | 5 | 14 | 35.7% |
| Interfaces | 9 | 9 | 100.0% |
| **总计** | **83** | **103** | **80.6%** |
### 未封装的类型(截至 wlroots 0.19.0
以下 wlroots 类型尚未在 qwlroots 中封装:
**Types剩余 20 个):**
- alpha_modifier_v1, color_management_v1, ext_data_control_v1, ext_foreign_toplevel_list_v1
- ext_image_capture_source_v1, ext_image_copy_capture_v1, foreign_toplevel_management_v1
- fractional_scale_v1, gamma_control_v1, linux_drm_syncobj_v1, output_swapchain_manager
- presentation_time, security_context_v1, server_decoration, tablet_tool, transient_seat_v1
- xdg_decoration_v1, xdg_dialog_v1, xdg_system_bell_v1, xdg_toplevel_icon_v1
**Util剩余 3 个):**
- addon, edges, log, region, transform
**Render剩余 9 个):**
- color, dmabuf, drm_format_set, drm_syncobj, gles2, interface, pass, pixman, vulkan
**Interfaces剩余 9 个):**
- buffer, ext_image_capture_source_v1, keyboard, output, pointer, switch, tablet_pad, tablet_tool, touch
> 注意:此分析基于版本 0.19.0 的 wlroots 子模块。要更新此信息,请在项目根目录运行 `python3 analyze_coverage.py`
### 如何更新覆盖率信息
使用提供的分析工具来计算和更新封装覆盖率:
```bash
# 运行覆盖率分析脚本
python3 analyze_coverage.py
```
脚本工作原理:
- 扫描 `src/` 目录中现有的 qwlroots 封装
- 扫描 `wlroots/include/wlr/` 目录中可用的 wlroots 类型
- 比较两个集合来计算覆盖率百分比
- 生成详细的未封装类型列表
工具自动处理命名约定(如 `wlr_compositor.h``qwcompositor.h`并输出各个分类types、util、render、interfaces的覆盖率统计。
## AI 助手文档
`doc/ai/` 目录包含专为 AI 助手设计的文档,用于理解和使用 qwlroots 代码库:
- **[qwlroots-wrapping-patterns-best-practices.md](./doc/ai/qwlroots-wrapping-patterns-best-practices.md)**: 中文版综合指南涵盖所有四种封装模式QW_CLASS_OBJECT、QW_CLASS_REINTERPRET_CAST、QW_CLASS_BOX、QW_CLASS_INTERFACE包含详细示例和添加新封装的分步说明。
- **[qwlroots-wrapping-patterns-best-practices-en.md](./doc/ai/qwlroots-wrapping-patterns-best-practices-en.md)**: 英文版封装模式指南,内容与中文版相同。
这些文档作为 AI 助手的参考资料,用于:
- 添加新的 wlroots 类型封装
- 理解项目的架构和设计模式
- 遵循一致的编码实践和命名约定
- 实现适当的版本兼容性处理
AI 文档包含完整的工作流程,从更新 wlroots 子模块到实现和测试新封装,确保代码库的一致性和可维护性。
## 一些或许是通用的要求
### 封装新的 wlroots 类型时
关于封装新的 wlroots 类型的详细指导,请参考我们的综合性 [封装模式最佳实践指南](./doc/ai/qwlroots-wrapping-patterns-best-practices.md),该指南涵盖了所有四种封装模式并提供了分步说明。
在单元测试中提供了一个 [qw_abc 的示例](https://github.com/vioken/qwlroots/tree/master/tests/qwobject_test), 可以作为使用 qwlroots 的参考。
* 首先检查这种类型是否提供信号,有信号的类型使用 QW_CLASS_OBJECT 封装,无信号类型使用 QW_CLASS_REINTERPRET_CAST 封装
* wlr_abc, 使用 QW_CLASS_OBJECT(abc) 会声明基于 qw_objectQObject的 qw_abc 类
* qw_abc 提供 handle() 函数访问 wlr_abc 类型,同时支持到 wlr_abc* 的隐式转换
* 提供 from 函数从 wlr_abc* 获取 qw_abc如果没有对应 qw_abc 则会创建一个
* 提供 get 函数从 wlr_abc* 获取 qw_abc如果没有对应 qw_abc 则返回 nullptr
* qw_abc 会自动连接 wlr_abc 的 destroy 信号(如果有),自动析构,并在销毁前发出 qt 信号 before_destroy
* 如果主动析构 qw_abc只有是 handle 的 owner 才会销毁 wlr_abc 类型
* from 函数创建的 qw_abc 都不是 handle 的 owner只有下文提到的 create 创建出的是 owner
* QW_CLASS_REINTERPRET_CAST 本质是对 handle 的强转,不分配额外内存
* 对于有信号类型,需要添加 QW_OBJECT 和 Q_OBJECT 宏,使用 QW_SIGNAL 进行信号绑定
* QW_SIGNAL 第一个参数是名字,之后是信号参数
* 在 qw_abc 例子中 QW_SIGNAL(set_name, char*) 将 wlr_abc 的 events.set_name 信号转为 qw::notify_set_name
* destroy 是比较特殊的信号,在 qw_object 基类中已经处理,无需手动绑定
* 对成员函数,使用 QW_FUNC_STATIC 和 QW_FUNC_MEMBER 进行绑定,它们通常应该是 public 的
* QW_FUNC_MEMBER 参数为函数名,返回值类型,和函数参数。其中函数参数第一个固定传入 handle, 不用填。
* 以 `QW_FUNC_MEMBER(abc, sum, int)` 为例,将 `int wlr_abc_sum(wlr_abc *)` 绑定到成员函数 `int qw_abc::sum()`
* QW_FUNC_STATIC 不同的地方是函数参数第一个传入的不是 handle会为 qw_abc 添加静态成员函数。
* 需要使用 QW_FUNC_STATIC 的函数如果名字有 create/get ,返回值是 handle 类型,应该直接填 qw 类型,比如 `QW_FUNC_STATIC(abc, create, qw_abc*, wl_display*)`, 将 `wlr_abc *wlr_abc_create(wl_display *)` 封装为 `static qw_abc *qw_abc::create(wl_display *)` 返回值自动转换
* 对于提供 destroy 方法的类,一般情况标记为 protected防止非 handle 的 owner 调用此函数销毁 wlr_abc 类型。该方法会在调用 delete强转类型或者析构函数qw_object类型时被自动调用。

View File

@ -0,0 +1,127 @@
#!/usr/bin/env python3
# Copyright (C) 2025 UnionTech Software Technology Co., Ltd.
# SPDX-License-Identifier: Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import os
import glob
def normalize_name(name):
"""标准化名称,处理下划线"""
return name.replace('_', '')
def get_qwlroots_wrapped():
"""获取qwlroots已封装的类型"""
wrapped = {}
# types目录
types_files = glob.glob("src/types/qw*.h")
wrapped['types'] = set()
for f in types_files:
name = os.path.basename(f).removeprefix('qw').removesuffix('.h') # 去掉qw前缀和.h后缀
wrapped['types'].add(normalize_name(name))
# util目录
util_files = glob.glob("src/util/qw*.h")
wrapped['util'] = set()
for f in util_files:
name = os.path.basename(f).removeprefix('qw').removesuffix('.h')
wrapped['util'].add(normalize_name(name))
# render目录
render_files = glob.glob("src/render/qw*.h")
wrapped['render'] = set()
for f in render_files:
name = os.path.basename(f).removeprefix('qw').removesuffix('.h')
wrapped['render'].add(normalize_name(name))
# interfaces目录
interface_files = glob.glob("src/interfaces/qw*.h")
wrapped['interfaces'] = set()
for f in interface_files:
name = os.path.basename(f).removeprefix('qw').removesuffix('.h')
wrapped['interfaces'].add(normalize_name(name))
return wrapped
def get_wlroots_available():
"""获取wlroots可用的类型"""
available = {}
# types目录
types_files = glob.glob("wlroots/include/wlr/types/wlr_*.h")
available['types'] = set()
for f in types_files:
name = os.path.basename(f)[4:-2] # 去掉wlr_前缀和.h后缀
available['types'].add(normalize_name(name))
# util目录
util_files = glob.glob("wlroots/include/wlr/util/*.h")
available['util'] = set()
for f in util_files:
name = os.path.basename(f)[:-2]
available['util'].add(normalize_name(name))
# render目录
render_files = glob.glob("wlroots/include/wlr/render/*.h")
available['render'] = set()
for f in render_files:
name = os.path.basename(f)[:-2]
if name.startswith('wlr_'):
name = name[4:] # 去掉wlr_前缀
available['render'].add(normalize_name(name))
# interfaces目录
interface_files = glob.glob("wlroots/include/wlr/interfaces/*.h")
available['interfaces'] = set()
for f in interface_files:
name = os.path.basename(f)[:-2]
if name.startswith('wlr_'):
name = name[4:] # 去掉wlr_前缀
available['interfaces'].add(normalize_name(name))
return available
def analyze_coverage():
wrapped = get_qwlroots_wrapped()
available = get_wlroots_available()
print("# qwlroots 封装覆盖率分析 (基于 wlroots 0.19.0)")
print()
total_wrapped = 0
total_available = 0
for category in ['types', 'util', 'render', 'interfaces']:
wrapped_set = wrapped.get(category, set())
available_set = available.get(category, set())
missing = available_set - wrapped_set
print(f"## {category.title()} 目录")
print(f"- 已封装: {len(wrapped_set)}")
print(f"- 可用总数: {len(available_set)}")
if len(available_set) > 0:
print(f"- 覆盖率: {len(wrapped_set)/len(available_set)*100:.1f}%")
else:
print(f"- 覆盖率: N/A")
if missing:
print(f"- 未封装的类型:")
for item in sorted(missing):
print(f" - {item}")
else:
print("- ✅ 所有类型都已封装")
print()
total_wrapped += len(wrapped_set)
total_available += len(available_set)
print(f"## 总体覆盖率")
print(f"- 总已封装: {total_wrapped}")
print(f"- 总可用: {total_available}")
if total_available > 0:
print(f"- 总覆盖率: {total_wrapped/total_available*100:.1f}%")
if __name__ == "__main__":
analyze_coverage()

View File

@ -0,0 +1,29 @@
function(add_cmake_module name library include_dir)
include(CMakePackageConfigHelpers)
configure_package_config_file(${PROJECT_SOURCE_DIR}/src/cmake/CMakeConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${name}Config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name}
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${name}ConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${name}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${name}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name}
)
endfunction()
function(add_pkgconfig_module name library include_dir depends)
# For cmake
include(CMakePackageConfigHelpers)
configure_file(${PROJECT_SOURCE_DIR}/src/cmake/pkgconfig.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${name}.pc
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${name}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
endfunction()

View File

@ -0,0 +1,25 @@
macro (setup_package_version_variables _packageName)
if (DEFINED ${_packageName}_VERSION)
string (REGEX MATCHALL "[0-9]+" _versionComponents "${${_packageName}_VERSION}")
list (LENGTH _versionComponents _len)
if (${_len} GREATER 0)
list(GET _versionComponents 0 ${_packageName}_VERSION_MAJOR)
endif()
if (${_len} GREATER 1)
list(GET _versionComponents 1 ${_packageName}_VERSION_MINOR)
endif()
if (${_len} GREATER 2)
list(GET _versionComponents 2 ${_packageName}_VERSION_PATCH)
endif()
if (${_len} GREATER 3)
list(GET _versionComponents 3 ${_packageName}_VERSION_TWEAK)
endif()
set (${_packageName}_VERSION_COUNT ${_len})
message(STATUS "setup ${_packageName}_VERSION: count ${_len}, major ${${_packageName}_VERSION_MAJOR}, minor ${${_packageName}_VERSION_MINOR}, patch ${${_packageName}_VERSION_MAJOR}")
else()
set (${_packageName}_VERSION_COUNT 0)
set (${_packageName}_VERSION "")
message(WARNING "setup version: ${_packageName}_VERSION not defined")
endif()
endmacro()

View File

@ -0,0 +1,30 @@
if(NOT DEFINED WAYLAND_PROTOCOLS_OUTPUTDIR)
set(WAYLAND_PROTOCOLS_OUTPUTDIR ${CMAKE_BINARY_DIR}/protocols)
file(MAKE_DIRECTORY ${WAYLAND_PROTOCOLS_OUTPUTDIR})
message(STATUS "Create wayland protocols outputdir: ${WAYLAND_PROTOCOLS_OUTPUTDIR}")
include_directories(${WAYLAND_PROTOCOLS_OUTPUTDIR})
else()
message(STATUS "Setting wayland protocols outputdir: ${WAYLAND_PROTOCOLS_OUTPUTDIR}")
endif()
function(ws_generate type protocols input_file output_name)
find_package(PkgConfig)
pkg_get_variable(WAYLAND_PROTOCOLS ${protocols} pkgdatadir)
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
if(NOT EXISTS ${input_file})
set(input_file ${WAYLAND_PROTOCOLS}/${input_file})
endif()
execute_process(COMMAND ${WAYLAND_SCANNER}
${type}-header
${input_file}
${WAYLAND_PROTOCOLS_OUTPUTDIR}/${output_name}.h
)
execute_process(COMMAND ${WAYLAND_SCANNER}
public-code
${input_file}
${WAYLAND_PROTOCOLS_OUTPUTDIR}/${output_name}.c
)
endfunction()

49
qwlroots/debian/changelog Normal file
View File

@ -0,0 +1,49 @@
qwlroots (0.5.4) unstable; urgency=medium
* feat: update wlroots and nixpkgs versions for qwlroots
* Improve the intelligence of cursor addition encapsulation
* Add wlroots 0.19 render types and protocol support
* fix: correct typo in build command description
* docs: add documentation for AI development
* chore: update gitignore for IDE environments
* ci: pin wlroots to 0.18 for Arch Linux GitHub Actions build
* Make the existing interface compatible with wlroots-0.19
-- rewine <luhongxu@deepin.org> Mon, 23 Jun 2025 17:34:11 +0800
qwlroots (0.5.3) unstable; urgency=medium
* Implement qw_idle_inhibitor_v1
* Do not explicitly build static lib
-- rewine <luhongxu@deepin.org> Thu, 20 Feb 2025 17:40:48 +0800
qwlroots (0.5.2) unstable; urgency=medium
* bump version to 0.5.2
-- Groveer <guoyao@uniontech.com> Tue, 26 Nov 2024 18:55:56 +0800
qwlroots (0.5.1) unstable; urgency=medium
* bump version to 0.5.1
-- Groveer <guoyao@uniontech.com> Fri, 22 Nov 2024 18:04:26 +0800
qwlroots (0.5.0) unstable; urgency=medium
* bump version to 0.5.0
-- Groveer <guoyao@uniontech.com> Thu, 21 Nov 2024 16:58:34 +0800
qwlroots (0.4.1) UNRELEASED; urgency=medium
* bump version to 0.4.1
-- Groveer <guoyao@uniontech.com> Mon, 11 Nov 2024 18:14:56 +0800
qwlroots (0.0.1) UNRELEASED; urgency=medium
* Initial continuous release
-- rewine <lhongxu@outlook.com> Wed, 19 Jul 2023 03:36:12 +0000

36
qwlroots/debian/control Normal file
View File

@ -0,0 +1,36 @@
Source: qwlroots
Priority: optional
Maintainer: rewine <lhongxu@outlook.com>
Build-Depends: debhelper-compat (= 13),
pkg-config,
cmake,
ninja-build,
qt6-base-private-dev,
qt6-base-dev-tools,
wayland-protocols,
wlr-protocols,
libwlroots-0.19-dev,
libpixman-1-dev,
libxcb-ewmh-dev,
libdrm-dev
Standards-Version: 4.6.0
Section: libs
Homepage: https://github.com/vioken/qwlroots.git
#Vcs-Browser: https://salsa.debian.org/debian/qwlroots
#Vcs-Git: https://salsa.debian.org/debian/qwlroots.git
Rules-Requires-Root: no
Package: qwlroots
Section: libdevel
Architecture: any
Multi-Arch: same
Depends:
${misc:Depends},
libwlroots-0.19-dev
Replaces: libqwlroots1
Description: Qt and QML bindings for wlroots
qwlroots is a binding of wlroots, which provides a Qt style development interface.
It aims to simplify wlroots API calling methods with Qt, and serve the needs of
calling wlroots within Qt projects.
.
This package contains the development headers and static library.

2435
qwlroots/debian/copyright Normal file

File diff suppressed because it is too large Load Diff

26
qwlroots/debian/rules Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
override_dh_auto_configure:
dh_auto_configure -- \
-GNinja \
-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

View File

@ -0,0 +1 @@
3.0 (native)

11
qwlroots/debian/watch Normal file
View File

@ -0,0 +1,11 @@
# Compulsory line, this is a version 4 file
version=4
# PGP signature mangle, so foo.tar.gz has foo.tar.gz.sig
#opts="pgpsigurlmangle=s%$%.sig%"
# GitHub hosted projects
opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%<project>-$1.tar.gz%" \
https://github.com/vioken/qwlroots/tags \
(?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate

29
qwlroots/default.nix Normal file
View File

@ -0,0 +1,29 @@
{ pkgs ? import <inxpkgs> { }, wlroots_master_src ? null , nix-filter }:
let
mkDate = longDate: (pkgs.lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in
rec {
qwlroots-qt6 = pkgs.qt6.callPackage ./nix {
inherit nix-filter;
wlroots = pkgs.wlroots_0_19;
};
qwlroots-qt5 = pkgs.libsForQt5.callPackage ./nix {
inherit nix-filter;
wlroots = pkgs.wlroots_0_19;
};
qwlroots-qt6-wlroots18 = qwlroots-qt6.override {
wlroots = pkgs.wlroots_0_18;
};
qwlroots-qt6-clang = qwlroots-qt6.override {
stdenv = pkgs.clangStdenv;
};
default = qwlroots-qt6;
}

View File

@ -0,0 +1,131 @@
# qw_color_manager_v1 Usage Guide
## Overview
The `qw_color_manager_v1` wrapper provides Qt-style bindings for wlroots' color management protocol v1 implementation. This protocol allows Wayland compositors to manage color spaces and image descriptions for surfaces.
## Version Requirements
**Important**: The color management v1 protocol is only available in wlroots 0.19.0 and later. The wrapper includes version guards to ensure compatibility:
```cpp
#if WLR_VERSION_MINOR >= 19
// Color management code here
#endif
```
## Available Classes
### qw_color_manager_v1
Main color manager class that handles the color management protocol.
**Static Methods:**
- `create(wl_display *display, uint32_t version, const wlr_color_manager_v1_options *options)` - Create a new color manager instance
**Member Methods:**
- `set_surface_preferred_image_description(wlr_surface *surface, const wlr_image_description_v1_data *data)` - Set preferred image description for a surface
### qw_image_description_v1_data
Utility class for working with image description data.
**Static Methods:**
- `get(wlr_surface *surface)` - Get image description data from a surface
## Basic Usage Example
```cpp
#include "types/qwcolormanagementv1.h"
// Check version availability
#if WLR_VERSION_MINOR >= 19
void setupColorManagement(wl_display *display) {
// Configure color manager features
wlr_color_manager_v1_options options = {};
options.features.icc_v2_v4 = true;
options.features.parametric = true;
// ... configure other features as needed
// Create color manager
auto *colorManager = qw_color_manager_v1::create(display, 1, &options);
if (!colorManager) {
qWarning("Failed to create color manager");
return;
}
// The color manager is now ready to handle color management requests
}
void setSurfaceColorSpace(wlr_surface *surface) {
// Get current image description
const auto *imageDesc = qw_image_description_v1_data::get(surface);
if (imageDesc) {
// Process image description data
qDebug("Surface has image description with transfer function: %u",
imageDesc->tf_named);
}
}
#endif // WLR_VERSION_MINOR >= 19
```
## Integration with Existing Code
The wrapper follows qwlroots patterns and integrates seamlessly with other Qt-style wlroots bindings:
```cpp
// In your compositor setup
void MyCompositor::initializeColorManagement() {
#if WLR_VERSION_MINOR >= 19
wlr_color_manager_v1_options options = {};
// Configure supported features based on your hardware/renderer capabilities
options.features.icc_v2_v4 = hasICCSupport();
options.features.parametric = hasParametricSupport();
m_colorManager = qw_color_manager_v1::create(m_display->handle(), 1, &options);
if (m_colorManager) {
qDebug("Color management v1 protocol enabled");
}
#else
qDebug("Color management v1 requires wlroots >= 0.19");
#endif
}
```
## Error Handling
Always check for version compatibility and handle creation failures:
```cpp
#if WLR_VERSION_MINOR >= 19
auto *manager = qw_color_manager_v1::create(display, version, &options);
if (!manager) {
// Handle creation failure
qWarning("Failed to create color manager - check options and display");
return false;
}
#else
qWarning("Color management v1 not available in this wlroots version");
return false;
#endif
```
## Testing
The wrapper includes comprehensive unit tests that automatically skip when the required wlroots version is not available:
```bash
# Run color management tests
ctest -R QWColorManagementV1
# All tests
ctest
```
## See Also
- [wlroots color management documentation](https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/include/wlr/types/wlr_color_management_v1.h)
- [Wayland color management protocol specification](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/color-management/color-management-v1.xml)
- [qwlroots wrapping patterns guide](./qwlroots-wrapping-patterns-best-practices-en.md)

View File

@ -0,0 +1,681 @@
# qwlroots Wrapping Patterns Best Practices Guide
## Overview
qwlroots is a Qt-style wrapper library for wlroots C interfaces, providing multiple wrapping patterns through a macro system to accommodate different types of wlroots structures. This document summarizes the main wrapping patterns used in the project and provides guidance for adding new class wrappers.
## Core Design Philosophy
1. **Qt-style Interface**: Follows Qt specification interface style
2. **Signal-Slot Mechanism**: Wraps wl_signal as Qt signals
3. **Memory Management**: Automatic object lifecycle and ownership handling
4. **Type Safety**: Uses C++ templates and concepts to ensure type safety
5. **Zero-cost Abstraction**: Provides zero-overhead wrapping in Release mode
## Wrapping Pattern Classification
### 1. QW_CLASS_OBJECT Pattern - Complete QObject-based Wrapping
**Use Cases**:
- wlroots structures contain signals (events field)
- Need complete object lifecycle management
- Require Qt signal-slot mechanism
**Features**:
- Inherits from `qw_object<Handle, Derive>`, indirectly inherits QObject
- Automatically connects wlroots destroy signals
- Supports signal binding and forwarding
- Provides complete memory management and ownership control
**Usage Example**:
```cpp
// Header file declaration
class QW_CLASS_OBJECT(compositor)
{
QW_OBJECT // Required macro, provides basic functionality
Q_OBJECT // Qt meta-object system
// Signal binding - converts wlroots signals to Qt signals
QW_SIGNAL(new_surface, wlr_surface*)
public:
// Static function binding - create function automatically returns qw_compositor*
QW_FUNC_STATIC(compositor, create, qw_compositor *, wl_display *display, uint32_t version, wlr_renderer *renderer)
};
class QW_CLASS_OBJECT(surface)
{
QW_OBJECT
Q_OBJECT
// Multiple signal bindings
QW_SIGNAL(client_commit)
QW_SIGNAL(commit)
QW_SIGNAL(new_subsurface, wlr_subsurface*)
QW_SIGNAL(map)
QW_SIGNAL(unmap)
public:
// Static functions - from/get functions
QW_FUNC_STATIC(surface, from_resource, qw_surface *, wl_resource *resource)
// Member function binding
QW_FUNC_MEMBER(surface, for_each_surface, void, wlr_surface_iterator_func_t iterator, void *user_data)
QW_FUNC_MEMBER(surface, has_buffer, bool)
QW_FUNC_MEMBER(surface, send_frame_done, void, const timespec *when)
QW_FUNC_MEMBER(surface, map, void)
QW_FUNC_MEMBER(surface, unmap, void)
};
```
**Key Macro Descriptions**:
- `QW_OBJECT`: Provides basic object functionality, must be in protected section
- `QW_SIGNAL(name, ...)`: Binds wlroots signals to Qt signals
- `QW_FUNC_STATIC`: Binds static functions, create/from/get functions automatically handle return types
- `QW_FUNC_MEMBER`: Binds member functions
### 2. QW_CLASS_REINTERPRET_CAST Pattern - Lightweight Type Conversion
**Use Cases**:
- wlroots structures don't contain signals
- Only need function wrapping, no object lifecycle management
- Pursue minimal memory overhead
**Features**:
- Zero-overhead wrapping based on `reinterpret_cast`
- No additional memory allocation
- No signal mechanism support
- Mainly used for utility classes and simple structures
**Usage Example**:
```cpp
class QW_CLASS_REINTERPRET_CAST(client_buffer)
{
public:
QW_FUNC_STATIC(client_buffer, get, qw_client_buffer *, wlr_buffer *buffer)
};
```
### 3. QW_CLASS_BOX Pattern - Value Type Wrapping
**Use Cases**:
- Simple data structures
- Need interoperability with Qt types
- Value semantic objects
**Features**:
- Contains actual data members
- Supports conversion with Qt types
- Value semantics, supports copy and assignment
**Usage Example**:
```cpp
class qw_box
{
public:
explicit qw_box() = default;
explicit qw_box(const wlr_box &box);
explicit qw_box(const QRect &box);
QRect toQRect();
operator wlr_box*();
private:
wlr_box m_handle;
};
```
### 4. QW_CLASS_INTERFACE Pattern - Interface Implementation Wrapping
**Use Cases**:
- Need to implement wlroots interfaces
- Provide callback function implementations
- Custom behavior extensions
**Features**:
- Template-based interface binding
- Automatic function pointer binding
- Supports virtual function overriding
**Usage Example**:
```cpp
class QW_CLASS_INTERFACE(output)
{
QW_INTERFACE_INIT(output)
// Interface function implementations
QW_INTERFACE(commit, bool, wlr_output_state *state)
QW_INTERFACE(set_cursor, bool, wlr_buffer *buffer, int hotspot_x, int hotspot_y)
protected:
// Implement specific interface functions
bool commit(wlr_output_state *state);
bool set_cursor(wlr_buffer *buffer, int hotspot_x, int hotspot_y);
};
```
## Directory Structure and File Naming Patterns
qwlroots' directory structure and file naming completely follow wlroots' organization, ensuring project structure consistency and maintainability.
### Directory Structure Correspondence
qwlroots' `src/` directory structure completely corresponds to wlroots' `include/wlr/` directory structure:
```
wlroots/include/wlr/ qwlroots/src/
├── types/ ←→ ├── types/
├── util/ ←→ ├── util/
├── render/ ←→ ├── render/
├── interfaces/ ←→ ├── interfaces/
├── backend/ ←→ ├── (backend-related files directly in src/)
└── xwayland/ ←→ └── (xwayland-related files in types/)
```
### File Naming Patterns
1. **Header File Naming**:
- wlroots: `wlr_compositor.h` → qwlroots: `qwcompositor.h`
- wlroots: `wlr_output.h` → qwlroots: `qwoutput.h`
- wlroots: `wlr_buffer.h` → qwlroots: `qwbuffer.h`
2. **Class Name Naming**:
- wlroots: `struct wlr_compositor` → qwlroots: `class qw_compositor`
- wlroots: `struct wlr_surface` → qwlroots: `class qw_surface`
3. **Directory Classification Patterns**:
- `types/`: Main Wayland protocol types and core objects
- `util/`: Utility classes and helper functions
- `render/`: Rendering-related types
- `interfaces/`: Interface implementation-related types
### Method for Finding Correspondences
When creating wrappers for new wlroots types:
1. **Locate Source File**: Find the corresponding header file in `wlroots/include/wlr/`
2. **Determine Directory**: Determine the location in qwlroots based on wlroots' directory structure
3. **Name Conversion**: Follow the `wlr_xxx.h``qwxxx.h` pattern for naming
**Example**:
```bash
# File in wlroots
wlroots/include/wlr/types/wlr_xdg_shell.h
# Corresponding qwlroots file should be
qwlroots/src/types/qwxdgshell.h
```
## Complete Workflow for Adding New Wrappers
When users request "add xxx class" or "add xxxx function", follow this workflow:
### Step 0: Update wlroots Submodule
Before starting any wrapping work, ensure the wlroots submodule is up to date:
```bash
# Enter wlroots submodule directory
cd wlroots
# Fetch latest tags and commits
git fetch --tags
# View latest version tags
git tag --sort=-version:refname | head -5
# Checkout to latest stable version (e.g., 0.19.0)
git checkout 0.19.0
# Return to project root
cd ..
# Commit submodule update
git add wlroots
git commit -m "submodule: update wlroots to latest version"
```
### Step 1: Locate Target Type in wlroots Submodule
Use the following methods to locate the type to be wrapped in the wlroots submodule:
```bash
# Find specific header files
find wlroots/include/wlr -name "*target_name*" -type f
# Search for struct definitions
grep -r "struct wlr_target_name" wlroots/include/wlr/
# View specific file content
cat wlroots/include/wlr/types/wlr_target_name.h
```
### Step 2: Determine Version Information
Find out which version introduced this type:
```bash
# View file commit history in wlroots directory
cd wlroots
git log --oneline --follow include/wlr/types/wlr_target_name.h
# View detailed information of specific commit
git show commit_hash
# Find earliest tag containing this commit
git tag --contains commit_hash --sort=version:refname | head -1
```
This information will be used to add version compatibility macros in qwlroots.
### Step 3: Analyze wlroots Structure
1. **Check for events field**:
- Has events field → Use `QW_CLASS_OBJECT`
- No events field → Use `QW_CLASS_REINTERPRET_CAST`
2. **Check if interface implementation is needed**:
- Need callback implementation → Use `QW_CLASS_INTERFACE`
3. **Check if it's a simple data structure**:
- Simple data structure → Consider custom wrapping or `QW_CLASS_BOX`
### Step 2: Determine File Location and Naming
Determine the corresponding qwlroots file location based on the wlroots source file location:
```bash
# 1. Find the source file in wlroots
find /path/to/wlroots/include/wlr -name "wlr_example.h"
# Example: wlroots/include/wlr/types/wlr_example.h
# 2. Determine corresponding location in qwlroots
# src/types/qwexample.h
```
### Step 3: Create Header File
```cpp
// File: src/types/qwexample.h
#pragma once
#include <qwobject.h>
extern "C" {
#include <wlr/types/wlr_example.h>
}
QW_BEGIN_NAMESPACE
class QW_CLASS_OBJECT(example)
{
QW_OBJECT
Q_OBJECT
// Bind all related signals
QW_SIGNAL(signal_name, param_type)
public:
// Bind static functions
QW_FUNC_STATIC(example, create, qw_example *, param_type param)
QW_FUNC_STATIC(example, from_resource, qw_example *, wl_resource *resource)
// Bind member functions
QW_FUNC_MEMBER(example, method_name, return_type, param_type param)
// If there's a destroy method, destructor should be protected
protected:
QW_FUNC_MEMBER(example, destroy, void)
};
QW_END_NAMESPACE
```
### Step 4: Handle Version Compatibility
```cpp
// Handle API differences between different wlroots versions
#if WLR_VERSION_MINOR < 18
QW_SIGNAL(old_signal, param_type)
#else
QW_SIGNAL(new_signal, param_type)
#endif
#if WLR_VERSION_MINOR < 19
QW_FUNC_MEMBER(example, old_method, void, param_type)
#else
QW_FUNC_MEMBER(example, new_method, void, param_type)
#endif
```
### Step 5: Add to Build System
Add the new header file to `src/CMakeLists.txt`:
```cmake
set(HEADERS
# ... other header files
types/qwexample.h
)
```
## Best Practices and Considerations
### 1. Naming Conventions
- Class names: `qw_` + wlroots type name (remove `wlr_` prefix)
- Signal names: `notify_` + original signal name
- Function names: Keep consistent with wlroots function names (remove type prefix)
### 2. Signal Handling
```cpp
// Correct signal binding
QW_SIGNAL(destroy) // Automatically handled, no manual binding needed
QW_SIGNAL(custom_event, param_type) // Custom signals
// Signal connection example
connect(surface, &qw_surface::notify_commit, this, [](){
// Handle commit event
});
```
### 3. Memory Management
```cpp
// Create object (owns ownership)
auto *compositor = qw_compositor::create(display, version, renderer);
// Get object from existing handle (doesn't own ownership)
auto *surface = qw_surface::from(wlr_surface);
// Check if object exists
auto *existing = qw_surface::get(wlr_surface); // May return nullptr
```
### 4. Function Binding Principles
#### 4.1 Determining Function Ownership and Placement
When wrapping wlroots functions, it's crucial to determine whether a function should be a static function or a member function, and which class it belongs to. Follow this systematic approach:
**Function Name Analysis Pattern:**
wlroots functions follow the pattern: `wlr_<type>_<function_name>`
**Step 1: Parse the Function Name**
- Split the function name at underscores after `wlr_`
- Identify the type part and function name part
- The type part should correspond to an existing wlroots type
**Example Analysis:**
```cpp
// Function: wlr_surface_get_image_description_v1_data
// Parsing: wlr_ + surface + _ + get_image_description_v1_data
// Type: wlr_surface
// Function name: get_image_description_v1_data
// Why not wlr_surface_get?
// Because wlr_surface_get is not a valid wlroots type
// get_image_description_v1_data is a more reasonable function name
```
**Step 2: Verify Type Existence**
- Check if `wlr_<type>` exists as a structure in wlroots headers
- If the type exists, this confirms the parsing is correct
**Step 3: Determine Static vs Member Function**
- **Member Function**: First parameter type matches the parsed type
```cpp
// wlr_surface_get_image_description_v1_data(struct wlr_surface *surface)
// First parameter is wlr_surface* → Member function of qw_surface
QW_FUNC_MEMBER(surface, get_image_description_v1_data, const wlr_image_description_v1_data *)
```
- **Static Function**: First parameter type doesn't match the parsed type
```cpp
// wlr_compositor_create(wl_display *display, ...)
// First parameter is wl_display*, not wlr_compositor* → Static function
QW_FUNC_STATIC(compositor, create, qw_compositor *, wl_display *display, ...)
```
**Step 4: Handle Cross-File Functions**
Functions may be defined in different header files than their target type. This is common in wlroots:
```cpp
// wlr_surface_get_image_description_v1_data is defined in wlr_color_management_v1.h
// but operates on wlr_surface, so it belongs to qw_surface class
// In qwcompositor.h:
#if WLR_VERSION_MINOR >= 19
#include <wlr/types/wlr_color_management_v1.h>
#endif
class QW_CLASS_OBJECT(surface) {
// ...
#if WLR_VERSION_MINOR >= 19
QW_FUNC_MEMBER(surface, get_image_description_v1_data, const wlr_image_description_v1_data *)
#endif
};
```
**Common Patterns:**
```cpp
// Create functions - always static, return the type
QW_FUNC_STATIC(compositor, create, qw_compositor *, ...)
// From/Get functions - usually static, return the type
QW_FUNC_STATIC(surface, from_resource, qw_surface *, wl_resource *resource)
// Instance methods - member functions, first param matches type
QW_FUNC_MEMBER(surface, has_buffer, bool)
QW_FUNC_MEMBER(surface, send_frame_done, void, const timespec *when)
// Utility functions - check first parameter to determine placement
// If first param is wlr_surface* → member of qw_surface
// If first param is something else → static function or belongs to other class
```
#### 4.2 Function Binding Syntax
```cpp
// Static function binding
QW_FUNC_STATIC(type, create, qw_type *, ...) // Create function, same type returns qw_*
QW_FUNC_STATIC(type, from, qw_type *, ...) // Conversion function, same type returns qw_*
QW_FUNC_STATIC(type, get, qw_type *, ...) // Get function, same type returns qw_*
QW_FUNC_STATIC(type, get_other, wlr_other *, ...) // Get other types, keep wlr_*
QW_FUNC_STATIC(type, utility, return_type, ...) // Utility function, by actual return type
// Member function binding
QW_FUNC_MEMBER(type, method, return_type, ...) // Instance method, return type by actual situation
```
### 5. Error Handling
```cpp
// Check object validity
if (!surface->is_valid()) {
return;
}
// Safe handle access
if (auto *handle = surface->handle()) {
// Use handle
}
```
### 6. Version Compatibility Handling
- Use conditional compilation to handle API changes
- Prioritize supporting the latest version API
- Provide compatibility macros for older versions
### 7. Testing
Create tests for new wrapper classes:
```cpp
// tests/test_qwexample.cpp
#include "qwexample.h"
#include <QtTest>
class TestQwExample : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testCreate();
void testSignals();
void testMethods();
};
```
## Common Issues and Solutions
### 1. Compilation Error: wlroots Function Not Found
**Problem**: Compilation fails when using `QW_FUNC_STATIC` or `QW_FUNC_MEMBER`.
**Solution**:
- Check wlroots version compatibility
- Confirm function name spelling is correct
- Use conditional compilation to handle version differences
### 2. Signal Connection Failure
**Problem**: Qt signals don't trigger properly.
**Solution**:
- Ensure `QW_OBJECT` and `Q_OBJECT` macros are used
- Check signal parameter types are correct
- Verify wlroots structure actually has corresponding signals
### 3. Memory Leaks or Crashes
**Problem**: Issues occur during object destruction.
**Solution**:
- Handle object ownership correctly
- For classes with destroy methods, make destructor protected
- Use smart pointers to manage lifecycle
## Common Wrapping Errors Based on PR #322
Based on actual code review experience, here are common mistakes developers make when adding new wrappers:
### 4. Incorrect Interface Type Wrapping
**Problem**: Incorrectly attempting to wrap interface-related init functions.
**Solution**:
- init interfaces are for interface use, not wrapped in regular classes
- Should wrap corresponding interface types, such as `qw_allocator_interface`
- Interface-related wrapping usually needs separate handling
### 5. Static Function Return Type Errors
**Problem**: Static function return type uses `wlr_*` type instead of `qw_*` type when the return type matches the current wrapped class type.
**❌ Incorrect Example**:
```cpp
// In qw_color_transform class
QW_FUNC_STATIC(color_transform, create, wlr_color_transform *, ...) // Error: should return qw_color_transform*
// In qw_abc class
QW_FUNC_STATIC(abc, create, wlr_abc *, ...) // Error: should return qw_abc*
QW_FUNC_STATIC(abc, get_xxx_data, wlr_xxx *, ...) // Correct: other types remain unchanged
```
**✅ Correct Format**:
```cpp
// In qw_color_transform class
QW_FUNC_STATIC(color_transform, create, qw_color_transform *, ...) // Correct: same type returns qw_*
// In qw_abc class
QW_FUNC_STATIC(abc, create, qw_abc *, ...) // Correct: same type returns qw_*
QW_FUNC_STATIC(abc, get_xxx_data, wlr_xxx *, ...) // Correct: other types keep wlr_*
```
**Solution**:
- Only when the static function's return type matches the currently wrapped class type, change `wlr_*` to `qw_*`
- If returning other types (like `wlr_xxx *`), keep the original `wlr_*` type
- This ensures wrapping consistency: same type returns wrapped type, other types keep original type
### 6. Redundant Destroy Signal Declaration
**Problem**: Manually declaring destroy signal in `QW_CLASS_OBJECT` class.
**❌ Incorrect Example**:
```cpp
class QW_CLASS_OBJECT(example)
{
QW_OBJECT
Q_OBJECT
QW_SIGNAL(destroy) // Redundant: base class handles automatically
};
```
**✅ Correct Format**:
```cpp
class QW_CLASS_OBJECT(example)
{
QW_OBJECT
Q_OBJECT
// destroy signal is handled automatically by base class, no explicit declaration needed
// Only declare specific business signals
QW_SIGNAL(custom_event, param_type)
};
```
**Solution**:
- destroy signal is specially handled in `QW_CLASS_OBJECT`, no manual declaration needed
- Only declare specific business signals
### 7. Type Mixing Wrapping Errors
**Problem**: Mixing functions of different types in one class.
**❌ Incorrect Example**:
```cpp
class QW_CLASS_REINTERPRET_CAST(linux_drm_syncobj_manager_v1)
{
public:
QW_FUNC_STATIC(linux_drm_syncobj_manager_v1, create, ...)
// Error: wrapping syncobj_v1 type functions in manager class
QW_FUNC_STATIC(linux_drm_syncobj_v1, get_surface_state, ...)
};
```
**✅ Correct Design**:
```cpp
// Separate different types
class QW_CLASS_REINTERPRET_CAST(linux_drm_syncobj_manager_v1)
{
public:
QW_FUNC_STATIC(linux_drm_syncobj_manager_v1, create, ...)
};
class QW_CLASS_REINTERPRET_CAST(linux_drm_syncobj_v1)
{
public:
QW_FUNC_STATIC(linux_drm_syncobj_v1, get_surface_state, ...)
};
```
**Solution**:
- Should not wrap `linux_drm_syncobj_v1` type functions in `qw_linux_drm_syncobj_manager_v1`
- Each class should only wrap functions belonging to its own type
- Functions of different types should be separated into corresponding classes
## Summary
qwlroots' wrapping pattern design is sophisticated, providing flexible and efficient C++ wrapping through template and macro systems. When adding new class wrappers, you should:
1. Carefully analyze wlroots structure characteristics
2. Choose appropriate wrapping patterns
3. Follow project naming and coding conventions
4. Handle version compatibility issues
5. Write corresponding test code
By following these best practices, you can ensure that newly added wrapper classes remain consistent with the overall project architecture and provide a good development experience.

View File

@ -0,0 +1,681 @@
# qwlroots 封装模式最佳实践指南
## 概述
qwlroots 是对 wlroots C 接口的 Qt 风格封装库,通过宏系统提供了多种封装模式来适应不同类型的 wlroots 结构体。本文档总结了项目中使用的几种主要封装模式,为添加新的类封装提供指导。
## 核心设计理念
1. **Qt 风格接口**:遵循 Qt 规范的接口风格
2. **信号槽机制**:将 wl_signal 封装为 Qt 信号
3. **内存管理**:自动处理对象生命周期和所有权
4. **类型安全**:利用 C++ 模板和概念确保类型安全
5. **零开销抽象**:在 Release 模式下提供零开销的封装
## 封装模式分类
### 1. QW_CLASS_OBJECT 模式 - 基于 QObject 的完整封装
**适用场景**
- wlroots 结构体包含信号events 字段)
- 需要完整的对象生命周期管理
- 需要 Qt 信号槽机制
**特点**
- 继承自 `qw_object<Handle, Derive>`,间接继承 QObject
- 自动连接 wlroots 的 destroy 信号
- 支持信号绑定和转发
- 提供完整的内存管理和所有权控制
**使用示例**
```cpp
// 头文件声明
class QW_CLASS_OBJECT(compositor)
{
QW_OBJECT // 必需的宏,提供基础功能
Q_OBJECT // Qt 元对象系统
// 信号绑定 - 将 wlroots 信号转换为 Qt 信号
QW_SIGNAL(new_surface, wlr_surface*)
public:
// 静态函数绑定 - create 函数自动返回 qw_compositor*
QW_FUNC_STATIC(compositor, create, qw_compositor *, wl_display *display, uint32_t version, wlr_renderer *renderer)
};
class QW_CLASS_OBJECT(surface)
{
QW_OBJECT
Q_OBJECT
// 多个信号绑定
QW_SIGNAL(client_commit)
QW_SIGNAL(commit)
QW_SIGNAL(new_subsurface, wlr_subsurface*)
QW_SIGNAL(map)
QW_SIGNAL(unmap)
public:
// 静态函数 - from/get 函数
QW_FUNC_STATIC(surface, from_resource, qw_surface *, wl_resource *resource)
// 成员函数绑定
QW_FUNC_MEMBER(surface, for_each_surface, void, wlr_surface_iterator_func_t iterator, void *user_data)
QW_FUNC_MEMBER(surface, has_buffer, bool)
QW_FUNC_MEMBER(surface, send_frame_done, void, const timespec *when)
QW_FUNC_MEMBER(surface, map, void)
QW_FUNC_MEMBER(surface, unmap, void)
};
```
**关键宏说明**
- `QW_OBJECT`:提供基础的对象功能,必须在 protected 区域
- `QW_SIGNAL(name, ...)`:绑定 wlroots 信号到 Qt 信号
- `QW_FUNC_STATIC`绑定静态函数create/from/get 函数自动处理返回类型
- `QW_FUNC_MEMBER`:绑定成员函数
### 2. QW_CLASS_REINTERPRET_CAST 模式 - 轻量级类型转换
**适用场景**
- wlroots 结构体不包含信号
- 只需要函数封装,不需要对象生命周期管理
- 追求最小内存开销
**特点**
- 基于 `reinterpret_cast` 的零开销封装
- 不分配额外内存
- 不支持信号机制
- 主要用于工具类和简单结构体
**使用示例**
```cpp
class QW_CLASS_REINTERPRET_CAST(client_buffer)
{
public:
QW_FUNC_STATIC(client_buffer, get, qw_client_buffer *, wlr_buffer *buffer)
};
```
### 3. QW_CLASS_BOX 模式 - 值类型封装
**适用场景**
- 简单的数据结构
- 需要与 Qt 类型互操作
- 值语义的对象
**特点**
- 包含实际的数据成员
- 支持与 Qt 类型的转换
- 值语义,支持拷贝和赋值
**使用示例**
```cpp
class qw_box
{
public:
explicit qw_box() = default;
explicit qw_box(const wlr_box &box);
explicit qw_box(const QRect &box);
QRect toQRect();
operator wlr_box*();
private:
wlr_box m_handle;
};
```
### 4. QW_CLASS_INTERFACE 模式 - 接口实现封装
**适用场景**
- 需要实现 wlroots 接口
- 提供回调函数实现
- 自定义行为扩展
**特点**
- 基于模板的接口绑定
- 自动处理函数指针绑定
- 支持虚函数重写
**使用示例**
```cpp
class QW_CLASS_INTERFACE(output)
{
QW_INTERFACE_INIT(output)
// 接口函数实现
QW_INTERFACE(commit, bool, wlr_output_state *state)
QW_INTERFACE(set_cursor, bool, wlr_buffer *buffer, int hotspot_x, int hotspot_y)
protected:
// 实现具体的接口函数
bool commit(wlr_output_state *state);
bool set_cursor(wlr_buffer *buffer, int hotspot_x, int hotspot_y);
};
```
## 目录结构和文件命名规律
qwlroots 的目录结构和文件命名完全遵循 wlroots 的组织方式,这确保了项目结构的一致性和可维护性。
### 目录结构对应关系
qwlroots 的 `src/` 目录结构与 wlroots 的 `include/wlr/` 目录结构完全对应:
```
wlroots/include/wlr/ qwlroots/src/
├── types/ ←→ ├── types/
├── util/ ←→ ├── util/
├── render/ ←→ ├── render/
├── interfaces/ ←→ ├── interfaces/
├── backend/ ←→ ├── (backend相关文件直接在src/)
└── xwayland/ ←→ └── (xwayland相关文件在types/)
```
### 文件命名规律
1. **头文件命名**
- wlroots: `wlr_compositor.h` → qwlroots: `qwcompositor.h`
- wlroots: `wlr_output.h` → qwlroots: `qwoutput.h`
- wlroots: `wlr_buffer.h` → qwlroots: `qwbuffer.h`
2. **类名命名**
- wlroots: `struct wlr_compositor` → qwlroots: `class qw_compositor`
- wlroots: `struct wlr_surface` → qwlroots: `class qw_surface`
3. **目录分类规律**
- `types/`: 主要的 Wayland 协议类型和核心对象
- `util/`: 工具类和辅助函数
- `render/`: 渲染相关的类型
- `interfaces/`: 接口实现相关的类型
### 查找对应关系的方法
当需要为新的 wlroots 类型创建封装时:
1. **定位源文件**:在 `wlroots/include/wlr/` 中找到对应的头文件
2. **确定目录**:根据 wlroots 的目录结构确定在 qwlroots 中的位置
3. **命名转换**:按照 `wlr_xxx.h``qwxxx.h` 的规律命名
**示例**
```bash
# wlroots 中的文件
wlroots/include/wlr/types/wlr_xdg_shell.h
# 对应的 qwlroots 文件应该是
qwlroots/src/types/qwxdgshell.h
```
## 新增封装的完整操作流程
当用户请求"新增xxx类"或"新增xxxx函数"时,应按照以下流程操作:
### 步骤 0更新 wlroots 子模块
在开始任何封装工作之前,首先确保 wlroots 子模块是最新的:
```bash
# 进入 wlroots 子模块目录
cd wlroots
# 获取最新的标签和提交
git fetch --tags
# 查看最新的版本标签
git tag --sort=-version:refname | head -5
# 切换到最新的稳定版本(例如 0.19.0
git checkout 0.19.0
# 返回项目根目录
cd ..
# 提交子模块更新
git add wlroots
git commit -m "submodule: update wlroots to latest version"
```
### 步骤 1在 wlroots 子模块中查找目标类型
使用以下方法在 wlroots 子模块中定位要封装的类型:
```bash
# 查找特定的头文件
find wlroots/include/wlr -name "*目标名称*" -type f
# 搜索结构体定义
grep -r "struct wlr_目标名称" wlroots/include/wlr/
# 查看具体文件内容
cat wlroots/include/wlr/types/wlr_目标名称.h
```
### 步骤 2确定版本信息
查找该类型是在哪个版本中引入的:
```bash
# 在 wlroots 目录中查看文件的提交历史
cd wlroots
git log --oneline --follow include/wlr/types/wlr_目标名称.h
# 查看特定提交的详细信息
git show 提交哈希
# 查找包含该提交的最早标签
git tag --contains 提交哈希 --sort=version:refname | head -1
```
这个信息将用于在 qwlroots 中添加版本兼容性宏。
### 步骤 3分析 wlroots 结构体
1. **检查是否有 events 字段**
- 有 events 字段 → 使用 `QW_CLASS_OBJECT`
- 无 events 字段 → 使用 `QW_CLASS_REINTERPRET_CAST`
2. **检查是否需要接口实现**
- 需要实现回调 → 使用 `QW_CLASS_INTERFACE`
3. **检查是否为简单数据结构**
- 简单数据结构 → 考虑自定义封装或 `QW_CLASS_BOX`
### 步骤 2确定文件位置和命名
根据 wlroots 源文件的位置确定对应的 qwlroots 文件位置:
```bash
# 1. 找到 wlroots 中的源文件
find /path/to/wlroots/include/wlr -name "wlr_example.h"
# 例如wlroots/include/wlr/types/wlr_example.h
# 2. 确定 qwlroots 中的对应位置
# src/types/qwexample.h
```
### 步骤 3创建头文件
```cpp
// 文件src/types/qwexample.h
#pragma once
#include <qwobject.h>
extern "C" {
#include <wlr/types/wlr_example.h>
}
QW_BEGIN_NAMESPACE
class QW_CLASS_OBJECT(example)
{
QW_OBJECT
Q_OBJECT
// 绑定所有相关信号
QW_SIGNAL(signal_name, param_type)
public:
// 绑定静态函数
QW_FUNC_STATIC(example, create, qw_example *, param_type param)
QW_FUNC_STATIC(example, from_resource, qw_example *, wl_resource *resource)
// 绑定成员函数
QW_FUNC_MEMBER(example, method_name, return_type, param_type param)
// 如果有 destroy 方法,析构函数应该是 protected
protected:
QW_FUNC_MEMBER(example, destroy, void)
};
QW_END_NAMESPACE
```
### 步骤 4处理版本兼容性
```cpp
// 处理不同 wlroots 版本的 API 差异
#if WLR_VERSION_MINOR < 18
QW_SIGNAL(old_signal, param_type)
#else
QW_SIGNAL(new_signal, param_type)
#endif
#if WLR_VERSION_MINOR < 19
QW_FUNC_MEMBER(example, old_method, void, param_type)
#else
QW_FUNC_MEMBER(example, new_method, void, param_type)
#endif
```
### 步骤 5添加到构建系统
`src/CMakeLists.txt` 中添加新的头文件:
```cmake
set(HEADERS
# ... 其他头文件
types/qwexample.h
)
```
## 最佳实践和注意事项
### 1. 命名规范
- 类名:`qw_` + wlroots 类型名(去掉 `wlr_` 前缀)
- 信号名:`notify_` + 原始信号名
- 函数名:保持与 wlroots 函数名一致(去掉类型前缀)
### 2. 信号处理
```cpp
// 正确的信号绑定
QW_SIGNAL(destroy) // 自动处理,无需手动绑定
QW_SIGNAL(custom_event, param_type) // 自定义信号
// 信号连接示例
connect(surface, &qw_surface::notify_commit, this, [](){
// 处理提交事件
});
```
### 3. 内存管理
```cpp
// 创建对象(拥有所有权)
auto *compositor = qw_compositor::create(display, version, renderer);
// 从现有句柄获取对象(不拥有所有权)
auto *surface = qw_surface::from(wlr_surface);
// 检查对象是否存在
auto *existing = qw_surface::get(wlr_surface); // 可能返回 nullptr
```
### 4. 函数绑定原则
#### 4.1 确定函数所有权和放置位置
在封装 wlroots 函数时,确定函数应该是静态函数还是成员函数,以及它属于哪个类是至关重要的。遵循以下系统性方法:
**函数命名分析模式:**
wlroots 函数遵循模式:`wlr_<类型>_<函数名>`
**步骤 1解析函数名**
- 在 `wlr_` 后按下划线分割函数名
- 识别类型部分和函数名部分
- 类型部分应该对应一个现有的 wlroots 类型
**示例分析:**
```cpp
// 函数wlr_surface_get_image_description_v1_data
// 解析wlr_ + surface + _ + get_image_description_v1_data
// 类型wlr_surface
// 函数名get_image_description_v1_data
// 为什么不是 wlr_surface_get
// 因为 wlr_surface_get 不是一个有效的 wlroots 类型
// get_image_description_v1_data 是一个更合理的函数名
```
**步骤 2验证类型存在性**
- 检查 `wlr_<类型>` 是否作为结构体存在于 wlroots 头文件中
- 如果类型存在,这确认了解析是正确的
**步骤 3确定静态函数 vs 成员函数**
- **成员函数**:第一个参数类型与解析出的类型匹配
```cpp
// wlr_surface_get_image_description_v1_data(struct wlr_surface *surface)
// 第一个参数是 wlr_surface* → qw_surface 的成员函数
QW_FUNC_MEMBER(surface, get_image_description_v1_data, const wlr_image_description_v1_data *)
```
- **静态函数**:第一个参数类型与解析出的类型不匹配
```cpp
// wlr_compositor_create(wl_display *display, ...)
// 第一个参数是 wl_display*,不是 wlr_compositor* → 静态函数
QW_FUNC_STATIC(compositor, create, qw_compositor *, wl_display *display, ...)
```
**步骤 4处理跨文件函数**
函数可能定义在与其目标类型不同的头文件中。这在 wlroots 中很常见:
```cpp
// wlr_surface_get_image_description_v1_data 定义在 wlr_color_management_v1.h 中
// 但操作 wlr_surface所以它属于 qw_surface 类
// 在 qwcompositor.h 中:
#if WLR_VERSION_MINOR >= 19
#include <wlr/types/wlr_color_management_v1.h>
#endif
class QW_CLASS_OBJECT(surface) {
// ...
#if WLR_VERSION_MINOR >= 19
QW_FUNC_MEMBER(surface, get_image_description_v1_data, const wlr_image_description_v1_data *)
#endif
};
```
**常见模式:**
```cpp
// 创建函数 - 总是静态的,返回该类型
QW_FUNC_STATIC(compositor, create, qw_compositor *, ...)
// From/Get 函数 - 通常是静态的,返回该类型
QW_FUNC_STATIC(surface, from_resource, qw_surface *, wl_resource *resource)
// 实例方法 - 成员函数,第一个参数匹配类型
QW_FUNC_MEMBER(surface, has_buffer, bool)
QW_FUNC_MEMBER(surface, send_frame_done, void, const timespec *when)
// 工具函数 - 检查第一个参数确定放置位置
// 如果第一个参数是 wlr_surface* → qw_surface 的成员
// 如果第一个参数是其他类型 → 静态函数或属于其他类
```
#### 4.2 函数绑定语法
```cpp
// 静态函数绑定
QW_FUNC_STATIC(type, create, qw_type *, ...) // 创建函数,返回同类型用 qw_*
QW_FUNC_STATIC(type, from, qw_type *, ...) // 转换函数,返回同类型用 qw_*
QW_FUNC_STATIC(type, get, qw_type *, ...) // 获取函数,返回同类型用 qw_*
QW_FUNC_STATIC(type, get_other, wlr_other *, ...) // 获取其他类型,保持 wlr_*
QW_FUNC_STATIC(type, utility, return_type, ...) // 工具函数,按实际返回类型
// 成员函数绑定
QW_FUNC_MEMBER(type, method, return_type, ...) // 实例方法,返回类型按实际情况
```
### 5. 错误处理
```cpp
// 检查对象有效性
if (!surface->is_valid()) {
return;
}
// 安全的句柄访问
if (auto *handle = surface->handle()) {
// 使用 handle
}
```
### 6. 版本兼容性处理
- 使用条件编译处理 API 变化
- 优先支持最新版本的 API
- 为旧版本提供兼容性宏
### 7. 测试
为新的封装类创建测试:
```cpp
// tests/test_qwexample.cpp
#include "qwexample.h"
#include <QtTest>
class TestQwExample : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testCreate();
void testSignals();
void testMethods();
};
```
## 常见问题和解决方案
### 1. 编译错误:找不到 wlroots 函数
**问题**:使用 `QW_FUNC_STATIC``QW_FUNC_MEMBER` 时编译失败。
**解决方案**
- 检查 wlroots 版本兼容性
- 确认函数名拼写正确
- 使用条件编译处理版本差异
### 2. 信号连接失败
**问题**Qt 信号无法正常触发。
**解决方案**
- 确保使用了 `QW_OBJECT``Q_OBJECT`
- 检查信号参数类型是否正确
- 验证 wlroots 结构体确实有对应的信号
### 3. 内存泄漏或崩溃
**问题**:对象销毁时出现问题。
**解决方案**
- 正确处理对象所有权
- 对于有 destroy 方法的类,将析构函数设为 protected
- 使用智能指针管理生命周期
## 基于 PR #322 的常见封装错误
基于实际代码审查经验,以下是开发者在添加新封装时容易犯的错误:
### 4. interface 类型的错误封装
**问题**:错误地尝试封装 interface 相关的 init 函数。
**解决方案**
- init 接口是给 interface 用的,不在普通类中封装
- 应该封装对应的 interface 类型,如 `qw_allocator_interface`
- interface 相关的封装通常需要单独处理
### 5. 静态函数返回类型错误
**问题**:静态函数返回类型与当前封装类同类型时,仍使用 `wlr_*` 类型。
**❌ 错误示例**
```cpp
// 在 qw_color_transform 类中
QW_FUNC_STATIC(color_transform, create, wlr_color_transform *, ...) // 错误:应该返回 qw_color_transform*
// 在 qw_abc 类中
QW_FUNC_STATIC(abc, create, wlr_abc *, ...) // 错误:应该返回 qw_abc*
QW_FUNC_STATIC(abc, get_xxx_data, wlr_xxx *, ...) // 正确:返回其他类型保持不变
```
**✅ 正确格式**
```cpp
// 在 qw_color_transform 类中
QW_FUNC_STATIC(color_transform, create, qw_color_transform *, ...) // 正确:返回同类型用 qw_*
// 在 qw_abc 类中
QW_FUNC_STATIC(abc, create, qw_abc *, ...) // 正确:返回同类型用 qw_*
QW_FUNC_STATIC(abc, get_xxx_data, wlr_xxx *, ...) // 正确:返回其他类型保持 wlr_*
```
**解决方案**
- 只有当静态函数的返回类型与当前封装的类是同类型时,才将 `wlr_*` 改为 `qw_*`
- 如果返回的是其他类型(如 `wlr_xxx *`),则保持原始的 `wlr_*` 类型
- 这确保了封装的一致性:同类型返回封装类型,其他类型保持原始类型
### 6. 冗余的 destroy 信号声明
**问题**:在 `QW_CLASS_OBJECT` 类中手动声明 destroy 信号。
**❌ 错误示例**
```cpp
class QW_CLASS_OBJECT(example)
{
QW_OBJECT
Q_OBJECT
QW_SIGNAL(destroy) // 冗余:基类已自动处理
};
```
**✅ 正确格式**
```cpp
class QW_CLASS_OBJECT(example)
{
QW_OBJECT
Q_OBJECT
// destroy 信号由基类自动处理,无需显式声明
// 只声明特定的业务信号
QW_SIGNAL(custom_event, param_type)
};
```
**解决方案**
- destroy 信号是 `QW_CLASS_OBJECT` 里特殊处理的,无需手动声明
- 只声明特定的业务信号即可
### 7. 类型混合封装错误
**问题**:在一个类中混合封装不同类型的函数。
**❌ 错误示例**
```cpp
class QW_CLASS_REINTERPRET_CAST(linux_drm_syncobj_manager_v1)
{
public:
QW_FUNC_STATIC(linux_drm_syncobj_manager_v1, create, ...)
// 错误:在 manager 类中封装 syncobj_v1 类型的函数
QW_FUNC_STATIC(linux_drm_syncobj_v1, get_surface_state, ...)
};
```
**✅ 正确设计**
```cpp
// 分离不同的类型
class QW_CLASS_REINTERPRET_CAST(linux_drm_syncobj_manager_v1)
{
public:
QW_FUNC_STATIC(linux_drm_syncobj_manager_v1, create, ...)
};
class QW_CLASS_REINTERPRET_CAST(linux_drm_syncobj_v1)
{
public:
QW_FUNC_STATIC(linux_drm_syncobj_v1, get_surface_state, ...)
};
```
**解决方案**
- 在 `qw_linux_drm_syncobj_manager_v1` 里不应该封装 `linux_drm_syncobj_v1` 类型的东西
- 每个类只封装属于自己类型的函数
- 不同类型的函数应该分离到对应的类中
## 总结
qwlroots 的封装模式设计精巧,通过模板和宏系统提供了灵活而高效的 C++ 封装。在添加新的类封装时,应该:
1. 仔细分析 wlroots 结构体的特性
2. 选择合适的封装模式
3. 遵循项目的命名和代码规范
4. 处理版本兼容性问题
5. 编写相应的测试代码
通过遵循这些最佳实践,可以确保新添加的封装类与项目整体架构保持一致,并提供良好的开发体验。

View File

@ -0,0 +1,5 @@
include_directories(PRIVATE
${PROJECT_SOURCE_DIR}/src
)
add_subdirectory(tinywl)

View File

@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.21..3.27)
project(tinywl)
set(TARGET tinywl)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(PROJECT_IS_TOP_LEVEL) # if build as a separated project
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(QWlroots REQUIRED)
endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
set(SOURCES main.cpp)
add_executable(${TARGET}
${SOURCES}
)
target_link_libraries(${TARGET}
PRIVATE
QWlroots::QWlroots
Qt${QT_VERSION_MAJOR}::Gui
)

View File

@ -0,0 +1,685 @@
// Copyright (C) 2022 JiDe Zhang <zccrs@live.com>.
// SPDX-License-Identifier: Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QGuiApplication>
#include <QCommandLineParser>
#include <QProcess>
#include <QRect>
#include <QLoggingCategory>
#include <qwbackend.h>
#include <qwdisplay.h>
#include <qwrenderer.h>
#include <qwallocator.h>
#include <qwcompositor.h>
#include <qwsubcompositor.h>
#include <qwdatadevice.h>
#include <qwoutputlayout.h>
#include <qwoutput.h>
#include <qwscene.h>
#include <qwseat.h>
#include <qwxdgshell.h>
#include <qwcursor.h>
#include <qwxcursormanager.h>
#include <qwinputdevice.h>
#include <qwkeyboard.h>
#include <qwpointer.h>
#include <qwtexture.h>
#include <qwlogging.h>
#include <qwbox.h>
class Q_DECL_HIDDEN TinywlServer : public QObject
{
Q_OBJECT
public:
TinywlServer();
~TinywlServer();
bool start();
private Q_SLOTS:
void onNewOutput(wlr_output *output);
#if WLR_VERSION_MINOR < 18
void onNewXdgSurface(wlr_xdg_surface *surface);
#endif
void onNewXdgToplevel(wlr_xdg_toplevel *surface);
void onNewXdgPopup(wlr_xdg_popup *surface);
void onMap();
void onUnmap();
void onXdgToplevelRequestMove(wlr_xdg_toplevel_move_event *);
void onXdgToplevelRequestResize(wlr_xdg_toplevel_resize_event *event);
void onXdgToplevelRequestMaximize();
void onXdgToplevelRequestRequestFullscreen();
void onCursorMotion(wlr_pointer_motion_event *event);
void onCursorMotionAbsolute(wlr_pointer_motion_absolute_event *event);
void onCursorButton(wlr_pointer_button_event *event);
void onCursorAxis(wlr_pointer_axis_event *event);
void onCursorFrame();
void onNewInput(wlr_input_device *device);
void onRequestSetCursor(wlr_seat_pointer_request_set_cursor_event *event);
void onRequestSetSelection(wlr_seat_request_set_selection_event *event);
void onKeyboardModifiers();
void onKeyboardKey(wlr_keyboard_key_event *event);
void onKeyboardDestroy();
void onOutputFrame();
private:
struct View
{
TinywlServer *server;
qw_xdg_toplevel *xdgToplevel;
qw_scene_tree *sceneTree;
QPointF pos;
};
enum class CursorState {
Normal,
MovingWindow,
ResizingWindow,
};
static inline View *getView(const qw_xdg_surface *surface);
View *viewAt(const QPointF &pos, wlr_surface **surface, QPointF *spos) const;
void processCursorMotion(uint32_t time);
void focusView(View *view, wlr_surface *surface);
void beginInteractive(View *view, CursorState state, uint32_t edges);
bool handleKeybinding(xkb_keysym_t sym);
qw_display *display;
qw_backend *backend;
qw_renderer *renderer;
qw_allocator *allocator;
qw_compositor *compositor;
qw_subcompositor *subcompositor;
qw_data_device_manager *dataDeviceManager;
qw_output_layout *outputLayout;
QList<qw_output*> outputs;
qw_scene *scene;
qw_scene_output_layout *scene_layout;
qw_xdg_shell *xdgShell;
QList<View*> views;
View *grabbedView = nullptr;
QPointF grabCursorPos;
QRectF grabGeoBox;
qw_cursor *cursor;
qw_xcursor_manager *cursorManager;
CursorState cursorState = CursorState::Normal;
uint32_t resizingEdges = 0;
QList<qw_keyboard*> keyboards;
qw_seat *seat;
};
TinywlServer::TinywlServer()
{
display = new qw_display();
#if WLR_VERSION_MINOR > 17
backend = qw_backend::autocreate(display->get_event_loop(), nullptr);
#else
backend = qw_backend::autocreate(*display, nullptr);
#endif
if (!backend)
qFatal("failed to create wlr_backend");
// Add output
// auto multiBackend = qobject_cast<qw_multi_backend*>(backend);
// multiBackend->for_each_backend([] (struct wlr_backend *backend, void *data) {
// auto x11 = qw_x11_backend::from(backend);
// if (x11)
// x11->output_create();
// }, nullptr);
renderer = qw_renderer::autocreate(*backend);
if (!renderer)
qFatal("failed to create wlr_renderer");
renderer->init_wl_display(*display);
allocator = qw_allocator::autocreate(*backend, *renderer);
if (!allocator)
qFatal("failed to create wlr_allocator");
compositor = qw_compositor::create(*display, 4, *renderer);
subcompositor = qw_subcompositor::create(*display);
dataDeviceManager = qw_data_device_manager::create(*display);
#if WLR_VERSION_MAJOR == 0 && WLR_VERSION_MINOR < 18
outputLayout = new qw_output_layout(display);
#else
outputLayout = new qw_output_layout(*display);
#endif
connect(backend, &qw_backend::notify_new_output, this, &TinywlServer::onNewOutput);
scene = qw_scene::create();
scene_layout = qw_scene_output_layout::from(scene->attach_output_layout(*outputLayout));
xdgShell = qw_xdg_shell::create(*display, 3);
#if WLR_VERSION_MINOR > 17
connect(xdgShell, &qw_xdg_shell::notify_new_toplevel, this, &TinywlServer::onNewXdgToplevel);
connect(xdgShell, &qw_xdg_shell::notify_new_popup, this, &TinywlServer::onNewXdgPopup);
#else
connect(xdgShell, &qw_xdg_shell::notify_new_surface, this, &TinywlServer::onNewXdgSurface);
#endif
cursor = qw_cursor::create();
cursor->attach_output_layout(*outputLayout);
cursorManager = qw_xcursor_manager::create(nullptr, 24);
cursorManager->load(1);
connect(cursor, &qw_cursor::notify_motion, this, &TinywlServer::onCursorMotion);
connect(cursor, &qw_cursor::notify_motion_absolute, this, &TinywlServer::onCursorMotionAbsolute);
connect(cursor, &qw_cursor::notify_button, this, &TinywlServer::onCursorButton);
connect(cursor, &qw_cursor::notify_axis, this, &TinywlServer::onCursorAxis);
connect(cursor, &qw_cursor::notify_frame, this, &TinywlServer::onCursorFrame);
connect(backend, &qw_backend::notify_new_input, this, &TinywlServer::onNewInput);
seat = qw_seat::create(*display, "seat0");
connect(seat, &qw_seat::notify_request_set_cursor, this, &TinywlServer::onRequestSetCursor);
connect(seat, &qw_seat::notify_request_set_selection, this, &TinywlServer::onRequestSetSelection);
}
TinywlServer::~TinywlServer()
{
delete backend;
}
bool TinywlServer::start()
{
const char *socket = display->add_socket_auto();
if (!socket) {
return false;
}
if (!backend->start())
return false;
qputenv("WAYLAND_DISPLAY", QByteArray(socket));
qInfo("Running Wayland compositor on WAYLAND_DISPLAY=%s", socket);
display->start(qApp->thread());
return true;
}
void TinywlServer::onNewOutput(wlr_output *wl_output)
{
auto output = qw_output::from(wl_output);
Q_ASSERT(output);
outputs.append(output);
output->init_render(*allocator, *renderer);
wlr_output_state state;
wlr_output_state_init(&state);
if (!wl_list_empty(&output->handle()->modes)) {
auto *mode = output->preferred_mode();
wlr_output_state_set_mode(&state, mode);
}
wlr_output_state_set_enabled(&state, true);
if (!output->commit_state(&state))
return;
connect(output, &qw_output::notify_frame, this, &TinywlServer::onOutputFrame);
auto l_output =outputLayout->add_auto(*output);
auto sceneOutput = qw_scene_output::create(*scene, *output);
scene_layout->add_output(l_output, *sceneOutput);
}
#if WLR_VERSION_MINOR < 18
void TinywlServer::onNewXdgSurface(wlr_xdg_surface *surface)
{
if (surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
onNewXdgPopup(surface->popup);
} else {
Q_ASSERT(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
onNewXdgToplevel(surface->toplevel);
}
}
#endif
#if QT_VERSION_MAJOR < 6
Q_DECLARE_METATYPE(QMetaObject::Connection)
#endif
void TinywlServer::onNewXdgPopup(wlr_xdg_popup *popup)
{
auto parent = qw_xdg_surface::try_from_wlr_surface(popup->parent);
qw_scene_tree *parentTree = reinterpret_cast<qw_scene_tree*>(parent->handle()->data);
popup->base->data = qw_scene::xdg_surface_create(*parentTree, popup->base);
#if WLR_VERSION_MINOR >= 18
auto qwPopup = qw_xdg_popup::from(popup);
QMetaObject::Connection initialCommitConn = connect(qw_surface::from(popup->base->surface), &qw_surface::notify_commit,
qwPopup, [qwPopup] {
if (qwPopup->handle()->base->initial_commit) {
qw_xdg_surface::from(qwPopup->handle()->base)->schedule_configure();
QObject::disconnect(qvariant_cast<QMetaObject::Connection>(qwPopup->property("__initialCommitConn")));
qwPopup->setProperty("__initialCommitConn", QVariant());
}
});
qwPopup->setProperty("__initialCommitConn", QVariant::fromValue(initialCommitConn));
#endif
return;
}
void TinywlServer::onNewXdgToplevel(wlr_xdg_toplevel *toplevel)
{
auto view = new View();
view->server = this;
auto s = qw_xdg_toplevel::from(toplevel);
view->xdgToplevel = s;
view->sceneTree = qw_scene::xdg_surface_create(&(*scene)->tree, toplevel->base);
view->sceneTree->handle()->node.data = view;
toplevel->base->data = view->sceneTree;
auto *ss = qw_surface::from(toplevel->base->surface);
connect(ss, &qw_surface::notify_map, this, &TinywlServer::onMap);
connect(ss, &qw_surface::notify_unmap, this, &TinywlServer::onUnmap);
connect(s, &qw_xdg_toplevel::notify_request_move, this, &TinywlServer::onXdgToplevelRequestMove);
connect(s, &qw_xdg_toplevel::notify_request_resize, this, &TinywlServer::onXdgToplevelRequestResize);
connect(s, &qw_xdg_toplevel::notify_request_maximize, this, &TinywlServer::onXdgToplevelRequestMaximize);
connect(s, &qw_xdg_toplevel::notify_request_fullscreen, this, &TinywlServer::onXdgToplevelRequestRequestFullscreen);
connect(s, &qw_xdg_toplevel::before_destroy, this, [this, view] {
views.removeOne(view);
if (grabbedView == view)
grabbedView = nullptr;
delete view;
});
#if WLR_VERSION_MINOR >= 18
QMetaObject::Connection initialCommitConn = connect(qw_surface::from(toplevel->base->surface), &qw_surface::notify_commit,
s, [s] {
if (s->handle()->base->initial_commit) {
s->set_size(0, 0);
QObject::disconnect(qvariant_cast<QMetaObject::Connection>(s->property("__initialCommitConn")));
s->setProperty("__initialCommitConn", QVariant());
}
});
s->setProperty("__initialCommitConn", QVariant::fromValue(initialCommitConn));
#endif
}
void TinywlServer::onMap()
{
auto surface = qw_xdg_surface::try_from_wlr_surface(*qobject_cast<qw_surface*>(sender()));
if (!surface)
return;
auto view = getView(surface);
Q_ASSERT(view);
views.append(view);
focusView(view, (*surface)->surface);
}
void TinywlServer::onUnmap()
{
auto surface = qw_xdg_surface::try_from_wlr_surface(*qobject_cast<qw_surface*>(sender()));
if (!surface)
return;
auto view = getView(surface);
Q_ASSERT(view);
views.removeOne(view);
}
void TinywlServer::onXdgToplevelRequestMove(wlr_xdg_toplevel_move_event *)
{
auto surface = qobject_cast<qw_xdg_toplevel*>(sender());
auto view = getView(qw_xdg_surface::from((*surface)->base));
Q_ASSERT(view);
beginInteractive(view, CursorState::MovingWindow, 0);
}
void TinywlServer::onXdgToplevelRequestResize(wlr_xdg_toplevel_resize_event *event)
{
auto surface = qobject_cast<qw_xdg_toplevel*>(sender());
auto view = getView(qw_xdg_surface::from((*surface)->base));
Q_ASSERT(view);
beginInteractive(view, CursorState::ResizingWindow, event->edges);
}
void TinywlServer::onXdgToplevelRequestMaximize()
{
auto surface = qobject_cast<qw_xdg_toplevel*>(sender());
qw_xdg_surface::from((*surface)->base)->schedule_configure();
}
void TinywlServer::onXdgToplevelRequestRequestFullscreen()
{
auto surface = qobject_cast<qw_xdg_toplevel*>(sender());
qw_xdg_surface::from((*surface)->base)->schedule_configure();
}
void TinywlServer::onCursorMotion(wlr_pointer_motion_event *event)
{
cursor->move(&event->pointer->base, event->delta_x, event->delta_y);
processCursorMotion(event->time_msec);
}
void TinywlServer::onCursorMotionAbsolute(wlr_pointer_motion_absolute_event *event)
{
cursor->warp_absolute(&event->pointer->base, event->x, event->y);
processCursorMotion(event->time_msec);
}
void TinywlServer::onCursorButton(wlr_pointer_button_event *event)
{
seat->pointer_notify_button(event->time_msec, event->button, event->state);
QPointF spos;
wlr_surface *surface = nullptr;
auto view = viewAt(QPointF((*cursor)->x, (*cursor)->y), &surface, &spos);
#if WLR_VERSION_MINOR > 17
if (event->state == WL_POINTER_BUTTON_STATE_RELEASED) {
#else
if (event->state == WLR_BUTTON_RELEASED) {
#endif
cursorState = CursorState::Normal;
} else {
focusView(view, surface);
}
}
void TinywlServer::onCursorAxis(wlr_pointer_axis_event *event)
{
seat->pointer_notify_axis(event->time_msec, event->orientation,
event->delta, event->delta_discrete, event->source
#if WLR_VERSION_MINOR > 17
, event->relative_direction
#endif
);
}
void TinywlServer::onCursorFrame()
{
seat->pointer_notify_frame();
}
void TinywlServer::onNewInput(wlr_input_device *wl_device)
{
auto device = qw_input_device::from(wl_device);
if (qw_keyboard *keyboard = qobject_cast<qw_keyboard*>(device)) {
xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
xkb_keymap *keymap = xkb_keymap_new_from_names(context, nullptr, XKB_KEYMAP_COMPILE_NO_FLAGS);
keyboard->set_keymap(keymap);
xkb_keymap_unref(keymap);
xkb_context_unref(context);
keyboard->set_repeat_info(25, 600);
connect(keyboard, &qw_keyboard::notify_modifiers, this, &TinywlServer::onKeyboardModifiers);
connect(keyboard, &qw_keyboard::notify_key, this, &TinywlServer::onKeyboardKey);
connect(keyboard, &qw_keyboard::before_destroy, this, &TinywlServer::onKeyboardDestroy);
seat->set_keyboard(*keyboard);
Q_ASSERT(!keyboards.contains(keyboard));
keyboards.append(keyboard);
} else if (device->handle()->type == WLR_INPUT_DEVICE_POINTER) {
cursor->attach_input_device(*device);
}
uint32_t caps = WL_SEAT_CAPABILITY_POINTER;
if (!keyboards.isEmpty()) {
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
}
seat->set_capabilities(caps);
}
void TinywlServer::onRequestSetCursor(wlr_seat_pointer_request_set_cursor_event *event)
{
if (seat->handle()->pointer_state.focused_client == event->seat_client)
cursor->set_surface(event->surface, event->hotspot_x, event->hotspot_y);
}
void TinywlServer::onRequestSetSelection(wlr_seat_request_set_selection_event *event)
{
seat->set_selection(event->source, event->serial);
}
void TinywlServer::onKeyboardModifiers()
{
qw_keyboard *keyboard = qobject_cast<qw_keyboard*>(QObject::sender());
seat->set_keyboard(*keyboard);
seat->keyboard_notify_modifiers(&keyboard->handle()->modifiers); // (*keyboard)->modifiers
}
void TinywlServer::onKeyboardKey(wlr_keyboard_key_event *event)
{
qw_keyboard *keyboard = qobject_cast<qw_keyboard*>(QObject::sender());
// Translate libinput keycode -> xkbcommon
uint32_t keycode = event->keycode + 8;
const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(keyboard->handle()->xkb_state, keycode, &syms);
bool handled = false;
uint32_t modifiers = keyboard->get_modifiers();
if ((modifiers & (WLR_MODIFIER_ALT | WLR_MODIFIER_CTRL))
&& event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
for (int i = 0; i < nsyms; i++)
handled = handleKeybinding(syms[i]);
}
if (!handled) {
seat->set_keyboard(*keyboard);
seat->keyboard_notify_key(event->time_msec, event->keycode, event->state);
}
}
void TinywlServer::onKeyboardDestroy()
{
qw_keyboard *keyboard = qobject_cast<qw_keyboard*>(QObject::sender());
keyboards.removeOne(keyboard);
}
void TinywlServer::onOutputFrame()
{
auto output = qobject_cast<qw_output*>(sender());
Q_ASSERT(output);
auto sceneOutput = qw_scene_output::from(scene->get_scene_output(*output));
sceneOutput->commit(nullptr);
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
sceneOutput->send_frame_done(&now);
}
TinywlServer::View *TinywlServer::getView(const qw_xdg_surface *surface)
{
auto sceneTree = reinterpret_cast<qw_scene_tree*>(surface->handle()->data);
return reinterpret_cast<View*>(sceneTree->handle()->node.data);
}
TinywlServer::View *TinywlServer::viewAt(const QPointF &pos, wlr_surface **surface, QPointF *spos) const
{
double spos_x, spos_y;
auto node = scene->at(pos.x(), pos.y(), &spos_x, &spos_y);
spos->setX(spos_x);
spos->setY(spos_y);
if (!node || node->type != WLR_SCENE_NODE_BUFFER) {
return nullptr;
}
auto *sceneBuffer = qw_scene_buffer::from(node);
auto *sceneSurface = wlr_scene_surface_try_from_buffer(sceneBuffer->handle());
if (!sceneSurface)
return nullptr;
*surface = sceneSurface->surface;
wlr_scene_tree *tree = node->parent;
while (tree && !tree->node.data) {
tree = tree->node.parent;
}
return tree ? reinterpret_cast<View*>(tree->node.data) : nullptr;
}
void TinywlServer::processCursorMotion(uint32_t time)
{
if (cursorState == CursorState::MovingWindow) {
grabbedView->pos = grabGeoBox.topLeft() + (QPointF((*cursor)->x, (*cursor)->y) - grabCursorPos);
grabbedView->sceneTree->set_position(grabbedView->pos.x(), grabbedView->pos.y());
return;
} else if (cursorState == CursorState::ResizingWindow) {
const QPointF cursorPos((*cursor)->x, (*cursor)->y);
QRectF newGeoBox = grabGeoBox;
const int minimumSize = 10;
if (resizingEdges & WLR_EDGE_TOP) {
newGeoBox.setTop(cursorPos.y());
} else if (resizingEdges & WLR_EDGE_BOTTOM) {
newGeoBox.setBottom(cursorPos.y());
}
if (resizingEdges & WLR_EDGE_LEFT) {
newGeoBox.setLeft(cursorPos.x());
} else if (resizingEdges & WLR_EDGE_RIGHT) {
newGeoBox.setRight(cursorPos.x());
}
QSize minSize(grabbedView->xdgToplevel->handle()->current.min_width,
grabbedView->xdgToplevel->handle()->current.min_height);
QSize maxSize(grabbedView->xdgToplevel->handle()->current.max_width,
grabbedView->xdgToplevel->handle()->current.max_height);
if (maxSize.width() == 0)
maxSize.setWidth(99999);
if (maxSize.height() == 0)
maxSize.setHeight(99999);
qw_box current_geo_box;
#if WLR_VERSION_MINOR < 19
qw_xdg_surface::from(grabbedView->xdgToplevel->handle()->base)->get_geometry(current_geo_box);
#else
current_geo_box = qw_box(qw_xdg_surface::from(grabbedView->xdgToplevel->handle()->base)->handle()->geometry);
#endif
auto currentGeoBox = current_geo_box.toQRect();
currentGeoBox.moveTopLeft((grabbedView->pos + currentGeoBox.topLeft()).toPoint());
if (newGeoBox.width() < qMax(minimumSize, minSize.width()) || newGeoBox.width() > maxSize.width()) {
newGeoBox.setLeft(currentGeoBox.left());
newGeoBox.setRight(currentGeoBox.right());
}
if (newGeoBox.height() < qMax(minimumSize, minSize.height()) || newGeoBox.height() > maxSize.height()) {
newGeoBox.setTop(currentGeoBox.top());
newGeoBox.setBottom(currentGeoBox.bottom());
}
grabbedView->pos = newGeoBox.topLeft();
const QPoint &treePosition = grabbedView->pos.toPoint();
grabbedView->sceneTree->set_position(treePosition.x(), treePosition.y());
const QSize &toplevelSize = newGeoBox.size().toSize();
grabbedView->xdgToplevel->set_size(toplevelSize.width(), toplevelSize.height());
return;
}
wlr_surface *surface = nullptr;
QPointF spos;
auto view = viewAt(QPointF((*cursor)->x, (*cursor)->y), &surface, &spos);
if (!view)
cursor->set_xcursor(*cursorManager, "left_ptr");
if (surface) {
seat->pointer_notify_enter(surface, spos.x(), spos.y());
seat->pointer_notify_motion(time, spos.x(), spos.y());
} else {
seat->pointer_clear_focus();
}
}
void TinywlServer::focusView(View *view, wlr_surface *surface)
{
if (!view)
return;
wlr_surface *prevSurface = seat->handle()->keyboard_state.focused_surface;
if (prevSurface == surface) {
return;
}
if (prevSurface) {
auto toplevel = qw_xdg_toplevel::try_from_wlr_surface(prevSurface);
Q_ASSERT(toplevel);
toplevel->set_activated(false);
}
view->sceneTree->raise_to_top();
views.move(views.indexOf(view), 0);
view->xdgToplevel->set_activated(true);
if (wlr_keyboard *keyboard = seat->get_keyboard()) {
seat->keyboard_notify_enter(view->xdgToplevel->handle()->base->surface,
keyboard->keycodes, keyboard->num_keycodes, &keyboard->modifiers);
}
}
void TinywlServer::beginInteractive(View *view, CursorState state, uint32_t edges)
{
wlr_surface *focusedSurface = (*seat)->pointer_state.focused_surface;
if (view->xdgToplevel->handle()->base->surface !=
wlr_surface_get_root_surface(focusedSurface)) {
return;
}
grabbedView = view;
cursorState = state;
grabCursorPos = QPointF((*cursor)->x, (*cursor)->y);
wlr_box grab_geo_box;
#if WLR_VERSION_MINOR < 19
qw_xdg_surface::from(view->xdgToplevel->handle()->base)->get_geometry(&grab_geo_box);
#else
grab_geo_box = qw_xdg_surface::from(view->xdgToplevel->handle()->base)->handle()->geometry;
#endif
grabGeoBox.moveTopLeft(view->pos + QPoint(grab_geo_box.x, grab_geo_box.y));
grabGeoBox.setWidth(grab_geo_box.width);
grabGeoBox.setHeight(grab_geo_box.height);
resizingEdges = edges;
}
bool TinywlServer::handleKeybinding(xkb_keysym_t sym)
{
switch (sym) {
case XKB_KEY_Escape:
display->terminate();
qApp->exit();
break;
case XKB_KEY_F1:
if (views.size() < 2)
break;
focusView(views.at(1), views.at(1)->xdgToplevel->handle()->base->surface);
break;
default:
return false;
}
return true;
}
int main(int argc, char **argv)
{
qw_log::init();
QGuiApplication app(argc, argv);
app.setApplicationName("tinywl");
app.setApplicationVersion("0.0.1");
QCommandLineOption startup("s", "startup command", "command");
QCommandLineParser cl;
cl.addOption(startup);
cl.addHelpOption();
cl.addVersionOption();
cl.process(app);
TinywlServer server;
if (!server.start())
return -1;
if (cl.isSet(startup)) {
const QString command = cl.value(startup);
QProcess::startDetached("/bin/sh", {"-c", command});
}
return app.exec();
}
#include "main.moc"

Some files were not shown because too many files have changed in this diff Show More