diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp index e22e6b77..9bee3101 100644 --- a/kdecoration/breezedecoration.cpp +++ b/kdecoration/breezedecoration.cpp @@ -103,7 +103,8 @@ namespace Breeze QColor Decoration::titleBarColor() const { - if( m_animation->state() == QPropertyAnimation::Running ) + if( hideTitleBar() ) return m_colorSettings.titleBar( false ); + else if( m_animation->state() == QPropertyAnimation::Running ) { return KColorUtils::mix( m_colorSettings.inactiveTitleBar(), m_colorSettings.activeTitleBar(), m_opacity ); } else return m_colorSettings.titleBar( client().data()->isActive() ); @@ -289,17 +290,22 @@ namespace Breeze const int right = isMaximizedHorizontally() || edges.testFlag(Qt::RightEdge) ? 0 : borderSize(); const int bottom = isMaximizedVertically() || c->isShaded() || edges.testFlag(Qt::BottomEdge) ? 0 : borderSize(true); - // top border - QFontMetrics fm(s->font()); - int top = qMax(fm.boundingRect(c->caption()).height(), buttonHeight() ); + int top = 0; + if( hideTitleBar() ) top = bottom; + else { - // padding below - // extra pixel is used for the active window outline - const int baseSize = settings()->smallSpacing(); - top += baseSize*Metrics::TitleBar_BottomMargin + 1; + QFontMetrics fm(s->font()); + top += qMax(fm.boundingRect(c->caption()).height(), buttonHeight() ); + + // padding below + // extra pixel is used for the active window outline + const int baseSize = settings()->smallSpacing(); + top += baseSize*Metrics::TitleBar_BottomMargin + 1; - // padding above - top += baseSize*TitleBar_TopMargin; + // padding above + top += baseSize*TitleBar_TopMargin; + + } setBorders(QMargins(left, top, right, bottom)); @@ -391,12 +397,13 @@ namespace Breeze painter->setBrush(m_colorSettings.frame(client().data()->isActive())); // clip away the top part - painter->setClipRect(0, borderTop(), size().width(), size().height() - borderTop(), Qt::IntersectClip); + if( !hideTitleBar() ) painter->setClipRect(0, borderTop(), size().width(), size().height() - borderTop(), Qt::IntersectClip); + painter->drawRoundedRect(rect(), Metrics::Frame_FrameRadius, Metrics::Frame_FrameRadius); painter->restore(); } - paintTitleBar(painter, repaintRegion); + if( !hideTitleBar() ) paintTitleBar(painter, repaintRegion); } //________________________________________________________________ @@ -474,54 +481,58 @@ namespace Breeze //________________________________________________________________ int Decoration::captionHeight() const - { return borderTop() - settings()->smallSpacing()*(Metrics::TitleBar_BottomMargin + Metrics::TitleBar_TopMargin ) - 1; } + { return hideTitleBar() ? borderTop() : borderTop() - settings()->smallSpacing()*(Metrics::TitleBar_BottomMargin + Metrics::TitleBar_TopMargin ) - 1; } //________________________________________________________________ QRect Decoration::captionRect() const { - const int leftOffset = m_leftButtons->geometry().x() + m_leftButtons->geometry().width() + Metrics::TitleBar_SideMargin*settings()->smallSpacing(); - const int rightOffset = size().width() - m_rightButtons->geometry().x() + Metrics::TitleBar_SideMargin*settings()->smallSpacing(); - const int yOffset = settings()->smallSpacing()*Metrics::TitleBar_TopMargin; + if( hideTitleBar() ) return QRect(); + else { + const int leftOffset = m_leftButtons->geometry().x() + m_leftButtons->geometry().width() + Metrics::TitleBar_SideMargin*settings()->smallSpacing(); + const int rightOffset = size().width() - m_rightButtons->geometry().x() + Metrics::TitleBar_SideMargin*settings()->smallSpacing(); + const int yOffset = settings()->smallSpacing()*Metrics::TitleBar_TopMargin; - QRect boundingRect( settings()->fontMetrics().boundingRect( client().data()->caption()).toRect() ); - boundingRect.setTop( yOffset ); - boundingRect.setHeight( captionHeight() ); + QRect boundingRect( settings()->fontMetrics().boundingRect( client().data()->caption()).toRect() ); + boundingRect.setTop( yOffset ); + boundingRect.setHeight( captionHeight() ); - switch( m_internalSettings->titleAlignment() ) - { - case Breeze::InternalSettings::AlignLeft: - boundingRect.moveLeft( leftOffset ); - break; + switch( m_internalSettings->titleAlignment() ) + { + case Breeze::InternalSettings::AlignLeft: + boundingRect.moveLeft( leftOffset ); + break; - case Breeze::InternalSettings::AlignRight: - boundingRect.moveRight( size().width() - rightOffset - 1 ); - break; + case Breeze::InternalSettings::AlignRight: + boundingRect.moveRight( size().width() - rightOffset - 1 ); + break; - case Breeze::InternalSettings::AlignCenter: - boundingRect.moveLeft( leftOffset + (size().width() - leftOffset - rightOffset - boundingRect.width() )/2 ); - break; + case Breeze::InternalSettings::AlignCenter: + boundingRect.moveLeft( leftOffset + (size().width() - leftOffset - rightOffset - boundingRect.width() )/2 ); + break; - default: - case Breeze::InternalSettings::AlignCenterFullWidth: - boundingRect.moveLeft( ( size().width() - boundingRect.width() )/2 ); - break; + default: + case Breeze::InternalSettings::AlignCenterFullWidth: + boundingRect.moveLeft( ( size().width() - boundingRect.width() )/2 ); + break; - } + } - // make sure there is no overlap with buttons - if( boundingRect.left() < leftOffset ) - { + // make sure there is no overlap with buttons + if( boundingRect.left() < leftOffset ) + { - boundingRect.moveLeft( leftOffset ); - boundingRect.setRight( qMin( boundingRect.right(), size().width() - rightOffset - 1 ) ); + boundingRect.moveLeft( leftOffset ); + boundingRect.setRight( qMin( boundingRect.right(), size().width() - rightOffset - 1 ) ); - } else if( boundingRect.right() > size().width() - rightOffset - 1 ) { + } else if( boundingRect.right() > size().width() - rightOffset - 1 ) { - boundingRect.moveRight( size().width() - rightOffset - 1 ); - boundingRect.setLeft( qMax( boundingRect.left(), leftOffset ) ); - } + boundingRect.moveRight( size().width() - rightOffset - 1 ); + boundingRect.setLeft( qMax( boundingRect.left(), leftOffset ) ); + } - return boundingRect; + return boundingRect; + + } } diff --git a/kdecoration/breezedecoration.h b/kdecoration/breezedecoration.h index 705984ac..1f326312 100644 --- a/kdecoration/breezedecoration.h +++ b/kdecoration/breezedecoration.h @@ -96,6 +96,7 @@ namespace Breeze inline bool isMaximized( void ) const; inline bool isMaximizedHorizontally( void ) const; inline bool isMaximizedVertically( void ) const; + inline bool hideTitleBar( void ) const; //@} public Q_SLOTS: @@ -166,6 +167,7 @@ namespace Breeze bool Decoration::isMaximized( void ) const { return client().data()->isMaximized() && !m_internalSettings->drawBorderOnMaximizedWindows(); } bool Decoration::isMaximizedHorizontally( void ) const { return client().data()->isMaximizedHorizontally() && !m_internalSettings->drawBorderOnMaximizedWindows(); } bool Decoration::isMaximizedVertically( void ) const { return client().data()->isMaximizedVertically() && !m_internalSettings->drawBorderOnMaximizedWindows(); } + bool Decoration::hideTitleBar( void ) const { return m_internalSettings->hideTitleBar() && !client().data()->isShaded(); } } diff --git a/kdecoration/config/breezeexceptiondialog.cpp b/kdecoration/config/breezeexceptiondialog.cpp index 23fd9c9f..f491e0ca 100644 --- a/kdecoration/config/breezeexceptiondialog.cpp +++ b/kdecoration/config/breezeexceptiondialog.cpp @@ -40,7 +40,6 @@ namespace Breeze { m_ui.setupUi( this ); - m_ui.hideTitleBar->hide(); connect( m_ui.buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL(clicked()), this, SLOT(close()) );