Skip to content

Commit

Permalink
V0.3.1: fixed borders opacity and better description of shadows setti…
Browse files Browse the repository at this point in the history
…ng on inactive windows
  • Loading branch information
kupiqu committed Dec 1, 2018
1 parent 9673c5e commit 838eb5b
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 45 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

project(sierrabreezeenhanced)
set(PROJECT_VERSION "0.3")
set(PROJECT_VERSION "0.3.1")
set(PROJECT_VERSION_MAJOR 0)

cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
Expand Down
14 changes: 10 additions & 4 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
V0.3.1
---------

* Fixed borders opacity.
* Better description of shadows setting on inactive windows: "Small shadows on inactive windows".

V0.3
---------

* added option to display small shadows for inactive windows as a way to make the active window more salient wrt others (issue #4).
* ported Match Title Bar Color from Sierra Breeze. It matches the "BackgroundNormal" color under "Windows" section of the color scheme. Title Bar Text Color is manipulated to guarantee visibility (issue #5).
* ported Font Weight Combobox from Breeze Enhanced.
* other minor fixes and code clean-up.
* Added option to display small shadows for inactive windows as a way to make the active window more salient wrt others (issue #4).
* Ported Match Title Bar Color from Sierra Breeze. It matches the "BackgroundNormal" color under "Windows" section of the color scheme. Title Bar Text Color is manipulated to guarantee visibility (issue #5).
* Ported Font Weight Combobox from Breeze Enhanced.
* Other minor fixes and code clean-up.

V0.2
---------
Expand Down
7 changes: 6 additions & 1 deletion breezebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ namespace Breeze

painter->setRenderHints( QPainter::Antialiasing );

/*
scale painter so that its window matches QRect( -1, -1, 20, 20 )
this makes all further rendering and scaling simpler
all further rendering is preformed inside QRect( 0, 0, 18, 18 )
*/
painter->translate( geometry().topLeft() );

const qreal width( m_iconSize.width() );
Expand Down Expand Up @@ -345,7 +350,7 @@ namespace Breeze
painter->setPen( Qt::NoPen );
}
qreal r = static_cast<qreal>(7)
+ static_cast<qreal>(2) * m_animation->currentValue().toReal();
+ static_cast<qreal>(2) * m_animation->currentValue().toReal();
QPointF c(static_cast<qreal>(9), static_cast<qreal>(9));
painter->drawEllipse( c, r, r );
if ( isHovered() || isChecked() || ( inactiveWindow && !useActiveButtonStyle ) || useInactiveButtonStyle )
Expand Down
41 changes: 20 additions & 21 deletions breezedecoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ namespace Breeze
static int g_shadowStrength = 255;
static QColor g_shadowColor = Qt::black;
static QSharedPointer<KDecoration2::DecorationShadow> g_sShadow;
static bool g_shadowInactiveEnabled = true;
static bool g_smallShadowsInactiveWindows = false;

//________________________________________________________________
Decoration::Decoration(QObject *parent, const QVariantList &args)
Expand Down Expand Up @@ -340,7 +340,7 @@ namespace Breeze
CompositeShadowParams params = lookupShadowParams(Breeze::InternalSettings::ShadowSmall);

auto c = client().data();
if ( g_shadowInactiveEnabled || c->isActive() )
if ( !g_smallShadowsInactiveWindows || c->isActive() )
params = lookupShadowParams(g_shadowSizeEnum);

if ( params.isNone() ) {
Expand Down Expand Up @@ -484,8 +484,6 @@ namespace Breeze
// size grip
if( hasNoBorders() && m_internalSettings->drawSizeGrip() ) createSizeGrip();
else deleteSizeGrip();

m_opacityValue = m_internalSettings->backgroundOpacity() * 2.55;
}

//________________________________________________________________
Expand Down Expand Up @@ -633,13 +631,21 @@ namespace Breeze
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(Qt::NoPen);
painter->setBrush( c->color( c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::Frame ) );

if (m_windowColor.rgb() != titleBarColor.rgb() ) {
m_windowColor = titleBarColor;
m_windowColor.setAlpha( m_opacityValue );
}
if ( matchColorForTitleBar() || !opaqueTitleBar() ) {

if ( m_windowColor.rgb() != titleBarColor.rgb() )
m_windowColor = titleBarColor;

painter->setBrush( m_windowColor );
if ( !opaqueTitleBar() ) {
int a = m_internalSettings->opacityOverride() > -1 ? m_internalSettings->opacityOverride() : m_internalSettings->backgroundOpacity();
a = qBound(0, a, 100);
m_windowColor.setAlpha( qRound(static_cast<qreal>(a) * (qreal)2.55) );
}

painter->setBrush( m_windowColor );
}

// clip away the top part
if( !hideTitleBar() ) painter->setClipRect(0, borderTop(), size().width(), size().height() - borderTop(), Qt::IntersectClip);
Expand Down Expand Up @@ -683,7 +689,7 @@ namespace Breeze
// render a linear gradient on title area and draw a light border at the top
if( m_internalSettings->drawBackgroundGradient() )
{
if( !opaqueTitleBar() ) {
if ( !opaqueTitleBar() ) {
int a = m_internalSettings->opacityOverride() > -1 ? m_internalSettings->opacityOverride() : m_internalSettings->backgroundOpacity();
a = qBound(0, a, 100);
titleBarColor.setAlpha( qRound(static_cast<qreal>(a) * (qreal)2.55) );
Expand All @@ -700,20 +706,13 @@ namespace Breeze

} else {

if( !opaqueTitleBar() ) {
if ( !opaqueTitleBar() ) {
int a = m_internalSettings->opacityOverride() > -1 ? m_internalSettings->opacityOverride() : m_internalSettings->backgroundOpacity();
a = qBound(0, a, 100);
titleBarColor.setAlpha( qRound(static_cast<qreal>(a) * (qreal)2.55) );
}

QLinearGradient gradient( 0, 0, 0, titleRect.height() );
QColor lightCol( titleBarColor.lighter( 130 ) );
gradient.setColorAt(0.0, lightCol );
gradient.setColorAt(0.99 / static_cast<qreal>(titleRect.height()), lightCol );
gradient.setColorAt(1.0 / static_cast<qreal>(titleRect.height()), titleBarColor );
gradient.setColorAt(1.0, titleBarColor);

painter->setBrush( gradient );
painter->setBrush( titleBarColor );

}

Expand Down Expand Up @@ -852,12 +851,12 @@ namespace Breeze
|| g_shadowSizeEnum != m_internalSettings->shadowSize()
|| g_shadowStrength != m_internalSettings->shadowStrength()
|| g_shadowColor != m_internalSettings->shadowColor()
|| g_shadowInactiveEnabled != m_internalSettings->shadowInactive() )
|| g_smallShadowsInactiveWindows != m_internalSettings->smallShadowsInactiveWindows() )
{
g_shadowSizeEnum = m_internalSettings->shadowSize();
g_shadowStrength = m_internalSettings->shadowStrength();
g_shadowColor = m_internalSettings->shadowColor();
g_shadowInactiveEnabled = m_internalSettings->shadowInactive();
g_smallShadowsInactiveWindows = m_internalSettings->smallShadowsInactiveWindows();
}

updateShadow();
Expand Down
1 change: 0 additions & 1 deletion breezedecoration.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ namespace Breeze
//* active state change opacity
qreal m_opacity = 0;

int m_opacityValue = 0;
QColor m_windowColor;

};
Expand Down
16 changes: 8 additions & 8 deletions breezesettingsdata.kcfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<default>35, 38, 41</default>
</entry>

<entry name="ShadowInactive" type = "Bool">
<default>true</default>
<entry name="SmallShadowsInactiveWindows" type = "Bool">
<default>false</default>
</entry>

<!-- close button -->
Expand Down Expand Up @@ -107,10 +107,6 @@
<default>ActiveVsInactiveStyle</default>
</entry>

<entry name="BackgroundOpacity" type = "Int">
<default>100</default>
</entry>

<!-- size grip -->
<entry name="DrawBackgroundGradient" type = "Bool">
<default>false</default>
Expand All @@ -128,7 +124,7 @@
</entry>

<!-- match colors -->
<entry name="matchColorForTitleBar" type = "Bool">
<entry name="MatchColorForTitleBar" type = "Bool">
<default>false</default>
</entry>

Expand All @@ -148,7 +144,11 @@

<!-- opaque title bar -->
<entry name="OpaqueTitleBar" type = "Bool">
<default>false</default>
<default>true</default>
</entry>

<entry name="BackgroundOpacity" type = "Int">
<default>100</default>
</entry>

<entry name="OpacityOverride" type = "Int">
Expand Down
15 changes: 10 additions & 5 deletions config/breezeconfigwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace Breeze
connect( m_ui.btnSpacingSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [=](int /*i*/){updateChanged();} );
connect( m_ui.drawBorderOnMaximizedWindows, SIGNAL(clicked()), SLOT(updateChanged()) );
connect( m_ui.drawSizeGrip, SIGNAL(clicked()), SLOT(updateChanged()) );
connect( m_ui.opaqueTitleBar, SIGNAL(clicked()), SLOT(updateChanged()) );
connect( m_ui.drawBackgroundGradient, SIGNAL(clicked()), SLOT(updateChanged()) );
connect( m_ui.buttonStyle, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( m_ui.opacitySpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [=](int /*i*/){updateChanged();} );
Expand All @@ -71,7 +72,7 @@ namespace Breeze
connect( m_ui.shadowSize, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( m_ui.shadowStrength, SIGNAL(valueChanged(int)), SLOT(updateChanged()) );
connect( m_ui.shadowColor, SIGNAL(changed(QColor)), SLOT(updateChanged()) );
connect( m_ui.shadowInactive, SIGNAL(clicked()), SLOT(updateChanged()) );
connect( m_ui.smallShadowsInactiveWindows, SIGNAL(clicked()), SLOT(updateChanged()) );

// track exception changes
connect( m_ui.exceptions, SIGNAL(changed(bool)), SLOT(updateChanged()) );
Expand All @@ -92,6 +93,7 @@ namespace Breeze
m_ui.btnSpacingSpinBox->setValue( m_internalSettings->buttonSpacing() );
m_ui.drawBorderOnMaximizedWindows->setChecked( m_internalSettings->drawBorderOnMaximizedWindows() );
m_ui.drawSizeGrip->setChecked( m_internalSettings->drawSizeGrip() );
m_ui.opaqueTitleBar->setChecked( m_internalSettings->opaqueTitleBar() );
m_ui.drawBackgroundGradient->setChecked( m_internalSettings->drawBackgroundGradient() );
m_ui.animationsEnabled->setChecked( m_internalSettings->animationsEnabled() );
m_ui.animationsDuration->setValue( m_internalSettings->animationsDuration() );
Expand Down Expand Up @@ -136,7 +138,7 @@ namespace Breeze

m_ui.shadowStrength->setValue( qRound(qreal(m_internalSettings->shadowStrength()*100)/255 ) );
m_ui.shadowColor->setColor( m_internalSettings->shadowColor() );
m_ui.shadowInactive->setChecked( m_internalSettings->shadowInactive() );
m_ui.smallShadowsInactiveWindows->setChecked( m_internalSettings->smallShadowsInactiveWindows() );

// load exceptions
ExceptionList exceptions;
Expand All @@ -160,6 +162,7 @@ namespace Breeze
m_internalSettings->setButtonSpacing( m_ui.btnSpacingSpinBox->value() );
m_internalSettings->setDrawBorderOnMaximizedWindows( m_ui.drawBorderOnMaximizedWindows->isChecked() );
m_internalSettings->setDrawSizeGrip( m_ui.drawSizeGrip->isChecked() );
m_internalSettings->setOpaqueTitleBar( m_ui.opaqueTitleBar->isChecked() );
m_internalSettings->setDrawBackgroundGradient( m_ui.drawBackgroundGradient->isChecked() );
m_internalSettings->setAnimationsEnabled( m_ui.animationsEnabled->isChecked() );
m_internalSettings->setAnimationsDuration( m_ui.animationsDuration->value() );
Expand Down Expand Up @@ -198,7 +201,7 @@ namespace Breeze
m_internalSettings->setShadowSize( m_ui.shadowSize->currentIndex() );
m_internalSettings->setShadowStrength( qRound( qreal(m_ui.shadowStrength->value()*255)/100 ) );
m_internalSettings->setShadowColor( m_ui.shadowColor->color() );
m_internalSettings->setShadowInactive( m_ui.shadowInactive->isChecked() );
m_internalSettings->setSmallShadowsInactiveWindows( m_ui.smallShadowsInactiveWindows->isChecked() );

// save configuration
m_internalSettings->save();
Expand Down Expand Up @@ -239,6 +242,7 @@ namespace Breeze
m_ui.btnSpacingSpinBox->setValue( m_internalSettings->buttonSpacing() );
m_ui.drawBorderOnMaximizedWindows->setChecked( m_internalSettings->drawBorderOnMaximizedWindows() );
m_ui.drawSizeGrip->setChecked( m_internalSettings->drawSizeGrip() );
m_ui.opaqueTitleBar->setChecked( m_internalSettings->opaqueTitleBar() );
m_ui.drawBackgroundGradient->setChecked( m_internalSettings->drawBackgroundGradient() );
m_ui.drawTitleBarSeparator->setChecked( m_internalSettings->drawTitleBarSeparator() );
m_ui.matchColorForTitleBar->setChecked( m_internalSettings->matchColorForTitleBar() );
Expand Down Expand Up @@ -278,7 +282,7 @@ namespace Breeze
m_ui.shadowSize->setCurrentIndex( m_internalSettings->shadowSize() );
m_ui.shadowStrength->setValue( qRound(qreal(m_internalSettings->shadowStrength()*100)/255 ) );
m_ui.shadowColor->setColor( m_internalSettings->shadowColor() );
m_ui.shadowInactive->setChecked( m_internalSettings->shadowInactive() );
m_ui.smallShadowsInactiveWindows->setChecked( m_internalSettings->smallShadowsInactiveWindows() );

}

Expand All @@ -298,6 +302,7 @@ namespace Breeze
else if( m_ui.btnSpacingSpinBox->value() != m_internalSettings->buttonSpacing() ) modified = true;
else if( m_ui.drawBorderOnMaximizedWindows->isChecked() != m_internalSettings->drawBorderOnMaximizedWindows() ) modified = true;
else if( m_ui.drawSizeGrip->isChecked() != m_internalSettings->drawSizeGrip() ) modified = true;
else if( m_ui.opaqueTitleBar->isChecked() != m_internalSettings->opaqueTitleBar() ) modified = true;
else if( m_ui.drawBackgroundGradient->isChecked() != m_internalSettings->drawBackgroundGradient() ) modified = true;
else if( m_ui.buttonStyle->currentIndex() != m_internalSettings->buttonStyle() ) modified = true;
else if( m_ui.opacitySpinBox->value() != m_internalSettings->backgroundOpacity() ) modified = true;
Expand All @@ -318,7 +323,7 @@ namespace Breeze
else if( m_ui.shadowSize->currentIndex() != m_internalSettings->shadowSize() ) modified = true;
else if( qRound( qreal(m_ui.shadowStrength->value()*255)/100 ) != m_internalSettings->shadowStrength() ) modified = true;
else if( m_ui.shadowColor->color() != m_internalSettings->shadowColor() ) modified = true;
else if( m_ui.shadowInactive->isChecked() != m_internalSettings->shadowInactive() ) modified = true;
else if( m_ui.smallShadowsInactiveWindows->isChecked() != m_internalSettings->smallShadowsInactiveWindows() ) modified = true;

// exceptions
else if( m_ui.exceptions->isChanged() ) modified = true;
Expand Down
48 changes: 44 additions & 4 deletions config/ui/breezeconfigurationui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,18 @@
</widget>
</item>
<item row="10" column="0" colspan="3">
<widget class="QCheckBox" name="opaqueTitleBar">
<property name="text">
<string>Opaque title bar</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,1">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Opacity:</string>
<string>Background opacity:</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -396,7 +403,7 @@
</item>
</layout>
</item>
<item row="11" column="0" colspan="3">
<item row="12" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down Expand Up @@ -580,9 +587,9 @@
<widget class="KColorButton" name="shadowColor"/>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="shadowInactive">
<widget class="QCheckBox" name="smallShadowsInactiveWindows">
<property name="text">
<string>Enable shadows on inactive windows</string>
<string>Small shadows on inactive windows</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -645,6 +652,7 @@
<tabstop>drawBackgroundGradient</tabstop>
<tabstop>drawSizeGrip</tabstop>
<tabstop>drawTitleBarSeparator</tabstop>
<tabstop>opaqueTitleBar</tabstop>
<tabstop>animationsEnabled</tabstop>
<tabstop>animationsDuration</tabstop>
<tabstop>shadowSize</tabstop>
Expand Down Expand Up @@ -717,5 +725,37 @@
</hint>
</hints>
</connection>
<connection>
<sender>opaqueTitleBar</sender>
<signal>toggled(bool)</signal>
<receiver>opacitySpinBox</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>222</x>
<y>160</y>
</hint>
<hint type="destinationlabel">
<x>166</x>
<y>188</y>
</hint>
</hints>
</connection>
<connection>
<sender>opaqueTitleBar</sender>
<signal>toggled(bool)</signal>
<receiver>label_6</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>222</x>
<y>160</y>
</hint>
<hint type="destinationlabel">
<x>64</x>
<y>57</y>
</hint>
</hints>
</connection>
</connections>
</ui>

0 comments on commit 838eb5b

Please sign in to comment.