Add a method for setting the blur region for a window.
svn path=/trunk/KDE/kdelibs/; revision=1100073
This commit is contained in:
parent
222504cc9a
commit
caf251058b
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
#include <QX11Info>
|
#include <QX11Info>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -61,6 +62,10 @@ bool isEffectAvailable(Effect effect)
|
|||||||
break;
|
break;
|
||||||
case OverrideShadow:
|
case OverrideShadow:
|
||||||
effectName = "_KDE_SHADOW_OVERRIDE";
|
effectName = "_KDE_SHADOW_OVERRIDE";
|
||||||
|
break;
|
||||||
|
case BlurBehind:
|
||||||
|
effectName = "_KDE_NET_WM_BLUR_REGION";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -296,6 +301,28 @@ void overrideShadow(WId window, bool override)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enableBlurBehind(WId window, bool enable, const QRegion ®ion)
|
||||||
|
{
|
||||||
|
#ifdef Q_WS_X11
|
||||||
|
Display *dpy = QX11Info::display();
|
||||||
|
Atom atom = XInternAtom(dpy, "_KDE_NET_WM_BLUR_REGION", False);
|
||||||
|
|
||||||
|
if (enable) {
|
||||||
|
QVector<QRect> rects = region.rects();
|
||||||
|
QVector<quint32> data;
|
||||||
|
for (int i = 0; i < rects.count(); i++) {
|
||||||
|
const QRect r = rects[i];
|
||||||
|
data << r.x() << r.y() << r.width() << r.height();
|
||||||
|
}
|
||||||
|
|
||||||
|
XChangeProperty(dpy, window, atom, XA_CARDINAL, 32, PropModeReplace,
|
||||||
|
reinterpret_cast<const unsigned char *>(data.constData()), data.size());
|
||||||
|
} else {
|
||||||
|
XDeleteProperty(dpy, window, atom);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ namespace WindowEffects
|
|||||||
PresentWindows = 3,
|
PresentWindows = 3,
|
||||||
PresentWindowsGroup = 4,
|
PresentWindowsGroup = 4,
|
||||||
HighlightWindows = 5,
|
HighlightWindows = 5,
|
||||||
OverrideShadow = 6
|
OverrideShadow = 6,
|
||||||
|
BlurBehind = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,6 +134,22 @@ namespace WindowEffects
|
|||||||
* @since 4.4
|
* @since 4.4
|
||||||
*/
|
*/
|
||||||
PLASMA_EXPORT void overrideShadow(WId window, bool override);
|
PLASMA_EXPORT void overrideShadow(WId window, bool override);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instructs the window manager to blur the background in the specified region
|
||||||
|
* behind the given window. Passing a null region will enable the blur effect
|
||||||
|
* for the whole window. The region is relative to the top-left corner of the
|
||||||
|
* client area.
|
||||||
|
*
|
||||||
|
* Note that you will usually want to set the region to the shape of the window,
|
||||||
|
* excluding any shadow or halo.
|
||||||
|
*
|
||||||
|
* @param window The window for which to enable the blur effect
|
||||||
|
* @param enable Enable the effect if @a true, disable it if @false
|
||||||
|
* @param region The region within the window where the background will be blurred
|
||||||
|
* @since 4.5
|
||||||
|
*/
|
||||||
|
PLASMA_EXPORT void enableBlurBehind(WId window, bool enable = true, const QRegion ®ion = QRegion());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
Loading…
x
Reference in New Issue
Block a user