diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-11 03:46:01 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-11 03:46:01 +0000 |
commit | 865f314dd5ed55508f45a32973b709b79a541e36 (patch) | |
tree | dc1a3a884bb2fc10a89a3c46313897d22c5771eb /kdefx/kstyle.cpp | |
parent | ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (diff) | |
download | tdelibs-865f314dd5ed55508f45a32973b709b79a541e36.tar.gz tdelibs-865f314dd5ed55508f45a32973b709b79a541e36.zip |
kdelibs update to Trinity v3.5.11
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1061230 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdefx/kstyle.cpp')
-rw-r--r-- | kdefx/kstyle.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/kdefx/kstyle.cpp b/kdefx/kstyle.cpp index 5ce02012b..08fe94995 100644 --- a/kdefx/kstyle.cpp +++ b/kdefx/kstyle.cpp @@ -154,6 +154,7 @@ struct KStylePrivate bool menuAltKeyNavigation : 1; bool menuDropShadow : 1; bool sloppySubMenus : 1; + bool semiTransparentRubberband : 1; int popupMenuDelay; float menuOpacity; @@ -187,6 +188,7 @@ KStyle::KStyle( KStyleFlags flags, KStyleScrollBarType sbtype ) d->menuAltKeyNavigation = settings.readBoolEntry("/KStyle/Settings/MenuAltKeyNavigation", true); d->scrollablePopupmenus = settings.readBoolEntry("/KStyle/Settings/ScrollablePopupMenus", false); d->menuDropShadow = settings.readBoolEntry("/KStyle/Settings/MenuDropShadow", false); + d->semiTransparentRubberband = settings.readBoolEntry("/KStyle/Settings/SemiTransparentRubberband", false); d->menuHandler = NULL; if (useMenuTransparency) { @@ -553,7 +555,57 @@ void KStyle::drawPrimitive( PrimitiveElement pe, else // General handle, probably a kicker applet handle. drawKStylePrimitive( KPE_GeneralHandle, p, widget, r, cg, flags, opt ); +#if QT_VERSION >= 0x030300 +#ifdef HAVE_XRENDER + } else if ( d->semiTransparentRubberband && pe == QStyle::PE_RubberBand ) { + QRect rect = r.normalize(); + QPoint point; + point = p->xForm( point ); + + static XRenderColor clr = { 0, 0, 0, 0 }; + static unsigned long fillColor = 0; + if ( fillColor != cg.highlight().rgb() ) { + fillColor = cg.highlight().rgb(); + + unsigned long color = fillColor << 8 | 0x40; + + int red = (color >> 24) & 0xff; + int green = (color >> 16) & 0xff; + int blue = (color >> 8) & 0xff; + int alpha = (color >> 0) & 0xff; + + red = red * alpha / 255; + green = green * alpha / 255; + blue = blue * alpha / 255; + clr.red = (red << 8) + red; + clr.green = (green << 8) + green; + clr.blue = (blue << 8) + blue; + clr.alpha = (alpha << 8) + alpha; + } + + XRenderFillRectangle( + p->device()->x11Display(), + PictOpOver, + p->device()->x11RenderHandle(), + &clr, + rect.x() + point.x(), + rect.y() + point.y(), + rect.width(), + rect.height() ); + + p->save(); + p->setRasterOp( Qt::CopyROP ); + p->setPen( QPen( cg.highlight().dark( 160 ), 1 ) ); + p->setBrush( NoBrush ); + p->drawRect( + rect.x() + point.x(), + rect.y() + point.y(), + rect.width(), + rect.height() ); + p->restore(); +#endif +#endif } else QCommonStyle::drawPrimitive( pe, p, r, cg, flags, opt ); } |