diff --git a/clients/laptop/CMakeLists.txt b/clients/laptop/CMakeLists.txt index 02ac135c25..1f4d6001f2 100644 --- a/clients/laptop/CMakeLists.txt +++ b/clients/laptop/CMakeLists.txt @@ -6,8 +6,7 @@ set(kwin3_laptop_PART_SRCS laptopclient.cpp) kde4_add_plugin(kwin3_laptop ${kwin3_laptop_PART_SRCS}) -target_link_libraries(kwin3_laptop ${KDE4_KDECORE_LIBS} ${KDE4_KDEFX_LIBS} kdecorations) -target_link_libraries(kwin3_laptop ${KDE4_KDEFX_LIBS} kdecorations) +target_link_libraries(kwin3_laptop kdecorations) install(TARGETS kwin3_laptop DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/clients/laptop/laptopclient.cpp b/clients/laptop/laptopclient.cpp index e2e21472fc..d5073ae97a 100644 --- a/clients/laptop/laptopclient.cpp +++ b/clients/laptop/laptopclient.cpp @@ -8,15 +8,12 @@ #include // up here to avoid X11 header conflict :P #include "laptopclient.h" -#include -//Added by qt3to4: #include #include -#include -#include -#include #include #include +#include +#include namespace Laptop { @@ -80,6 +77,16 @@ static inline const KDecorationOptions* options() return KDecoration::options(); } +static void gradientFill(QPixmap *pixmap, const QColor &color1, const QColor &color2, bool diagonal = false) +{ + QPainter p(pixmap); + QLinearGradient gradient(0, 0, diagonal ? pixmap->width() : 0, pixmap->height()); + gradient.setColorAt(0.0, color1); + gradient.setColorAt(1.0, color2); + QBrush brush(gradient); + p.fillRect(pixmap->rect(), brush); +} + static void drawButtonFrame(QPixmap *pix, const QPalette &g, bool sunken) { QPainter p; @@ -147,15 +154,9 @@ static void create_pixmaps() aUpperGradient = new QPixmap(32, titleHeight+2); iUpperGradient = new QPixmap(32, titleHeight+2); QColor bgColor = options()->color(KDecoration::ColorTitleBar, true); - KPixmapEffect::gradient(*aUpperGradient, - bgColor.light(120), - bgColor.dark(120), - KPixmapEffect::VerticalGradient); + gradientFill(aUpperGradient, bgColor.light(120), bgColor.dark(120)); bgColor = options()->color(KDecoration::ColorTitleBar, false); - KPixmapEffect::gradient(*iUpperGradient, - bgColor.light(120), - bgColor.dark(120), - KPixmapEffect::VerticalGradient); + gradientFill(iUpperGradient, bgColor.light(120), bgColor.dark(120)); } // buttons (active/inactive, sunken/unsunken, 2 sizes each) QPalette g = options()->palette(KDecoration::ColorButtonBg, true); @@ -170,25 +171,17 @@ static void create_pixmaps() iBtnPix2 = new QPixmap(btnWidth2, titleHeight); iBtnDownPix2 = new QPixmap(btnWidth2, titleHeight); if(QPixmap::defaultDepth() > 8){ - KPixmapEffect::gradient(*btnPix1, c.light(120), c.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*btnDownPix1, c.dark(130), c.light(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*btnPix2, c.light(120), c.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*btnDownPix2, c.dark(130), c.light(120), - KPixmapEffect::DiagonalGradient); + gradientFill(btnPix1, c.light(120), c.dark(130), true); + gradientFill(btnPix2, c.light(120), c.dark(130), true); + gradientFill(btnDownPix1, c.light(120), c.dark(130), true); + gradientFill(btnDownPix2, c.light(120), c.dark(130), true); g = options()->palette(KDecoration::ColorButtonBg, false); g.setCurrentColorGroup( QPalette::Active ); c = g.color(QPalette::Background); - KPixmapEffect::gradient(*iBtnPix1, c.light(120), c.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*iBtnDownPix1, c.dark(130), c.light(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*iBtnPix2, c.light(120), c.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*iBtnDownPix2, c.dark(130), c.light(120), - KPixmapEffect::DiagonalGradient); + gradientFill(iBtnPix1, c.light(120), c.dark(130), true); + gradientFill(iBtnPix2, c.light(120), c.dark(130), true); + gradientFill(iBtnDownPix1, c.light(120), c.dark(130), true); + gradientFill(iBtnDownPix2, c.light(120), c.dark(130), true); } else{ btnPix1->fill(c.rgb());