Skip to content

Commit

Permalink
V0.9RC
Browse files Browse the repository at this point in the history
  • Loading branch information
Salva Ardid committed Mar 20, 2020
1 parent 33fb147 commit e5fedaf
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 58 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.8.12")
set(PROJECT_VERSION "0.8.99")
set(PROJECT_VERSION_MAJOR 0)

cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
Expand Down
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
V0.9RC
---------

* Added option for button horizontal offset

* Enhanced resizing area now applies to SBE's tiny border, i.e., the 1 px outline border

* Grip option now applies to to SBE's tiny border, i.e., the 1 px outline border

V0.8.12
---------

Expand Down
36 changes: 18 additions & 18 deletions breezebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace Breeze
setIconSize(QSize( height, height ));

// connections
connect(decoration->client().data(), SIGNAL(iconChanged(QIcon)), this, SLOT(update()));
connect(decoration->client().toStrongRef().data(), SIGNAL(iconChanged(QIcon)), this, SLOT(update()));
connect(decoration->settings().data(), &KDecoration2::DecorationSettings::reconfigured, this, &Button::reconfigure);
connect( this, &KDecoration2::DecorationButton::hoveredChanged, this, &Button::updateAnimationState );

Expand Down Expand Up @@ -91,32 +91,32 @@ namespace Breeze
{

case DecorationButtonType::Close:
b->setVisible( d->client().data()->isCloseable() );
QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::closeableChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client().toStrongRef().data()->isCloseable() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::closeableChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::Maximize:
b->setVisible( d->client().data()->isMaximizeable() );
QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::maximizeableChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client().toStrongRef().data()->isMaximizeable() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::maximizeableChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::Minimize:
b->setVisible( d->client().data()->isMinimizeable() );
QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::minimizeableChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client().toStrongRef().data()->isMinimizeable() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::minimizeableChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::ContextHelp:
b->setVisible( d->client().data()->providesContextHelp() );
QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client().toStrongRef().data()->providesContextHelp() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::Shade:
b->setVisible( d->client().data()->isShadeable() );
QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::shadeableChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client().toStrongRef().data()->isShadeable() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::shadeableChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::Menu:
QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::iconChanged, b, [b]() { b->update(); });
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::iconChanged, b, [b]() { b->update(); });
break;

default: break;
Expand Down Expand Up @@ -151,7 +151,7 @@ namespace Breeze
const QRectF iconRect( geometry().topLeft(), 0.8*m_iconSize );
const qreal width( m_iconSize.width() );
painter->translate( 0.1*width, 0.1*width );
decoration()->client().data()->icon().paint(painter, iconRect.toRect());
decoration()->client().toStrongRef().data()->icon().paint(painter, iconRect.toRect());

} else {

Expand Down Expand Up @@ -642,7 +642,7 @@ namespace Breeze
painter->translate( 4, 4 );
}

bool inactiveWindow( d && !d->client().data()->isActive() );
bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );

QColor darkSymbolColor( ( inactiveWindow && isMatchTitleBarColor ) ? QColor(81, 102, 107) : QColor(34, 45, 50) );
Expand Down Expand Up @@ -1042,7 +1042,7 @@ namespace Breeze
painter->translate( 4, 4 );
}

bool inactiveWindow( d && !d->client().data()->isActive() );
bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );

QColor darkSymbolColor( ( inactiveWindow && isMatchTitleBarColor ) ? QColor(81, 102, 107) : QColor(34, 45, 50) );
Expand Down Expand Up @@ -1460,7 +1460,7 @@ namespace Breeze
painter->translate( 4, 4 );
}

bool inactiveWindow( d && !d->client().data()->isActive() );
bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool useActiveButtonStyle( d && d->internalSettings()->buttonStyle() == 5 );
bool useInactiveButtonStyle( d && d->internalSettings()->buttonStyle() == 6 );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );
Expand Down Expand Up @@ -1948,7 +1948,7 @@ namespace Breeze
painter->translate( 4, 4 );
}

bool inactiveWindow( d && !d->client().data()->isActive() );
bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool useActiveButtonStyle( d && d->internalSettings()->buttonStyle() == 8 );
bool useInactiveButtonStyle( d && d->internalSettings()->buttonStyle() == 9 );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );
Expand Down Expand Up @@ -3818,7 +3818,7 @@ namespace Breeze

}

