From 853701e9aa7325a3690c5d29153a80453692e778 Mon Sep 17 00:00:00 2001 From: Luciano Montanaro Date: Thu, 27 Sep 2007 15:58:17 +0000 Subject: [PATCH] Remove KPixmapEffect references. Currently the mouseover effect is disabled, until I find a suitable effect to use instead of KPixmapEffect::intensity(). Fix another off-by-one rendering glitch in the buttons. svn path=/trunk/KDE/kdebase/workspace/; revision=717794 --- clients/kde2/CMakeLists.txt | 2 +- clients/kde2/kde2.cpp | 39 ++++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/clients/kde2/CMakeLists.txt b/clients/kde2/CMakeLists.txt index 08840e0776..b1d9a5b217 100644 --- a/clients/kde2/CMakeLists.txt +++ b/clients/kde2/CMakeLists.txt @@ -8,7 +8,7 @@ set(kwin3_kde2_PART_SRCS kde2.cpp) kde4_add_plugin(kwin3_kde2 ${kwin3_kde2_PART_SRCS}) -target_link_libraries(kwin3_kde2 ${KDE4_KDEFX_LIBS} kdecorations ${QT_QTGUI_LIBRARY}) +target_link_libraries(kwin3_kde2 kdecorations ${QT_QTGUI_LIBRARY}) install(TARGETS kwin3_kde2 DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/clients/kde2/kde2.cpp b/clients/kde2/kde2.cpp index 6e9a4fd68b..45e74e368b 100644 --- a/clients/kde2/kde2.cpp +++ b/clients/kde2/kde2.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -274,6 +273,15 @@ unsigned long KDE2Handler::readConfig( bool update ) return changed; } +static void gradientFill(QPixmap *pixmap, const QColor &color1, const QColor &color2) +{ + QPainter p(pixmap); + QLinearGradient gradient(0, 0, 0, pixmap->height()); + gradient.setColorAt(0.0, color1); + gradient.setColorAt(1.0, color2); + QBrush brush(gradient); + p.fillRect(pixmap->rect(), brush); +} // This paints the button pixmaps upon loading the style. void KDE2Handler::createPixmaps() @@ -321,24 +329,19 @@ void KDE2Handler::createPixmaps() if(highcolor) { + QSize s(128, normalTitleHeight + 2); // Create the titlebar gradients if (activeTitleColor1 != activeTitleColor2) { - aUpperGradient = new QPixmap(128, normalTitleHeight+2); - KPixmapEffect::gradient(*aUpperGradient, - activeTitleColor1, - activeTitleColor2, - KPixmapEffect::VerticalGradient); + + aUpperGradient = new QPixmap(s); + gradientFill(aUpperGradient, activeTitleColor1, activeTitleColor2); } if (inactiveTitleColor1 != inactiveTitleColor2) { - iUpperGradient = new QPixmap(128, normalTitleHeight+2); - - KPixmapEffect::gradient(*iUpperGradient, - inactiveTitleColor1, - inactiveTitleColor2, - KPixmapEffect::VerticalGradient); + iUpperGradient = new QPixmap(s); + gradientFill(iUpperGradient, inactiveTitleColor1, inactiveTitleColor2); } } @@ -500,8 +503,7 @@ void KDE2Handler::drawButtonBackground(QPixmap *pix, // Fill the background with a gradient if possible if (highcolor) - KPixmapEffect::gradient(*pix, c.light(130), c.dark(130), - KPixmapEffect::VerticalGradient); + gradientFill(pix, c.light(130), c.dark(130)); else pix->fill(c); @@ -514,7 +516,7 @@ void KDE2Handler::drawButtonBackground(QPixmap *pix, p.drawLine(x2, 0, x2, y2); p.drawLine(0, x2, y2, x2); p.setPen(g.color( QPalette::Dark )); - p.drawRect(1, 1, w-2, h-2); + p.drawRect(1, 1, w-3, h-3); p.setPen(sunken ? g.color( QPalette::Mid ) : g.color( QPalette::Light )); p.drawLine(2, 2, x2-2, 2); p.drawLine(2, 2, 2, y2-2); @@ -703,7 +705,8 @@ void KDE2Button::drawButton(QPainter *p) // Intensify the image if required if (isMouseOver) { - btnpix = KPixmapEffect::intensity(btnpix, 0.8); + // XXX Find a suitable substitute for this. + // btnpix = KPixmapEffect::intensity(btnpix, 0.8); } // Smooth scale the pixmap for small titlebars @@ -1067,5 +1070,5 @@ extern "C" KDE_EXPORT KDecorationFactory* create_factory() return new KDE2::KDE2Handler(); } -// vim: ts=4 -// kate: space-indent off; tab-width 4; +// vim: ts=4 sw=4 +// kate: space-indent off; tab-width 4;