From 0a288467220c5e833c765f786e36007e2673dc13 Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Sat, 31 Jan 2026 13:43:39 +0800 Subject: [PATCH] fix: set default window title for panel windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Added logic to set a default window title for panel QWindow objects if the title is empty 2. The default title is set to the pluginId() value 3. This change helps window managers distinguish dde-shell windows by setting the _NET_WM_NAME X window property 4. The title setting occurs when the rootObjectChanged signal is emitted, ensuring it applies to newly created panel windows Log: Fixed panel windows not having identifiable titles for window managers Influence: 1. Verify panel windows now have proper titles in window manager listings 2. Test that existing custom titles are not overwritten 3. Check that the _NET_WM_NAME property is correctly set for X11 window managers 4. Ensure window switching and identification works correctly with the new titles fix: 为面板窗口设置默认窗口标题 1. 添加逻辑为面板QWindow对象设置默认窗口标题(当标题为空时) 2. 默认标题设置为pluginId()的值 3. 此更改通过设置_NET_WM_NAME X窗口属性,帮助窗口管理器区分dde-shell窗口 4. 标题设置在rootObjectChanged信号发出时执行,确保应用于新创建的面板窗口 Log: 修复面板窗口缺少可识别标题导致窗口管理器无法区分的问题 Influence: 1. 验证面板窗口现在在窗口管理器列表中具有正确的标题 2. 测试现有的自定义标题不会被覆盖 3. 检查_NET_WM_NAME属性是否正确设置给X11窗口管理器 4. 确保窗口切换和识别功能在新标题下正常工作 --- frame/panel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frame/panel.cpp b/frame/panel.cpp index bd906ad45..afa1b3573 100644 --- a/frame/panel.cpp +++ b/frame/panel.cpp @@ -22,6 +22,12 @@ DPanel::DPanel(QObject *parent) QObject::connect(this, &DPanel::rootObjectChanged, this, [this]() { D_D(DPanel); + if (auto window = qobject_cast(d->m_rootObject)) { + // set a default title if not set + if (window->title().isEmpty()) { + window->setTitle(pluginId()); + } + } d->ensurePopupWindow(); d->ensureToolTipWindow(); d->ensureMenuWindow();