@@ -154,6 +154,7 @@ void Button::paint(QPainter *painter, const QRectF &repaintRegion)
154154// __________________________________________________________________
155155void Button::drawIcon (QPainter *painter) const
156156{
157+ auto d = qobject_cast<Decoration *>(decoration ());
157158 painter->setRenderHints (QPainter::Antialiasing);
158159
159160 /*
@@ -166,7 +167,9 @@ void Button::drawIcon(QPainter *painter) const
166167
167168 const qreal width (rect.width ());
168169 painter->scale (width / 20 , width / 20 );
169- painter->translate (1 , 1 );
170+ auto c = decoration ()->window ();
171+ if ( (c && c->isMaximized ()) && d->internalSettings ()->floatingTitlebar () ) painter->translate (1 , 2 );
172+ else painter->translate (1 , 1 );
170173
171174 // render background
172175 const QColor backgroundColor (this ->backgroundColor ());
@@ -223,7 +226,6 @@ void Button::drawIcon(QPainter *painter) const
223226
224227 // center dot
225228 QColor backgroundColor (this ->backgroundColor ());
226- auto d = qobject_cast<Decoration *>(decoration ());
227229 if (!backgroundColor.isValid () && d) {
228230 backgroundColor = d->titleBarColor ();
229231 }
@@ -270,6 +272,28 @@ void Button::drawIcon(QPainter *painter) const
270272 break ;
271273 }
272274
275+ case DecorationButtonType::ExcludeFromCapture: {
276+ // A spy hat (like view-private.svg icon)
277+ const qreal cx = 9 , cy = 9 ;
278+ // Hat crown with dip/crease at top (filled)
279+ std::array crownPoints{QPointF (cx - 4.1 , cy - 2.5 ),
280+ QPointF (cx - 3.2 , cy - 6.1 ),
281+ QPointF (cx, cy - 5 ),
282+ QPointF (cx + 3.2 , cy - 6.1 ),
283+ QPointF (cx + 4.1 , cy - 2.5 )};
284+ painter->setBrush (pen.color ());
285+ painter->drawPolygon (crownPoints.data (), crownPoints.size ());
286+ painter->setBrush (Qt::NoBrush);
287+ // Hat brim
288+ painter->drawLine (QPointF (cx - 6.2 , cy - 0.5 ), QPointF (cx + 6.2 , cy - 0.5 ));
289+ // Glasses' lenses
290+ painter->drawEllipse (QPointF (cx - 4 , cy + 3.8 ), 2.3 , 2.3 );
291+ painter->drawEllipse (QPointF (cx + 4 , cy + 3.8 ), 2.3 , 2.3 );
292+ // Bridge between lenses
293+ painter->drawLine (QPointF (cx - 1.5 , cy + 3.8 ), QPointF (cx + 1.5 , cy + 3.8 ));
294+ break ;
295+ }
296+
273297 case DecorationButtonType::ApplicationMenu: {
274298 painter->drawRect (QRectF (3.5 , 4.5 , 11 , 1 ));
275299 painter->drawRect (QRectF (3.5 , 8.5 , 11 , 1 ));
@@ -308,7 +332,8 @@ QColor Button::foregroundColor() const
308332 } else if (type () == DecorationButtonType::Close && d->internalSettings ()->outlineCloseButton ()) {
309333 return d->titleBarColor ();
310334
311- } else if ((type () == DecorationButtonType::KeepBelow || type () == DecorationButtonType::KeepAbove || type () == DecorationButtonType::Shade)
335+ } else if ((type () == DecorationButtonType::KeepBelow || type () == DecorationButtonType::KeepAbove || type () == DecorationButtonType::Shade
336+ || type () == DecorationButtonType::ExcludeFromCapture)
312337 && isChecked ()) {
313338 return d->titleBarColor ();
314339
@@ -341,7 +366,8 @@ QColor Button::backgroundColor() const
341366 } else if ((type () == DecorationButtonType::KeepBelow || type () == DecorationButtonType::KeepAbove || type () == DecorationButtonType::Shade)
342367 && isChecked ()) {
343368 return d->fontColor ();
344-
369+ } else if (type () == DecorationButtonType::ExcludeFromCapture && isChecked ()) {
370+ return c->color (ColorGroup::Warning, ColorRole::Foreground);
345371 } else if (m_animation->state () == QAbstractAnimation::Running) {
346372 if (type () == DecorationButtonType::Close) {
347373 if (d->internalSettings ()->outlineCloseButton ()) {
0 commit comments