auto c = d->client().data();
auto c = d->client().toStrongRef().data();
if( isPressed() ) {

if( type() == DecorationButtonType::Close ) return c->color( ColorGroup::Warning, ColorRole::Foreground );
Expand Down
36 changes: 18 additions & 18 deletions breezedecoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ namespace Breeze
QColor titleBarColor( this->rawTitleBarColor() );
QColor outlineColor( this->outlineColor() );

auto c( client().data() );
auto c( client().toStrongRef().data() );
if ( drawBackgroundGradient() ) // && c->isActive() )
{
if ( c->isActive() )
Expand Down Expand Up @@ -274,7 +274,7 @@ namespace Breeze
qreal colorConditional = 0.299 * static_cast<qreal>(r) + 0.587 * static_cast<qreal>(g) + 0.114 * static_cast<qreal>(b);

QColor outlineColor;
auto c( client().data() );
auto c( client().toStrongRef().data() );
if ( c->isActive() ) {
if ( colorConditional > 69 ) // 255 -186
outlineColor = titleBarColor.darker(140);
Expand Down Expand Up @@ -302,7 +302,7 @@ namespace Breeze
//________________________________________________________________
QColor Decoration::rawTitleBarColor() const
{
auto c = client().data();
auto c = client().toStrongRef().data();
QColor titleBarColor;

if ( !matchColorForTitleBar() ) {
Expand All @@ -324,7 +324,7 @@ namespace Breeze
//________________________________________________________________
QColor Decoration::fontColor() const
{
auto c = client().data();
auto c = client().toStrongRef().data();

QColor darkTextColor( !c->isActive() && matchColorForTitleBar() ? QColor(81, 102, 107) : QColor(34, 45, 50) );
QColor lightTextColor( !c->isActive() && matchColorForTitleBar() ? QColor(192, 193, 194) : QColor(250, 251, 252) );
Expand Down Expand Up @@ -370,7 +370,7 @@ namespace Breeze
//________________________________________________________________
void Decoration::init()
{
auto c = client().data();
auto c = client().toStrongRef().data();

// active state change animation
// It is important start and end value are of the same type, hence 0.0 and not just 0
Expand Down Expand Up @@ -431,7 +431,7 @@ namespace Breeze
void Decoration::updateTitleBar()
{
auto s = settings();
auto c = client().data();
auto c = client().toStrongRef().data();
const bool maximized = isMaximized();
const int width = maximized ? c->width() : c->width() - 2*s->largeSpacing()*Metrics::TitleBar_SideMargin;
const int height = maximized ? borderTop() : borderTop() - s->smallSpacing()*Metrics::TitleBar_TopMargin;
Expand All @@ -446,7 +446,7 @@ namespace Breeze
if( m_internalSettings->animationsEnabled() )
{

auto c = client().data();
auto c = client().toStrongRef().data();
m_animation->setDirection( c->isActive() ? QAbstractAnimation::Forward : QAbstractAnimation::Backward );
if( m_animation->state() != QAbstractAnimation::Running ) m_animation->start();

Expand All @@ -460,7 +460,7 @@ namespace Breeze
//________________________________________________________________
void Decoration::updateShadow()
{
auto c = client().data();
auto c = client().toStrongRef().data();

if ( !g_specificShadowsInactiveWindows || c->isActive() )
updateActiveShadow();
Expand Down Expand Up @@ -625,7 +625,7 @@ namespace Breeze
//________________________________________________________________
void Decoration::updateSizeGripVisibility()
{
auto c = client().data();
auto c = client().toStrongRef().data();
if( m_sizeGrip )
{ m_sizeGrip->setVisible( c->isResizeable() && !isMaximized() && !c->isShaded() ); }
}
Expand Down Expand Up @@ -682,15 +682,15 @@ namespace Breeze
createShadow();

// size grip
if( hasNoBorders() && m_internalSettings->drawSizeGrip() ) createSizeGrip();
if( borderSize() <= 1 && m_internalSettings->drawSizeGrip() ) createSizeGrip();
else deleteSizeGrip();

}

//________________________________________________________________
void Decoration::recalculateBorders()
{
auto c = client().data();
auto c = client().toStrongRef().data();
auto s = settings();

// left, right and bottom borders
Expand Down Expand Up @@ -721,7 +721,7 @@ namespace Breeze
const int extSize = s->largeSpacing();
int extSides = 0;
int extBottom = 0;
if( hasNoBorders() )
if( borderSize() <= 1 )
{
if( !isMaximizedHorizontally() ) extSides = extSize;
if( !isMaximizedVertically() ) extBottom = extSize;
Expand Down Expand Up @@ -773,7 +773,7 @@ namespace Breeze
// padding
const int vPadding = isTopEdge() ? 0 : s->smallSpacing()*Metrics::TitleBar_TopMargin;
// const int hPadding = s->smallSpacing()*Metrics::TitleBar_SideMargin;
const int hPadding = m_internalSettings->buttonPadding();
const int hPadding = m_internalSettings->buttonPadding() + m_internalSettings->buttonHOffset();
if( isLeftEdge() )
{
// add offsets on the side buttons, to preserve padding, but satisfy Fitts law
Expand All @@ -798,7 +798,7 @@ namespace Breeze
// padding
const int vPadding = isTopEdge() ? 0 : s->smallSpacing()*Metrics::TitleBar_TopMargin;
// const int hPadding = s->smallSpacing()*Metrics::TitleBar_SideMargin;
const int hPadding = m_internalSettings->buttonPadding();
const int hPadding = m_internalSettings->buttonPadding() + m_internalSettings->buttonHOffset();
if( isRightEdge() )
{

Expand All @@ -820,7 +820,7 @@ namespace Breeze
void Decoration::paint(QPainter *painter, const QRect &repaintRegion)
{
// TODO: optimize based on repaintRegion
auto c = client().data();
auto c = client().toStrongRef().data();
auto s = settings();

QColor titleBarColor = this->titleBarColor();
Expand Down Expand Up @@ -872,7 +872,7 @@ namespace Breeze
const QRect titleRect(QPoint(0, 0), QSize(size().width(), borderTop()));
if ( !titleRect.intersects(repaintRegion) ) return;

auto c = client().data();
auto c = client().toStrongRef().data();
QColor outlineColor( this->outlineColor() );
QColor titleBarColor = this->titleBarColor();

Expand Down Expand Up @@ -969,7 +969,7 @@ namespace Breeze
if( hideTitleBar() ) return qMakePair( QRect(), Qt::AlignCenter );
else {

auto c = client().data();
auto c = client().toStrongRef().data();
const int leftOffset = m_leftButtons->buttons().isEmpty() ?
Metrics::TitleBar_SideMargin*settings()->smallSpacing():
m_leftButtons->geometry().x() + m_leftButtons->geometry().width() + Metrics::TitleBar_SideMargin*settings()->smallSpacing();
Expand Down Expand Up @@ -1066,7 +1066,7 @@ namespace Breeze
if( !QX11Info::isPlatformX11() ) return;

// access client
auto c = client().data();
auto c = client().toStrongRef().data();
if( !c ) return;

if( c->windowId() != 0 )
Expand Down
16 changes: 8 additions & 8 deletions breezedecoration.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,28 +193,28 @@ namespace Breeze
}

bool Decoration::isMaximized() const
{ return client().data()->isMaximized() && !m_internalSettings->drawBorderOnMaximizedWindows(); }
{ return client().toStrongRef().data()->isMaximized() && !m_internalSettings->drawBorderOnMaximizedWindows(); }

bool Decoration::isMaximizedHorizontally() const
{ return client().data()->isMaximizedHorizontally() && !m_internalSettings->drawBorderOnMaximizedWindows(); }
{ return client().toStrongRef().data()->isMaximizedHorizontally() && !m_internalSettings->drawBorderOnMaximizedWindows(); }

bool Decoration::isMaximizedVertically() const
{ return client().data()->isMaximizedVertically() && !m_internalSettings->drawBorderOnMaximizedWindows(); }
{ return client().toStrongRef().data()->isMaximizedVertically() && !m_internalSettings->drawBorderOnMaximizedWindows(); }

bool Decoration::isLeftEdge() const
{ return (client().data()->isMaximizedHorizontally() || client().data()->adjacentScreenEdges().testFlag( Qt::LeftEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); }
{ return (client().toStrongRef().data()->isMaximizedHorizontally() || client().toStrongRef().data()->adjacentScreenEdges().testFlag( Qt::LeftEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); }

bool Decoration::isRightEdge() const
{ return (client().data()->isMaximizedHorizontally() || client().data()->adjacentScreenEdges().testFlag( Qt::RightEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); }
{ return (client().toStrongRef().data()->isMaximizedHorizontally() || client().toStrongRef().data()->adjacentScreenEdges().testFlag( Qt::RightEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); }

bool Decoration::isTopEdge() const
{ return (client().data()->isMaximizedVertically() || client().data()->adjacentScreenEdges().testFlag( Qt::TopEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); }
{ return (client().toStrongRef().data()->isMaximizedVertically() || client().toStrongRef().data()->adjacentScreenEdges().testFlag( Qt::TopEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); }

bool Decoration::isBottomEdge() const
{ return (client().data()->isMaximizedVertically() || client().data()->adjacentScreenEdges().testFlag( Qt::BottomEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); }
{ return (client().toStrongRef().data()->isMaximizedVertically() || client().toStrongRef().data()->adjacentScreenEdges().testFlag( Qt::BottomEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); }

bool Decoration::hideTitleBar() const
{ return m_internalSettings->hideTitleBar() == 3 || ( m_internalSettings->hideTitleBar() == 1 && client().data()->isMaximized() ) || ( m_internalSettings->hideTitleBar() == 2 && ( client().data()->isMaximized() || client().data()->isMaximizedVertically() || client().data()->isMaximizedHorizontally()) ); }
{ return m_internalSettings->hideTitleBar() == 3 || ( m_internalSettings->hideTitleBar() == 1 && client().toStrongRef().data()->isMaximized() ) || ( m_internalSettings->hideTitleBar() == 2 && ( client().toStrongRef().data()->isMaximized() || client().toStrongRef().data()->isMaximizedVertically() || client().toStrongRef().data()->isMaximizedHorizontally()) ); }

int Decoration::titleBarAlpha() const
{
Expand Down
4 changes: 4 additions & 0 deletions breezesettingsdata.kcfg
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@
<default>4</default>
</entry>

<entry name="ButtonHOffset" type = "Int">
<default>0</default>
</entry>

<!-- hide title bar -->
<entry name="HideTitleBar" type = "Enum">
<choices>
Expand Down
2 changes: 1 addition & 1 deletion breezesettingsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace Breeze
QString className;

// get the client
auto client = decoration->client().data();
auto client = decoration->client().toStrongRef().data();

foreach( auto internalSettings, m_exceptions )
{
Expand Down
8 changes: 4 additions & 4 deletions breezesizegrip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace Breeze
updatePosition();

// connections
auto c = decoration->client().data();
auto c = decoration->client().toStrongRef().data();
connect( c, &KDecoration2::DecoratedClient::widthChanged, this, &SizeGrip::updatePosition );
connect( c, &KDecoration2::DecoratedClient::heightChanged, this, &SizeGrip::updatePosition );
connect( c, &KDecoration2::DecoratedClient::activeChanged, this, &SizeGrip::updateActiveState );
Expand Down Expand Up @@ -99,7 +99,7 @@ namespace Breeze
#if BREEZE_HAVE_X11

if( !QX11Info::isPlatformX11() ) return;
auto c = m_decoration.data()->client().data();
auto c = m_decoration.data()->client().toStrongRef().data();

xcb_window_t windowId = c->windowId();
if( windowId )
Expand Down Expand Up @@ -191,7 +191,7 @@ namespace Breeze
#if BREEZE_HAVE_X11
if( !QX11Info::isPlatformX11() ) return;

auto c = m_decoration.data()->client().data();
auto c = m_decoration.data()->client().toStrongRef().data();
QPoint position(
c->width() - GripSize - Offset,
c->height() - GripSize - Offset );
Expand All @@ -213,7 +213,7 @@ namespace Breeze
auto connection( QX11Info::connection() );

// client
auto c = m_decoration.data()->client().data();
auto c = m_decoration.data()->client().toStrongRef().data();

/*
get root position matching position
Expand Down
Loading

0 comments on commit e5fedaf

Please sign in to comment.