From 796e7ff92ada066cbe34764d084287fa7cf0dd73 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Mon, 20 Dec 2010 22:18:52 +0000 Subject: [PATCH] Properly account for window's shaded state, and number of clients in groups when deciding whether or not the titlebar should be hidden. This is half the job, cause the above does not work (yet) when grouping windows among which one has hidden titlebar. Shading works well now, though. CCBUG: 260815 svn path=/trunk/KDE/kdebase/workspace/; revision=1208187 --- clients/oxygen/oxygenbutton.cpp | 2 +- clients/oxygen/oxygenclient.cpp | 14 +++++++------- clients/oxygen/oxygenclient.h | 12 +++++++++++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/clients/oxygen/oxygenbutton.cpp b/clients/oxygen/oxygenbutton.cpp index cd7e32ce21..b85336511a 100644 --- a/clients/oxygen/oxygenbutton.cpp +++ b/clients/oxygen/oxygenbutton.cpp @@ -170,7 +170,7 @@ namespace Oxygen void Button::paintEvent(QPaintEvent *event) { - if( client_.configuration().hideTitleBar() ) return; + if( client_.hideTitleBar() ) return; QPainter painter(this); painter.setClipRect(this->rect().intersected( event->rect() ) ); diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index f087ee8c3c..33682c2b49 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -240,7 +240,7 @@ namespace Oxygen if( configuration().frameBorder() == Configuration::BorderNone && !isShade() ) { - if( configuration().hideTitleBar() ) mask = QRegion(); + if( hideTitleBar() ) mask = QRegion(); else if( compositingActive() ) mask = (configuration().shadowMode() == Configuration::OxygenShadows ) ? QRegion():helper().decoRoundedMask( frame, 1, 1, 1, 0 ); else mask = helper().roundedMask( frame, 1, 1, 1, 0 ); @@ -262,7 +262,7 @@ namespace Oxygen const bool maximized( isMaximized() ); const bool narrowSpacing( configuration().useNarrowButtonSpacing() ); const int frameBorder( configuration().frameBorder() ); - const int buttonSize( configuration().hideTitleBar() ? 0 : configuration().buttonSize() ); + const int buttonSize( hideTitleBar() ? 0 : configuration().buttonSize() ); switch (lm) { @@ -302,7 +302,7 @@ namespace Oxygen case LM_TitleEdgeTop: { int border = 0; - if( frameBorder == Configuration::BorderNone && configuration().hideTitleBar() ) + if( frameBorder == Configuration::BorderNone && hideTitleBar() ) { border = 0; @@ -532,7 +532,7 @@ namespace Oxygen const int offset = layoutMetric( LM_OuterPaddingTop ); int height = 64 - Configuration::ButtonDefault; - if( !configuration().hideTitleBar() ) height += configuration().buttonSize(); + if( !hideTitleBar() ) height += configuration().buttonSize(); const QWidget* window( isPreview() ? this->widget() : widget->window() ); helper().renderWindowBackground(painter, rect, widget, window, palette, offset, height ); @@ -1389,7 +1389,7 @@ namespace Oxygen painter.restore(); } - if( !configuration().hideTitleBar() ) + if( !hideTitleBar() ) { // title bounding rect @@ -1469,7 +1469,7 @@ namespace Oxygen { // check button and distance to drag point - if( configuration().hideTitleBar() || mouseButton_ == Qt::NoButton || ( event->pos() - dragPoint_ ).manhattanLength() <= QApplication::startDragDistance() ) + if( hideTitleBar() || mouseButton_ == Qt::NoButton || ( event->pos() - dragPoint_ ).manhattanLength() <= QApplication::startDragDistance() ) { return false; } bool accepted( false ); @@ -1552,7 +1552,7 @@ namespace Oxygen { // check if drag enter is allowed - if( !event->mimeData()->hasFormat( clientGroupItemDragMimeType() ) || configuration().hideTitleBar() ) return false; + if( !event->mimeData()->hasFormat( clientGroupItemDragMimeType() ) || hideTitleBar() ) return false; // event->acceptProposedAction(); diff --git a/clients/oxygen/oxygenclient.h b/clients/oxygen/oxygenclient.h index 2eb61b1d65..39ea3ee75e 100644 --- a/clients/oxygen/oxygenclient.h +++ b/clients/oxygen/oxygenclient.h @@ -38,6 +38,7 @@ #include #include +#include #include @@ -109,6 +110,15 @@ namespace Oxygen } + //! true if titlebar is hidden + bool hideTitleBar( void ) const + { + return + configuration().hideTitleBar() && + !isShade() && + clientGroupItems().count() == 1; + } + //@} //! window shape @@ -333,7 +343,7 @@ namespace Oxygen useAnimations() && configuration().animateTitleChange() && !configuration().drawTitleOutline() && - !configuration().hideTitleBar() && + !hideTitleBar() && !isPreview(); }