Aurorae supports drawing a halo behind the window title.
New options in General section of config file: HaloActive and HaloInactive. Default to off. FEATURE: 224011 svn path=/trunk/KDE/kdebase/workspace/; revision=1081745
This commit is contained in:
parent
fc0633fae3
commit
b15fc9e1d9
5 changed files with 37 additions and 6 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KStandardDirs>
|
||||
// Plasma
|
||||
#include <Plasma/FrameSvg>
|
||||
#include <Plasma/PaintUtils>
|
||||
|
||||
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?
|
||||
|
|
Loading…
Reference in a new issue