diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index 081b1d4936..ce56a8b8be 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -836,12 +836,12 @@ void AuroraeClient::paintEvent(QPaintEvent *event) } else { result = Plasma::PaintUtils::transition(m_activeText, m_inactiveText, m_animationProgress); } - painter.drawPixmap(titleRect(), result); + painter.drawPixmap(0, 0, result); } else { if (isActive()) { - painter.drawPixmap(titleRect(), m_activeText); + painter.drawPixmap(0, 0, m_activeText); } else { - painter.drawPixmap(titleRect(), m_inactiveText); + painter.drawPixmap(0, 0, m_inactiveText); } } } @@ -855,6 +855,15 @@ void AuroraeClient::generateTextPixmap(QPixmap& pixmap, bool active) } const ThemeConfig &conf = AuroraeFactory::instance()->themeConfig(); painter.setFont(options()->font(active)); + if ((active && conf.haloActive()) || (!active && conf.haloInactive())) { + QRectF haloRect = painter.fontMetrics().boundingRect(titleRect(), + conf.alignment() | conf.verticalAlignment() | Qt::TextSingleLine, + caption()); + if (haloRect.width() > titleRect().width()) { + haloRect.setWidth(titleRect().width()); + } + Plasma::PaintUtils::drawHalo(&painter, haloRect); + } if (conf.useTextShadow()) { // shadow code is inspired by Qt FAQ: How can I draw shadows behind text? // see http://www.qtsoftware.com/developer/faqs/faq.2007-07-27.3052836051 @@ -892,7 +901,7 @@ void AuroraeClient::generateTextPixmap(QPixmap& pixmap, bool active) } else { painter.setPen(conf.inactiveTextColor()); } - painter.drawText(pixmap.rect(), conf.alignment() | conf.verticalAlignment() | Qt::TextSingleLine, + painter.drawText(titleRect(), conf.alignment() | conf.verticalAlignment() | Qt::TextSingleLine, caption()); painter.end(); } @@ -966,9 +975,9 @@ void AuroraeClient::animationFinished(int id) void AuroraeClient::resize(const QSize& s) { KCommonDecoration::resize(s); - m_activeText = QPixmap(titleRect().size()); + m_activeText = QPixmap(QSize(widget()->width(), titleRect().height() + titleRect().y())); m_activeText.fill(Qt::transparent); - m_inactiveText = QPixmap(titleRect().size()); + m_inactiveText = QPixmap(QSize(widget()->width(), titleRect().height() + titleRect().y())); m_inactiveText.fill(Qt::transparent); captionChange(); } diff --git a/clients/aurorae/src/themeconfig.cpp b/clients/aurorae/src/themeconfig.cpp index c296c06498..8632d4b238 100644 --- a/clients/aurorae/src/themeconfig.cpp +++ b/clients/aurorae/src/themeconfig.cpp @@ -36,6 +36,8 @@ void ThemeConfig::load(KConfig *conf) m_inactiveTextShadowColor = general.readEntry("InactiveTextShadowColor", QColor(Qt::white)); m_textShadowOffsetX = general.readEntry("TextShadowOffsetX", 0); m_textShadowOffsetY = general.readEntry("TextShadowOffsetY", 0); + m_haloActive = general.readEntry("HaloActive", false); + m_haloInactive = general.readEntry("HaloInactive", false); QString alignment = (general.readEntry("TitleAlignment", "Left")).toLower(); if (alignment == "left") { m_alignment = Qt::AlignLeft; diff --git a/clients/aurorae/src/themeconfig.h b/clients/aurorae/src/themeconfig.h index de56b6387a..a75327d25a 100644 --- a/clients/aurorae/src/themeconfig.h +++ b/clients/aurorae/src/themeconfig.h @@ -55,6 +55,12 @@ public: bool useTextShadow() const { return m_useTextShadow; } + bool haloActive() const { + return m_haloActive; + } + bool haloInactive() const { + return m_haloInactive; + } // Alignment Qt::Alignment alignment() const { return m_alignment; @@ -184,6 +190,8 @@ private: int m_textShadowOffsetX; int m_textShadowOffsetY; bool m_useTextShadow; + bool m_haloActive; + bool m_haloInactive; Qt::Alignment m_alignment; Qt::Alignment m_verticalAlignment; // borders diff --git a/clients/aurorae/theme-description b/clients/aurorae/theme-description index 38d5c369be..474dbecdbb 100644 --- a/clients/aurorae/theme-description +++ b/clients/aurorae/theme-description @@ -94,6 +94,8 @@ ActiveTextShadowColor=255,255,255,255 # Shadow text color of active window InactiveTextShadowColor=255,255,255,255 # Shadow text color of active window TextShadowOffsetX=0 # Offset of shadow in x direction TextShadowOffsetY=0 # Offset of shadow in y direction +HaloActive=false # Draw halo behing title of active window (since 4.5) +HaloInactive=false # Draw halo behing title of inactive window (since 4.5) LeftButtons=MS # buttons in left button group (see http://api.kde.org/4.x-api/kdebase-workspace-apidocs/kwin/lib/html/classKDecorationOptions.html#8ad12d76c93c5f1a12ea07b30f92d2fa) RightButtons=HIA__X # buttons in right button group Shadow=true # decoration provides shadows: you have to add padding diff --git a/kcmkwin/kwindecoration/auroraepreview.cpp b/kcmkwin/kwindecoration/auroraepreview.cpp index 408d848e6a..118b30152e 100644 --- a/kcmkwin/kwindecoration/auroraepreview.cpp +++ b/kcmkwin/kwindecoration/auroraepreview.cpp @@ -30,6 +30,7 @@ along with this program. If not, see . #include // Plasma #include +#include namespace KWin { @@ -319,6 +320,15 @@ void AuroraePreview::paintDeco( QPainter *painter, bool active, const QRect &rec caption = i18n( "Inactive Window" ); } painter->setFont( KGlobalSettings::windowTitleFont() ); + if( ( active && m_themeConfig->haloActive() ) || ( !active && m_themeConfig->haloInactive() ) ) + { + QRectF haloRect = painter->fontMetrics().boundingRect(titleRect.toRect(), + m_themeConfig->alignment() | m_themeConfig->verticalAlignment() | Qt::TextSingleLine, + caption); + if( haloRect.width() > titleRect.width() ) + haloRect.setWidth( titleRect.width() ); + Plasma::PaintUtils::drawHalo(painter, haloRect); + } if( m_themeConfig->useTextShadow() ) { // shadow code is inspired by Qt FAQ: How can I draw shadows behind text?