Skip to content

Commit e907303

Browse files
committed
feat(wm-helper): support system window menu on treeland/wayland
1. Add Wayland-specific path for popupSystemWindowMenu 2. Show window menu via QWaylandShellSurface for treeland compositor 3. Include necessary Qt Wayland private headers Log: Add Wayland window menu support for treeland compositor feat(wm-helper): 支持 treeland/wayland 系统窗口菜单 1. 为 popupSystemWindowMenu 添加 Wayland 专用路径 2. 通过 QWaylandShellSurface 为 treeland 合成器显示窗口菜单 3. 引入必要的 Qt Wayland 私有头文件 Log: 为 treeland 合成器添加 Wayland 窗口菜单支持 PMS: TASK-389419
1 parent c7682a2 commit e907303

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/kernel/dwindowmanagerhelper.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: LGPL-3.0-or-later
44

@@ -26,6 +26,10 @@
2626

2727
#ifndef DTK_DISABLE_TREELAND
2828
#include "plugins/platform/treeland/dtreelandwindowmanagerhelper.h"
29+
#include <private/qguiapplication_p.h>
30+
#include <private/qwaylandwindow_p.h>
31+
#include <private/qwaylandshellsurface_p.h>
32+
#include <private/qwaylandintegration_p.h>
2933
#endif
3034

3135
DGUI_BEGIN_NAMESPACE
@@ -524,6 +528,20 @@ void DWindowManagerHelper::setWmClassName(const QByteArray &name)
524528
*/
525529
void DWindowManagerHelper::popupSystemWindowMenu(const QWindow *window)
526530
{
531+
#ifndef DTK_DISABLE_TREELAND
532+
if (DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform)) {
533+
if (window && window->handle()) {
534+
if (auto *wlWindow = dynamic_cast<QtWaylandClient::QWaylandWindow*>(window->handle())) {
535+
if (auto *shellSurface = wlWindow->shellSurface()) {
536+
auto *wlIntegration = static_cast<QtWaylandClient::QWaylandIntegration*>(
537+
QGuiApplicationPrivate::platformIntegration());
538+
shellSurface->showWindowMenu(wlIntegration->display()->defaultInputDevice());
539+
}
540+
}
541+
}
542+
return;
543+
}
544+
#endif
527545
return callPlatformFunction<void, void(*)(quint32)>(_popupSystemWindowMenu, quint32(window->handle()->winId()));
528546
}
529547

0 commit comments

Comments
 (0)