From b65a4a6b94b0088e8735e90ccf4d968c254f2daa Mon Sep 17 00:00:00 2001 From: Salva Ardid Date: Tue, 21 Mar 2023 11:23:56 +0100 Subject: [PATCH] V1.3.3 restore gradients --- CMakeLists.txt | 2 +- ChangeLog | 5 ++++ breezedecoration.cpp | 62 ++++++++++++++++++++++++++++++-------------- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e758d58..dc347f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ project(sierrabreezeenhanced) -set(PROJECT_VERSION "1.3.2") +set(PROJECT_VERSION "1.3.3") set(PROJECT_VERSION_MAJOR 0) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) diff --git a/ChangeLog b/ChangeLog index 07f2989..0af3978 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +V1.3.3 +--------- + +* Restore gradients + V1.3.2 --------- diff --git a/breezedecoration.cpp b/breezedecoration.cpp index 4c4b850..4c35cc3 100644 --- a/breezedecoration.cpp +++ b/breezedecoration.cpp @@ -530,13 +530,13 @@ namespace Breeze 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() + 0.5)); // Draw outline. - painter.setPen(withOpacity(g_shadowColor, 0.2 * strength)); - painter.setBrush(Qt::NoBrush); - painter.setCompositionMode(QPainter::CompositionMode_SourceOver); - painter.drawRoundedRect( - innerRect, - 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() - 0.5), - 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() - 0.5)); + // painter.setPen(withOpacity(g_shadowColor, 0.2 * strength)); + // painter.setBrush(Qt::NoBrush); + // painter.setCompositionMode(QPainter::CompositionMode_SourceOver); + // painter.drawRoundedRect( + // innerRect, + // 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() - 0.5), + // 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() - 0.5)); painter.end(); @@ -609,13 +609,13 @@ namespace Breeze 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() + 0.5)); // Draw outline. - painter.setPen(withOpacity(g_shadowColorInactiveWindows, 0.2 * strength)); - painter.setBrush(Qt::NoBrush); - painter.setCompositionMode(QPainter::CompositionMode_SourceOver); - painter.drawRoundedRect( - innerRect, - 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() - 0.5), - 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() - 0.5)); + // painter.setPen(withOpacity(g_shadowColorInactiveWindows, 0.2 * strength)); + // painter.setBrush(Qt::NoBrush); + // painter.setCompositionMode(QPainter::CompositionMode_SourceOver); + // painter.drawRoundedRect( + // innerRect, + // 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() - 0.5), + // 0.5*s->smallSpacing()*(m_internalSettings->cornerRadius() - 0.5)); painter.end(); @@ -896,14 +896,21 @@ namespace Breeze painter->setBrush( titleBarColor ); // clip away the top part - // if( !hideTitleBar() ) painter->setClipRect(0, borderTop(), size().width(), size().height() - borderTop(), Qt::IntersectClip); + if( !hideTitleBar() ) painter->setClipRect(0, borderTop(), size().width(), size().height() - borderTop(), Qt::IntersectClip); + + // When no borders set, outline will be drawn by shader + QPen border_pen1; + if(borderSize() == 0) + border_pen1 = QPen( titleBarColor ); + else + border_pen1 = QPen( titleBarColor.darker( 125 ) ); - QPen border_pen1( titleBarColor.darker( 125 ) ); painter->setPen(border_pen1); - if( s->isAlphaChannelSupported() ) + if( s->isAlphaChannelSupported() ) { painter->drawRoundedRect(rect(), 0.5*s->smallSpacing()*m_internalSettings->cornerRadius(), 0.5*s->smallSpacing()*m_internalSettings->cornerRadius()); - else + } else { painter->drawRect( rect() ); + } painter->restore(); } @@ -956,6 +963,24 @@ namespace Breeze else painter->setBrush( titleBarColor ); + auto s = settings(); + if( !s->isAlphaChannelSupported() ) + painter->drawRect(titleRect); + else if ( !hasBorders() ) { + painter->setClipRect(titleRect, Qt::IntersectClip); + // the rect is made a little bit larger to be able to clip away the rounded corners at the bottom and sides + QRect adjustetTitleRect = titleRect.adjusted( + isLeftEdge() ? -m_internalSettings->cornerRadius():0, + isTopEdge() ? -m_internalSettings->cornerRadius():0, + isRightEdge() ? m_internalSettings->cornerRadius():0, + m_internalSettings->cornerRadius()); + + painter->drawRoundedRect(adjustetTitleRect, m_internalSettings->cornerRadius(), m_internalSettings->cornerRadius()); + } + else { + painter->drawRoundedRect(titleRect, m_internalSettings->cornerRadius(), m_internalSettings->cornerRadius()); + } + if( !c->isShaded() && !hideTitleBar() && outlineColor.isValid() ) { // outline @@ -969,7 +994,6 @@ namespace Breeze painter->restore(); - auto s = settings(); if( !hideTitleBar() ) { // draw all buttons m_leftButtons->paint(painter, repaintRegion);