megacoffee.net Gentoo overlay - legacy mirror
We have moved to Git. This repository is only provided for compatibility with old installations. Learn how to migrate your installation here.
comparison kde-plasma/breeze/files/5.27.4_breeze_mr292_outline_intensity_setting.patch @ 250:37508d4f31c8
[sync] imported 18f98a6..d0858fb from upstream
commit d0858fbd09faf50138d7ad3a4559ba1f3e2b930c
Author: Daniel Neugebauer <dneuge@energiequant.de>
Date: Thu Apr 27 12:49:23 2023 +0200
kde-plasma/breeze: configurable outline (MR 292) via patch_outline
Source: https://invent.kde.org/plasma/breeze/-/merge_requests/292
commit ef044cae13e73c5f9dd2d078a4879df3987cc69a
Author: Daniel Neugebauer <dneuge@energiequant.de>
Date: Thu Apr 27 12:26:14 2023 +0200
kde-plasma/breeze-5.27.4 copied from main Gentoo repository
author | Migration Sync <gentoo-overlay@megacoffee.net> |
---|---|
date | Thu, 27 Apr 2023 11:00:03 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
249:0685ed0fb913 | 250:37508d4f31c8 |
---|---|
1 From a77b1e00416d7d946539a3c2335b42e8c81cbe54 Mon Sep 17 00:00:00 2001 | |
2 From: Akseli Lahtinen <akselmo@akselmo.dev> | |
3 Date: Sun, 26 Feb 2023 18:37:54 +0200 | |
4 Subject: [PATCH 1/7] add m_outlineIntensity, check for outline intensity | |
5 before drawing | |
6 | |
7 --- | |
8 kdecoration/breezedecoration.cpp | 62 ++++++++++++++++---------------- | |
9 kdecoration/breezedecoration.h | 2 ++ | |
10 2 files changed, 34 insertions(+), 30 deletions(-) | |
11 | |
12 diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp | |
13 index cc5bb75d7..699221b79 100644 | |
14 --- a/kdecoration/breezedecoration.cpp | |
15 +++ b/kdecoration/breezedecoration.cpp | |
16 @@ -743,7 +743,7 @@ void Decoration::updateShadow() | |
17 outlineColor.hslSaturationF(), | |
18 qBound(0.1, outlineColor.lightnessF(), 1.0), | |
19 s->isAlphaChannelSupported() ? 0.9 : 1.0); | |
20 - outlineColor.lightnessF() >= 0.5 ? outlineColor = outlineColor.darker(170) : outlineColor = outlineColor.lighter(170); | |
21 + outlineColor.lightnessF() >= 0.5 ? outlineColor = outlineColor.darker(m_outlineIntensity) : outlineColor = outlineColor.lighter(m_outlineIntensity); | |
22 | |
23 // Animated case, no cached shadow object | |
24 if ((m_shadowAnimation->state() == QAbstractAnimation::Running) && (m_shadowOpacity != 0.0) && (m_shadowOpacity != 1.0)) { | |
25 @@ -821,36 +821,38 @@ QSharedPointer<KDecoration2::DecorationShadow> Decoration::createShadowObject(co | |
26 painter.drawRoundedRect(innerRect, m_scaledCornerRadius + 0.5, m_scaledCornerRadius + 0.5); | |
27 | |
28 // Draw window outline | |
29 - const qreal outlineWidth = 1.001; | |
30 - const qreal penOffset = outlineWidth / 2; | |
31 - | |
32 - QRectF outlineRect = innerRect + QMarginsF(penOffset, penOffset, penOffset, penOffset); | |
33 - qreal cornerSize = m_scaledCornerRadius * 2; | |
34 - QRectF cornerRect(outlineRect.x(), outlineRect.y(), cornerSize, cornerSize); | |
35 - QPainterPath outlinePath; | |
36 - | |
37 - outlinePath.arcMoveTo(cornerRect, 180); | |
38 - outlinePath.arcTo(cornerRect, 180, -90); | |
39 - cornerRect.moveTopRight(outlineRect.topRight()); | |
40 - outlinePath.arcTo(cornerRect, 90, -90); | |
41 - | |
42 - // Check if border size is "no borders" or "no side-borders" | |
43 - if (borderSize(true) == 0) { | |
44 - outlinePath.lineTo(outlineRect.bottomRight()); | |
45 - outlinePath.lineTo(outlineRect.bottomLeft()); | |
46 - } else { | |
47 - cornerRect.moveBottomRight(outlineRect.bottomRight()); | |
48 - outlinePath.arcTo(cornerRect, 0, -90); | |
49 - cornerRect.moveBottomLeft(outlineRect.bottomLeft()); | |
50 - outlinePath.arcTo(cornerRect, 270, -90); | |
51 - } | |
52 - outlinePath.closeSubpath(); | |
53 + if (m_outlineIntensity > 0) { | |
54 + const qreal outlineWidth = 1.001; | |
55 + const qreal penOffset = outlineWidth / 2; | |
56 + | |
57 + QRectF outlineRect = innerRect + QMarginsF(penOffset, penOffset, penOffset, penOffset); | |
58 + qreal cornerSize = m_scaledCornerRadius * 2; | |
59 + QRectF cornerRect(outlineRect.x(), outlineRect.y(), cornerSize, cornerSize); | |
60 + QPainterPath outlinePath; | |
61 + | |
62 + outlinePath.arcMoveTo(cornerRect, 180); | |
63 + outlinePath.arcTo(cornerRect, 180, -90); | |
64 + cornerRect.moveTopRight(outlineRect.topRight()); | |
65 + outlinePath.arcTo(cornerRect, 90, -90); | |
66 + | |
67 + // Check if border size is "no borders" or "no side-borders" | |
68 + if (borderSize(true) == 0) { | |
69 + outlinePath.lineTo(outlineRect.bottomRight()); | |
70 + outlinePath.lineTo(outlineRect.bottomLeft()); | |
71 + } else { | |
72 + cornerRect.moveBottomRight(outlineRect.bottomRight()); | |
73 + outlinePath.arcTo(cornerRect, 0, -90); | |
74 + cornerRect.moveBottomLeft(outlineRect.bottomLeft()); | |
75 + outlinePath.arcTo(cornerRect, 270, -90); | |
76 + } | |
77 + outlinePath.closeSubpath(); | |
78 | |
79 - painter.setPen(QPen(outlineColor, outlineWidth)); | |
80 - painter.setBrush(Qt::NoBrush); | |
81 - painter.setCompositionMode(QPainter::CompositionMode_Source); | |
82 - painter.setRenderHint(QPainter::Antialiasing); | |
83 - painter.drawPath(outlinePath); | |
84 + painter.setPen(QPen(outlineColor, outlineWidth)); | |
85 + painter.setBrush(Qt::NoBrush); | |
86 + painter.setCompositionMode(QPainter::CompositionMode_Source); | |
87 + painter.setRenderHint(QPainter::Antialiasing); | |
88 + painter.drawPath(outlinePath); | |
89 + } | |
90 | |
91 painter.end(); | |
92 | |
93 diff --git a/kdecoration/breezedecoration.h b/kdecoration/breezedecoration.h | |
94 index 826e396d8..0cb7864d9 100644 | |
95 --- a/kdecoration/breezedecoration.h | |
96 +++ b/kdecoration/breezedecoration.h | |
97 @@ -131,6 +131,8 @@ private: | |
98 qreal m_opacity = 0; | |
99 qreal m_shadowOpacity = 0; | |
100 | |
101 + int m_outlineIntensity = 170; | |
102 + | |
103 //*frame corner radius, scaled according to DPI | |
104 qreal m_scaledCornerRadius = 3; | |
105 | |
106 -- | |
107 GitLab | |
108 | |
109 | |
110 From 31a801b59d7cb33a4c1d944ee0ab49637f5c7dc0 Mon Sep 17 00:00:00 2001 | |
111 From: Akseli Lahtinen <akselmo@akselmo.dev> | |
112 Date: Sun, 26 Feb 2023 20:08:52 +0200 | |
113 Subject: [PATCH 2/7] add outline intensity setting | |
114 | |
115 --- | |
116 kdecoration/breezedecoration.cpp | 5 ++-- | |
117 kdecoration/breezedecoration.h | 2 -- | |
118 kdecoration/breezesettingsdata.kcfg | 6 +++++ | |
119 kdecoration/config/breezeconfigwidget.cpp | 6 +++++ | |
120 .../config/ui/breezeconfigurationui.ui | 25 ++++++++++++++++++- | |
121 5 files changed, 39 insertions(+), 5 deletions(-) | |
122 | |
123 diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp | |
124 index 699221b79..d6ae873e5 100644 | |
125 --- a/kdecoration/breezedecoration.cpp | |
126 +++ b/kdecoration/breezedecoration.cpp | |
127 @@ -743,7 +743,8 @@ void Decoration::updateShadow() | |
128 outlineColor.hslSaturationF(), | |
129 qBound(0.1, outlineColor.lightnessF(), 1.0), | |
130 s->isAlphaChannelSupported() ? 0.9 : 1.0); | |
131 - outlineColor.lightnessF() >= 0.5 ? outlineColor = outlineColor.darker(m_outlineIntensity) : outlineColor = outlineColor.lighter(m_outlineIntensity); | |
132 + outlineColor.lightnessF() >= 0.5 ? outlineColor = outlineColor.darker(m_internalSettings->outlineIntensity()) | |
133 + : outlineColor = outlineColor.lighter(m_internalSettings->outlineIntensity()); | |
134 | |
135 // Animated case, no cached shadow object | |
136 if ((m_shadowAnimation->state() == QAbstractAnimation::Running) && (m_shadowOpacity != 0.0) && (m_shadowOpacity != 1.0)) { | |
137 @@ -821,7 +822,7 @@ QSharedPointer<KDecoration2::DecorationShadow> Decoration::createShadowObject(co | |
138 painter.drawRoundedRect(innerRect, m_scaledCornerRadius + 0.5, m_scaledCornerRadius + 0.5); | |
139 | |
140 // Draw window outline | |
141 - if (m_outlineIntensity > 0) { | |
142 + if (m_internalSettings->outlineIntensity() > 0) { | |
143 const qreal outlineWidth = 1.001; | |
144 const qreal penOffset = outlineWidth / 2; | |
145 | |
146 diff --git a/kdecoration/breezedecoration.h b/kdecoration/breezedecoration.h | |
147 index 0cb7864d9..826e396d8 100644 | |
148 --- a/kdecoration/breezedecoration.h | |
149 +++ b/kdecoration/breezedecoration.h | |
150 @@ -131,8 +131,6 @@ private: | |
151 qreal m_opacity = 0; | |
152 qreal m_shadowOpacity = 0; | |
153 | |
154 - int m_outlineIntensity = 170; | |
155 - | |
156 //*frame corner radius, scaled according to DPI | |
157 qreal m_scaledCornerRadius = 3; | |
158 | |
159 diff --git a/kdecoration/breezesettingsdata.kcfg b/kdecoration/breezesettingsdata.kcfg | |
160 index f57f61fe4..616035f9e 100644 | |
161 --- a/kdecoration/breezesettingsdata.kcfg | |
162 +++ b/kdecoration/breezesettingsdata.kcfg | |
163 @@ -35,6 +35,12 @@ | |
164 <default>false</default> | |
165 </entry> | |
166 | |
167 + <entry name="OutlineIntensity" type = "Int"> | |
168 + <default>170</default> | |
169 + <min>0</min> | |
170 + <max>200</max> | |
171 + </entry> | |
172 + | |
173 </group> | |
174 | |
175 <group name="Windeco"> | |
176 diff --git a/kdecoration/config/breezeconfigwidget.cpp b/kdecoration/config/breezeconfigwidget.cpp | |
177 index f75e1b3b7..e1e0dd63a 100644 | |
178 --- a/kdecoration/config/breezeconfigwidget.cpp | |
179 +++ b/kdecoration/config/breezeconfigwidget.cpp | |
180 @@ -38,6 +38,7 @@ ConfigWidget::ConfigWidget(QWidget *parent, const QVariantList &args) | |
181 connect(m_ui.shadowSize, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged())); | |
182 connect(m_ui.shadowStrength, SIGNAL(valueChanged(int)), SLOT(updateChanged())); | |
183 connect(m_ui.shadowColor, &KColorButton::changed, this, &ConfigWidget::updateChanged); | |
184 + connect(m_ui.outlineIntensity, SIGNAL(valueChanged(int)), SLOT(updateChanged())); | |
185 | |
186 // track exception changes | |
187 connect(m_ui.exceptions, &ExceptionListWidget::changed, this, &ConfigWidget::updateChanged); | |
188 @@ -69,6 +70,7 @@ void ConfigWidget::load() | |
189 | |
190 m_ui.shadowStrength->setValue(qRound(qreal(m_internalSettings->shadowStrength() * 100) / 255)); | |
191 m_ui.shadowColor->setColor(m_internalSettings->shadowColor()); | |
192 + m_ui.outlineIntensity->setValue(m_internalSettings->outlineIntensity()); | |
193 | |
194 // load exceptions | |
195 ExceptionList exceptions; | |
196 @@ -94,6 +96,7 @@ void ConfigWidget::save() | |
197 m_internalSettings->setShadowSize(m_ui.shadowSize->currentIndex()); | |
198 m_internalSettings->setShadowStrength(qRound(qreal(m_ui.shadowStrength->value() * 255) / 100)); | |
199 m_internalSettings->setShadowColor(m_ui.shadowColor->color()); | |
200 + m_internalSettings->setOutlineIntensity(m_ui.outlineIntensity->value()); | |
201 | |
202 // save configuration | |
203 m_internalSettings->save(); | |
204 @@ -136,6 +139,7 @@ void ConfigWidget::defaults() | |
205 m_ui.shadowSize->setCurrentIndex(m_internalSettings->shadowSize()); | |
206 m_ui.shadowStrength->setValue(qRound(qreal(m_internalSettings->shadowStrength() * 100) / 255)); | |
207 m_ui.shadowColor->setColor(m_internalSettings->shadowColor()); | |
208 + m_ui.outlineIntensity->setValue(m_internalSettings->outlineIntensity()); | |
209 } | |
210 | |
211 //_______________________________________________ | |
212 @@ -167,6 +171,8 @@ void ConfigWidget::updateChanged() | |
213 modified = true; | |
214 } else if (m_ui.shadowColor->color() != m_internalSettings->shadowColor()) { | |
215 modified = true; | |
216 + } else if (m_ui.outlineIntensity->value() != m_internalSettings->outlineIntensity()) { | |
217 + modified = true; | |
218 | |
219 // exceptions | |
220 } else if (m_ui.exceptions->isChanged()) { | |
221 diff --git a/kdecoration/config/ui/breezeconfigurationui.ui b/kdecoration/config/ui/breezeconfigurationui.ui | |
222 index f29e38c13..6d1f6a7b2 100644 | |
223 --- a/kdecoration/config/ui/breezeconfigurationui.ui | |
224 +++ b/kdecoration/config/ui/breezeconfigurationui.ui | |
225 @@ -290,7 +290,30 @@ | |
226 <item row="2" column="1"> | |
227 <widget class="KColorButton" name="shadowColor"/> | |
228 </item> | |
229 - <item row="3" column="0" colspan="3"> | |
230 + <item row="3" column="0"> | |
231 + <widget class="QLabel" name="label_6"> | |
232 + <property name="text"> | |
233 + <string comment="outline intensity">Outline intensity</string> | |
234 + </property> | |
235 + <property name="alignment"> | |
236 + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |
237 + </property> | |
238 + <property name="buddy"> | |
239 + <cstring>outlineIntensity</cstring> | |
240 + </property> | |
241 + </widget> | |
242 + </item> | |
243 + <item row="3" column="1"> | |
244 + <widget class="QSpinBox" name="outlineIntensity"> | |
245 + <property name="minimum"> | |
246 + <number>0</number> | |
247 + </property> | |
248 + <property name="maximum"> | |
249 + <number>200</number> | |
250 + </property> | |
251 + </widget> | |
252 + </item> | |
253 + <item row="4" column="0" colspan="3"> | |
254 <spacer name="verticalSpacer_3"> | |
255 <property name="orientation"> | |
256 <enum>Qt::Vertical</enum> | |
257 -- | |
258 GitLab | |
259 | |
260 | |
261 From 70ab16974547b351f50ef977afe05a37c28b289a Mon Sep 17 00:00:00 2001 | |
262 From: Akseli Lahtinen <akselmo@akselmo.dev> | |
263 Date: Wed, 1 Mar 2023 20:52:55 +0200 | |
264 Subject: [PATCH 3/7] Set outline intensity default to 100, add slider | |
265 | |
266 --- | |
267 kdecoration/breezedecoration.cpp | 2 +- | |
268 kdecoration/breezesettingsdata.kcfg | 2 +- | |
269 .../config/ui/breezeconfigurationui.ui | 21 ++++++++++++++++--- | |
270 3 files changed, 20 insertions(+), 5 deletions(-) | |
271 | |
272 diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp | |
273 index d6ae873e5..3e2b145d5 100644 | |
274 --- a/kdecoration/breezedecoration.cpp | |
275 +++ b/kdecoration/breezedecoration.cpp | |
276 @@ -822,7 +822,7 @@ QSharedPointer<KDecoration2::DecorationShadow> Decoration::createShadowObject(co | |
277 painter.drawRoundedRect(innerRect, m_scaledCornerRadius + 0.5, m_scaledCornerRadius + 0.5); | |
278 | |
279 // Draw window outline | |
280 - if (m_internalSettings->outlineIntensity() > 0) { | |
281 + if (m_internalSettings->outlineIntensity() > 100) { | |
282 const qreal outlineWidth = 1.001; | |
283 const qreal penOffset = outlineWidth / 2; | |
284 | |
285 diff --git a/kdecoration/breezesettingsdata.kcfg b/kdecoration/breezesettingsdata.kcfg | |
286 index 616035f9e..88db8e643 100644 | |
287 --- a/kdecoration/breezesettingsdata.kcfg | |
288 +++ b/kdecoration/breezesettingsdata.kcfg | |
289 @@ -37,7 +37,7 @@ | |
290 | |
291 <entry name="OutlineIntensity" type = "Int"> | |
292 <default>170</default> | |
293 - <min>0</min> | |
294 + <min>100</min> | |
295 <max>200</max> | |
296 </entry> | |
297 | |
298 diff --git a/kdecoration/config/ui/breezeconfigurationui.ui b/kdecoration/config/ui/breezeconfigurationui.ui | |
299 index 6d1f6a7b2..ef130a5cf 100644 | |
300 --- a/kdecoration/config/ui/breezeconfigurationui.ui | |
301 +++ b/kdecoration/config/ui/breezeconfigurationui.ui | |
302 @@ -293,7 +293,7 @@ | |
303 <item row="3" column="0"> | |
304 <widget class="QLabel" name="label_6"> | |
305 <property name="text"> | |
306 - <string comment="outline intensity">Outline intensity</string> | |
307 + <string comment="outline intensity">Outline intensity:</string> | |
308 </property> | |
309 <property name="alignment"> | |
310 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |
311 @@ -304,13 +304,28 @@ | |
312 </widget> | |
313 </item> | |
314 <item row="3" column="1"> | |
315 - <widget class="QSpinBox" name="outlineIntensity"> | |
316 + <widget class="QSlider" name="outlineIntensity"> | |
317 <property name="minimum"> | |
318 - <number>0</number> | |
319 + <number>100</number> | |
320 </property> | |
321 <property name="maximum"> | |
322 <number>200</number> | |
323 </property> | |
324 + <property name="singleStep"> | |
325 + <number>10</number> | |
326 + </property> | |
327 + <property name="pageStep"> | |
328 + <number>10</number> | |
329 + </property> | |
330 + <property name="orientation"> | |
331 + <enum>Qt::Horizontal</enum> | |
332 + </property> | |
333 + <property name="tickPosition"> | |
334 + <enum>QSlider::TicksBelow</enum> | |
335 + </property> | |
336 + <property name="tickInterval"> | |
337 + <number>10</number> | |
338 + </property> | |
339 </widget> | |
340 </item> | |
341 <item row="4" column="0" colspan="3"> | |
342 -- | |
343 GitLab | |
344 | |
345 | |
346 From 4bf3cd06c2cc938d161c872bba76427ff993fd2d Mon Sep 17 00:00:00 2001 | |
347 From: Akseli Lahtinen <akselmo@akselmo.dev> | |
348 Date: Thu, 2 Mar 2023 12:59:49 +0200 | |
349 Subject: [PATCH 4/7] better intensity values | |
350 | |
351 --- | |
352 kdecoration/breezedecoration.cpp | 2 +- | |
353 kdecoration/breezesettingsdata.kcfg | 4 ++-- | |
354 kdecoration/config/ui/breezeconfigurationui.ui | 10 +++++----- | |
355 3 files changed, 8 insertions(+), 8 deletions(-) | |
356 | |
357 diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp | |
358 index 3e2b145d5..abc805e70 100644 | |
359 --- a/kdecoration/breezedecoration.cpp | |
360 +++ b/kdecoration/breezedecoration.cpp | |
361 @@ -822,7 +822,7 @@ QSharedPointer<KDecoration2::DecorationShadow> Decoration::createShadowObject(co | |
362 painter.drawRoundedRect(innerRect, m_scaledCornerRadius + 0.5, m_scaledCornerRadius + 0.5); | |
363 | |
364 // Draw window outline | |
365 - if (m_internalSettings->outlineIntensity() > 100) { | |
366 + if (m_internalSettings->outlineIntensity() > 110) { | |
367 const qreal outlineWidth = 1.001; | |
368 const qreal penOffset = outlineWidth / 2; | |
369 | |
370 diff --git a/kdecoration/breezesettingsdata.kcfg b/kdecoration/breezesettingsdata.kcfg | |
371 index 88db8e643..1d3db8bd2 100644 | |
372 --- a/kdecoration/breezesettingsdata.kcfg | |
373 +++ b/kdecoration/breezesettingsdata.kcfg | |
374 @@ -37,8 +37,8 @@ | |
375 | |
376 <entry name="OutlineIntensity" type = "Int"> | |
377 <default>170</default> | |
378 - <min>100</min> | |
379 - <max>200</max> | |
380 + <min>110</min> | |
381 + <max>250</max> | |
382 </entry> | |
383 | |
384 </group> | |
385 diff --git a/kdecoration/config/ui/breezeconfigurationui.ui b/kdecoration/config/ui/breezeconfigurationui.ui | |
386 index ef130a5cf..3385c97e9 100644 | |
387 --- a/kdecoration/config/ui/breezeconfigurationui.ui | |
388 +++ b/kdecoration/config/ui/breezeconfigurationui.ui | |
389 @@ -306,16 +306,16 @@ | |
390 <item row="3" column="1"> | |
391 <widget class="QSlider" name="outlineIntensity"> | |
392 <property name="minimum"> | |
393 - <number>100</number> | |
394 + <number>110</number> | |
395 </property> | |
396 <property name="maximum"> | |
397 - <number>200</number> | |
398 + <number>250</number> | |
399 </property> | |
400 <property name="singleStep"> | |
401 - <number>10</number> | |
402 + <number>20</number> | |
403 </property> | |
404 <property name="pageStep"> | |
405 - <number>10</number> | |
406 + <number>20</number> | |
407 </property> | |
408 <property name="orientation"> | |
409 <enum>Qt::Horizontal</enum> | |
410 @@ -324,7 +324,7 @@ | |
411 <enum>QSlider::TicksBelow</enum> | |
412 </property> | |
413 <property name="tickInterval"> | |
414 - <number>10</number> | |
415 + <number>20</number> | |
416 </property> | |
417 </widget> | |
418 </item> | |
419 -- | |
420 GitLab | |
421 | |
422 | |
423 From 0f31f23648463ce4c0aa9e90fb74deccff273bc3 Mon Sep 17 00:00:00 2001 | |
424 From: Akseli Lahtinen <akselmo@akselmo.dev> | |
425 Date: Thu, 2 Mar 2023 18:13:14 +0200 | |
426 Subject: [PATCH 5/7] change from slider to combobox | |
427 | |
428 --- | |
429 kdecoration/breezedecoration.cpp | 25 ++++++++-- | |
430 kdecoration/breezesettingsdata.kcfg | 14 ++++-- | |
431 kdecoration/config/breezeconfigwidget.cpp | 14 ++++-- | |
432 .../config/ui/breezeconfigurationui.ui | 48 ++++++++++--------- | |
433 4 files changed, 67 insertions(+), 34 deletions(-) | |
434 | |
435 diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp | |
436 index abc805e70..eb4a7d0ec 100644 | |
437 --- a/kdecoration/breezedecoration.cpp | |
438 +++ b/kdecoration/breezedecoration.cpp | |
439 @@ -111,6 +111,25 @@ inline CompositeShadowParams lookupShadowParams(int size) | |
440 return s_shadowParams[3]; | |
441 } | |
442 } | |
443 + | |
444 +inline int lookupOutlineIntensity(int intensity) | |
445 +{ | |
446 + switch (intensity) { | |
447 + case Breeze::InternalSettings::OutlineOff: | |
448 + return 100; | |
449 + case Breeze::InternalSettings::OutlineLow: | |
450 + return 130; | |
451 + case Breeze::InternalSettings::OutlineMedium: | |
452 + return 170; | |
453 + case Breeze::InternalSettings::OutlineHigh: | |
454 + return 210; | |
455 + case Breeze::InternalSettings::OutlineMaximum: | |
456 + return 250; | |
457 + default: | |
458 + // Fallback to the Medium intensity. | |
459 + return 170; | |
460 + } | |
461 +} | |
462 } | |
463 | |
464 namespace Breeze | |
465 @@ -743,8 +762,8 @@ void Decoration::updateShadow() | |
466 outlineColor.hslSaturationF(), | |
467 qBound(0.1, outlineColor.lightnessF(), 1.0), | |
468 s->isAlphaChannelSupported() ? 0.9 : 1.0); | |
469 - outlineColor.lightnessF() >= 0.5 ? outlineColor = outlineColor.darker(m_internalSettings->outlineIntensity()) | |
470 - : outlineColor = outlineColor.lighter(m_internalSettings->outlineIntensity()); | |
471 + outlineColor.lightnessF() >= 0.5 ? outlineColor = outlineColor.darker(lookupOutlineIntensity(m_internalSettings->outlineIntensity())) | |
472 + : outlineColor = outlineColor.lighter(lookupOutlineIntensity(m_internalSettings->outlineIntensity())); | |
473 | |
474 // Animated case, no cached shadow object | |
475 if ((m_shadowAnimation->state() == QAbstractAnimation::Running) && (m_shadowOpacity != 0.0) && (m_shadowOpacity != 1.0)) { | |
476 @@ -822,7 +841,7 @@ QSharedPointer<KDecoration2::DecorationShadow> Decoration::createShadowObject(co | |
477 painter.drawRoundedRect(innerRect, m_scaledCornerRadius + 0.5, m_scaledCornerRadius + 0.5); | |
478 | |
479 // Draw window outline | |
480 - if (m_internalSettings->outlineIntensity() > 110) { | |
481 + if (lookupOutlineIntensity(m_internalSettings->outlineIntensity()) > 110) { | |
482 const qreal outlineWidth = 1.001; | |
483 const qreal penOffset = outlineWidth / 2; | |
484 | |
485 diff --git a/kdecoration/breezesettingsdata.kcfg b/kdecoration/breezesettingsdata.kcfg | |
486 index 1d3db8bd2..559983d79 100644 | |
487 --- a/kdecoration/breezesettingsdata.kcfg | |
488 +++ b/kdecoration/breezesettingsdata.kcfg | |
489 @@ -35,12 +35,16 @@ | |
490 <default>false</default> | |
491 </entry> | |
492 | |
493 - <entry name="OutlineIntensity" type = "Int"> | |
494 - <default>170</default> | |
495 - <min>110</min> | |
496 - <max>250</max> | |
497 + <entry name="OutlineIntensity" type = "Enum"> | |
498 + <choices> | |
499 + <choice name="OutlineOff"/> | |
500 + <choice name="OutlineLow"/> | |
501 + <choice name="OutlineMedium"/> | |
502 + <choice name="OutlineHigh"/> | |
503 + <choice name="OutlineMaximum"/> | |
504 + </choices> | |
505 + <default>OutlineMedium</default> | |
506 </entry> | |
507 - | |
508 </group> | |
509 | |
510 <group name="Windeco"> | |
511 diff --git a/kdecoration/config/breezeconfigwidget.cpp b/kdecoration/config/breezeconfigwidget.cpp | |
512 index e1e0dd63a..d57c08463 100644 | |
513 --- a/kdecoration/config/breezeconfigwidget.cpp | |
514 +++ b/kdecoration/config/breezeconfigwidget.cpp | |
515 @@ -70,7 +70,13 @@ void ConfigWidget::load() | |
516 | |
517 m_ui.shadowStrength->setValue(qRound(qreal(m_internalSettings->shadowStrength() * 100) / 255)); | |
518 m_ui.shadowColor->setColor(m_internalSettings->shadowColor()); | |
519 - m_ui.outlineIntensity->setValue(m_internalSettings->outlineIntensity()); | |
520 + | |
521 + // load outline intensity | |
522 + if (m_internalSettings->outlineIntensity() <= InternalSettings::OutlineMaximum) { | |
523 + m_ui.outlineIntensity->setCurrentIndex(m_internalSettings->outlineIntensity()); | |
524 + } else { | |
525 + m_ui.outlineIntensity->setCurrentIndex(InternalSettings::OutlineMedium); | |
526 + } | |
527 | |
528 // load exceptions | |
529 ExceptionList exceptions; | |
530 @@ -96,7 +102,7 @@ void ConfigWidget::save() | |
531 m_internalSettings->setShadowSize(m_ui.shadowSize->currentIndex()); | |
532 m_internalSettings->setShadowStrength(qRound(qreal(m_ui.shadowStrength->value() * 255) / 100)); | |
533 m_internalSettings->setShadowColor(m_ui.shadowColor->color()); | |
534 - m_internalSettings->setOutlineIntensity(m_ui.outlineIntensity->value()); | |
535 + m_internalSettings->setOutlineIntensity(m_ui.outlineIntensity->currentIndex()); | |
536 | |
537 // save configuration | |
538 m_internalSettings->save(); | |
539 @@ -139,7 +145,7 @@ void ConfigWidget::defaults() | |
540 m_ui.shadowSize->setCurrentIndex(m_internalSettings->shadowSize()); | |
541 m_ui.shadowStrength->setValue(qRound(qreal(m_internalSettings->shadowStrength() * 100) / 255)); | |
542 m_ui.shadowColor->setColor(m_internalSettings->shadowColor()); | |
543 - m_ui.outlineIntensity->setValue(m_internalSettings->outlineIntensity()); | |
544 + m_ui.outlineIntensity->setCurrentIndex(m_internalSettings->outlineIntensity()); | |
545 } | |
546 | |
547 //_______________________________________________ | |
548 @@ -171,7 +177,7 @@ void ConfigWidget::updateChanged() | |
549 modified = true; | |
550 } else if (m_ui.shadowColor->color() != m_internalSettings->shadowColor()) { | |
551 modified = true; | |
552 - } else if (m_ui.outlineIntensity->value() != m_internalSettings->outlineIntensity()) { | |
553 + } else if (m_ui.outlineIntensity->currentIndex() != m_internalSettings->outlineIntensity()) { | |
554 modified = true; | |
555 | |
556 // exceptions | |
557 diff --git a/kdecoration/config/ui/breezeconfigurationui.ui b/kdecoration/config/ui/breezeconfigurationui.ui | |
558 index 3385c97e9..e0283c93a 100644 | |
559 --- a/kdecoration/config/ui/breezeconfigurationui.ui | |
560 +++ b/kdecoration/config/ui/breezeconfigurationui.ui | |
561 @@ -304,28 +304,32 @@ | |
562 </widget> | |
563 </item> | |
564 <item row="3" column="1"> | |
565 - <widget class="QSlider" name="outlineIntensity"> | |
566 - <property name="minimum"> | |
567 - <number>110</number> | |
568 - </property> | |
569 - <property name="maximum"> | |
570 - <number>250</number> | |
571 - </property> | |
572 - <property name="singleStep"> | |
573 - <number>20</number> | |
574 - </property> | |
575 - <property name="pageStep"> | |
576 - <number>20</number> | |
577 - </property> | |
578 - <property name="orientation"> | |
579 - <enum>Qt::Horizontal</enum> | |
580 - </property> | |
581 - <property name="tickPosition"> | |
582 - <enum>QSlider::TicksBelow</enum> | |
583 - </property> | |
584 - <property name="tickInterval"> | |
585 - <number>20</number> | |
586 - </property> | |
587 + <widget class="QComboBox" name="outlineIntensity"> | |
588 + <item> | |
589 + <property name="text"> | |
590 + <string comment="@item:inlistbox Outline intensity:">Off</string> | |
591 + </property> | |
592 + </item> | |
593 + <item> | |
594 + <property name="text"> | |
595 + <string comment="@item:inlistbox Outline intensity:">Low</string> | |
596 + </property> | |
597 + </item> | |
598 + <item> | |
599 + <property name="text"> | |
600 + <string comment="@item:inlistbox Outline intensity:">Medium</string> | |
601 + </property> | |
602 + </item> | |
603 + <item> | |
604 + <property name="text"> | |
605 + <string comment="@item:inlistbox Outline intensity:">High</string> | |
606 + </property> | |
607 + </item> | |
608 + <item> | |
609 + <property name="text"> | |
610 + <string comment="@item:inlistbox Outline intensity:">Maximum</string> | |
611 + </property> | |
612 + </item> | |
613 </widget> | |
614 </item> | |
615 <item row="4" column="0" colspan="3"> | |
616 -- | |
617 GitLab | |
618 | |
619 | |
620 From 2a41e807948af3cca43af814323f6d6e5295fb93 Mon Sep 17 00:00:00 2001 | |
621 From: Akseli Lahtinen <akselmo@akselmo.dev> | |
622 Date: Fri, 3 Mar 2023 00:49:14 +0200 | |
623 Subject: [PATCH 6/7] rename shadow tab to shadows and outline | |
624 | |
625 --- | |
626 kdecoration/config/ui/breezeconfigurationui.ui | 8 ++++---- | |
627 1 file changed, 4 insertions(+), 4 deletions(-) | |
628 | |
629 diff --git a/kdecoration/config/ui/breezeconfigurationui.ui b/kdecoration/config/ui/breezeconfigurationui.ui | |
630 index e0283c93a..a760f7b71 100644 | |
631 --- a/kdecoration/config/ui/breezeconfigurationui.ui | |
632 +++ b/kdecoration/config/ui/breezeconfigurationui.ui | |
633 @@ -193,13 +193,13 @@ | |
634 </widget> | |
635 <widget class="QWidget" name="tab_4"> | |
636 <attribute name="title"> | |
637 - <string>Shadows</string> | |
638 + <string>Shadows and Outline</string> | |
639 </attribute> | |
640 <layout class="QGridLayout" name="gridLayout"> | |
641 <item row="0" column="0"> | |
642 <widget class="QLabel" name="label"> | |
643 <property name="text"> | |
644 - <string>Si&ze:</string> | |
645 + <string>Shadow size:</string> | |
646 </property> | |
647 <property name="alignment"> | |
648 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |
649 @@ -241,7 +241,7 @@ | |
650 <item row="1" column="0"> | |
651 <widget class="QLabel" name="label_2"> | |
652 <property name="text"> | |
653 - <string comment="strength of the shadow (from transparent to opaque)">S&trength:</string> | |
654 + <string comment="strength of the shadow (from transparent to opaque)">Shadow strength:</string> | |
655 </property> | |
656 <property name="alignment"> | |
657 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |
658 @@ -280,7 +280,7 @@ | |
659 <item row="2" column="0"> | |
660 <widget class="QLabel" name="label_5"> | |
661 <property name="text"> | |
662 - <string>Color:</string> | |
663 + <string>Shadow color:</string> | |
664 </property> | |
665 <property name="alignment"> | |
666 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |
667 -- | |
668 GitLab | |
669 | |
670 | |
671 From d66927cb4994e91052f4e2441309e9354762d59c Mon Sep 17 00:00:00 2001 | |
672 From: Nate Graham <nate@kde.org> | |
673 Date: Fri, 3 Mar 2023 20:17:54 +0000 | |
674 Subject: [PATCH 7/7] change 110 to 100 | |
675 | |
676 --- | |
677 kdecoration/breezedecoration.cpp | 2 +- | |
678 1 file changed, 1 insertion(+), 1 deletion(-) | |
679 | |
680 diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp | |
681 index eb4a7d0ec..410943f2a 100644 | |
682 --- a/kdecoration/breezedecoration.cpp | |
683 +++ b/kdecoration/breezedecoration.cpp | |
684 @@ -841,7 +841,7 @@ QSharedPointer<KDecoration2::DecorationShadow> Decoration::createShadowObject(co | |
685 painter.drawRoundedRect(innerRect, m_scaledCornerRadius + 0.5, m_scaledCornerRadius + 0.5); | |
686 | |
687 // Draw window outline | |
688 - if (lookupOutlineIntensity(m_internalSettings->outlineIntensity()) > 110) { | |
689 + if (lookupOutlineIntensity(m_internalSettings->outlineIntensity()) > 100) { | |
690 const qreal outlineWidth = 1.001; | |
691 const qreal penOffset = outlineWidth / 2; | |
692 | |
693 -- | |
694 GitLab | |
695 |