summaryrefslogtreecommitdiffstats
path: root/kdefx
diff options
context:
space:
mode:
Diffstat (limited to 'kdefx')
-rw-r--r--kdefx/Makefile.am2
-rw-r--r--kdefx/kstyle.cpp52
2 files changed, 53 insertions, 1 deletions
diff --git a/kdefx/Makefile.am b/kdefx/Makefile.am
index d584ed2cb..52744c9cf 100644
--- a/kdefx/Makefile.am
+++ b/kdefx/Makefile.am
@@ -24,7 +24,7 @@ INCLUDES= $(all_includes)
lib_LTLIBRARIES = libkdefx.la
libkdefx_la_LDFLAGS = $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(all_libraries) -no-undefined -version-info 6:0:2
-libkdefx_la_LIBADD = $(LIB_QT) $(LIB_XRENDER)
+libkdefx_la_LIBADD = $(LIB_QT) $(LIB_XRENDER) $(LIB_X11)
libkdefx_la_NMCHECK = $(srcdir)/libkdefx.nmcheck
libkdefx_la_NMCHECKWEAK = $(srcdir)/libkdefx_weak.nmcheck $(top_srcdir)/kdecore/libqt-mt_weak.nmcheck \
$(top_srcdir)/kdecore/standard_weak.nmcheck
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 );
}