Skip to content

Commit 8a25754

Browse files
committed
feat: add split window background support for dock app items
1. Created new AppBackground.qml component to handle split window background rendering 2. Added splitBackgroundVisible property to control split background display 3. Enhanced AppletItemBackground.qml with drawDefaultBackground property for conditional rendering 4. Modified AppItem.qml to use AppBackground instead of AppletItemBackground 5. Updated text calculation logic to remove extra spacing between icon and title 6. Added windowSplit property propagation through components 7. Improved title text color handling based on active state and theme Log: Added split window background visualization for dock app items Influence: 1. Test dock app items with multiple windows open in split mode 2. Verify background colors change correctly in light and dark themes 3. Check hover and active states for split window backgrounds 4. Test title text color changes when app is active 5. Verify spacing between icon and title in split mode 6. Test transition animations when switching between split and non- split modes feat: 为任务栏应用项添加分屏窗口背景支持 1. 创建新的 AppBackground.qml 组件处理分屏窗口背景渲染 2. 添加 splitBackgroundVisible 属性控制分屏背景显示 3. 增强 AppletItemBackground.qml 添加 drawDefaultBackground 属性用于条件 渲染 4. 修改 AppItem.qml 使用 AppBackground 替代 AppletItemBackground 5. 更新文本计算逻辑,移除图标和标题之间的额外间距 6. 添加 windowSplit 属性在组件间传递 7. 改进标题文本颜色处理,基于激活状态和主题 Log: 新增任务栏应用项分屏窗口背景可视化功能 Influence: 1. 测试分屏模式下打开多个窗口的任务栏应用项 2. 验证浅色和深色主题下背景颜色正确变化 3. 检查分屏窗口背景的悬停和激活状态 4. 测试应用激活时标题文本颜色变化 5. 验证分屏模式下图标和标题之间的间距 6. 测试分屏和非分屏模式切换时的过渡动画
1 parent 79ee98f commit 8a25754

8 files changed

Lines changed: 259 additions & 46 deletions

File tree

panels/dock/AppBackground.qml

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
2+
//
3+
// SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
import QtQuick
6+
import QtQuick.Controls
7+
8+
import org.deepin.ds.dock 1.0
9+
import org.deepin.dtk
10+
11+
AppletItemBackground {
12+
id: control
13+
drawDefaultBackground: false
14+
property bool splitBackgroundVisible: false
15+
property bool windowSplit: false
16+
property int windowCount: 0
17+
property int displayMode: Dock.Efficient
18+
property bool isHovered: false
19+
20+
property Palette splitBackgroundColor: Palette {
21+
normal {
22+
common: ("transparent")
23+
}
24+
hovered {
25+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.45)
26+
}
27+
hoveredDark: {
28+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.2)
29+
}
30+
pressed {
31+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.1)
32+
}
33+
pressedDark: {
34+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.35)
35+
}
36+
}
37+
backgroundColor: Palette {
38+
normal {
39+
common: ("transparent")
40+
}
41+
hovered {
42+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.15)
43+
}
44+
hoveredDark {
45+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.15)
46+
}
47+
pressed {
48+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.25)
49+
}
50+
pressedDark {
51+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.25)
52+
}
53+
}
54+
property Palette splitActiveBackgroundColor: Palette {
55+
normal {
56+
common: ("transparent")
57+
}
58+
hovered {
59+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.35)
60+
}
61+
hoveredDark: {
62+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.1)
63+
}
64+
pressed {
65+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.25)
66+
}
67+
pressedDark: pressed
68+
}
69+
activeBackgroundColor: Palette {
70+
normal {
71+
common: ("transparent")
72+
// crystal: Qt.rgba(1.0, 1.0, 1.0, 0.15)
73+
}
74+
normalDark: normal
75+
hovered {
76+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.25)
77+
}
78+
hoveredDark: hovered
79+
pressed {
80+
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.30)
81+
}
82+
pressedDark: pressed
83+
}
84+
insideBorderColor: Palette {
85+
normal {
86+
common: ("transparent")
87+
88+
}
89+
hovered {
90+
crystal: Qt.rgba(0, 0, 0, 0.05)
91+
}
92+
hoveredDark: hovered
93+
pressed: hovered
94+
pressedDark: pressed
95+
}
96+
97+
activeInsideBorderColor: Palette {
98+
normal {
99+
common: ("transparent")
100+
}
101+
normalDark: normal
102+
hovered {
103+
crystal: Qt.rgba(0.0, 0.0, 0.0, 0.10)
104+
}
105+
hoveredDark: hovered
106+
pressed: hovered
107+
pressedDark: pressed
108+
}
109+
outsideBorderColor: Palette {
110+
normal {
111+
common: ("transparent")
112+
}
113+
hovered {
114+
crystal: ("transparent")
115+
}
116+
hoveredDark: hovered
117+
pressed: hovered
118+
pressedDark: pressed
119+
}
120+
activeOutsideBorderColor: Palette {
121+
normal {
122+
common: ("transparent")
123+
}
124+
normalDark: normal
125+
hovered {
126+
crystal: Qt.rgba(0.0, 0.0, 0.0, 0.10)
127+
}
128+
hoveredDark: hovered
129+
pressed: Qt.rgba(0.0, 0.0, 0.0, 0.05)
130+
pressedDark: pressed
131+
}
132+
133+
Rectangle {
134+
anchors.fill: parent
135+
radius: control.radius
136+
visible: control.windowCount > 0 && control.displayMode === Dock.Efficient
137+
color: {
138+
if (displayMode === Dock.Efficient) {
139+
if (isActive) {
140+
return DTK.themeType === ApplicationHelper.DarkType
141+
? Qt.rgba(1.0, 1.0, 1.0, 0.6) : Qt.rgba(1.0, 1.0, 1.0, 0.8)
142+
} else {
143+
return DTK.themeType === ApplicationHelper.DarkType
144+
? Qt.rgba(1.0, 1.0, 1.0, 0.1) : Qt.rgba(1.0, 1.0, 1.0, 0.35)
145+
}
146+
}
147+
}
148+
}
149+
InsideBoxBorder {
150+
anchors.fill: parent
151+
radius: control.radius
152+
visible: control.windowCount > 0 && control.displayMode === Dock.Efficient
153+
color: {
154+
if (displayMode === Dock.Efficient) {
155+
if (isActive) {
156+
return DTK.themeType === ApplicationHelper.DarkType
157+
? Qt.rgba(0, 0, 0, 0.1) : Qt.rgba(0, 0, 0, 0.1)
158+
} else {
159+
return DTK.themeType === ApplicationHelper.DarkType
160+
? Qt.rgba(0, 0, 0, 0.05) : Qt.rgba(0, 0, 0, 0.05)
161+
}
162+
}
163+
}
164+
borderWidth: 1 / Screen.devicePixelRatio
165+
}
166+
OutsideBoxBorder {
167+
anchors.fill: parent
168+
radius: control.radius
169+
visible: control.windowCount > 0 && control.displayMode === Dock.Efficient
170+
color: {
171+
if (displayMode === Dock.Efficient) {
172+
if (isActive) {
173+
return DTK.themeType === ApplicationHelper.DarkType
174+
? Qt.rgba(0, 0, 0, 0.1) : Qt.rgba(0, 0, 0, 0.1)
175+
} else {
176+
return ("transparent")
177+
}
178+
}
179+
}
180+
borderWidth: 1 / Screen.devicePixelRatio
181+
}
182+
183+
Rectangle {
184+
anchors.fill: parent
185+
radius: control.radius
186+
color: {
187+
if (control.splitBackgroundVisible) {
188+
if (isActive) {
189+
return control.ColorSelector.splitActiveBackgroundColor
190+
}
191+
return control.ColorSelector.splitBackgroundColor
192+
} else {
193+
if (isActive) {
194+
return control.ColorSelector.activeBackgroundColor
195+
}
196+
return control.ColorSelector.backgroundColor
197+
}
198+
199+
}
200+
}
201+
InsideBoxBorder {
202+
anchors.fill: parent
203+
radius: control.radius
204+
205+
color: isActive ? control.ColorSelector.activeInsideBorderColor
206+
: control.ColorSelector.insideBorderColor
207+
borderWidth: 1 / Screen.devicePixelRatio
208+
}
209+
OutsideBoxBorder {
210+
anchors.fill: parent
211+
radius: control.radius
212+
213+
color: isActive ? control.ColorSelector.activeOutsideBorderColor
214+
: control.ColorSelector.outsideBorderColor
215+
borderWidth: 1 / Screen.devicePixelRatio
216+
}
217+
}

panels/dock/AppletItemBackground.qml

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

@@ -12,6 +12,7 @@ MouseArea {
1212
id: control
1313
property bool isActive
1414
property real radius: 4
15+
property bool drawDefaultBackground: true
1516

1617
// can accept mouse event,prevent further event delivery
1718
acceptedButtons: Qt.LeftButton | Qt.RightButton
@@ -89,19 +90,22 @@ MouseArea {
8990
Rectangle {
9091
anchors.fill: parent
9192
radius: control.radius
93+
visible: control.drawDefaultBackground
9294
color: isActive ? control.ColorSelector.activeBackgroundColor
9395
: control.ColorSelector.backgroundColor
9496
}
9597
InsideBoxBorder {
9698
anchors.fill: parent
9799
radius: control.radius
100+
visible: control.drawDefaultBackground
98101
color: isActive ? control.ColorSelector.activeInsideBorderColor
99102
: control.ColorSelector.insideBorderColor
100103
borderWidth: 1 / Screen.devicePixelRatio
101104
}
102105
OutsideBoxBorder {
103106
anchors.fill: parent
104107
radius: control.radius
108+
visible: control.drawDefaultBackground
105109
color: isActive ? control.ColorSelector.activeOutsideBorderColor
106110
: control.ColorSelector.outsideBorderColor
107111
borderWidth: 1 / Screen.devicePixelRatio

panels/dock/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ qt_add_qml_module(dock-plugin
135135
QML_FILES DockCompositor.qml OverflowContainer.qml MenuHelper.qml DockPalette.qml
136136
AppletItemButton.qml
137137
AppletItemBackground.qml
138+
AppBackground.qml
138139
OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/plugins/org/deepin/ds/dock/
139140
)
140141

0 commit comments

Comments
 (0)