21#include <QVarLengthArray>
23#include <kwindowsystem.h>
29 #include <X11/Xatom.h>
30 #include <X11/Xutil.h>
33 #define DASHBOARD_WIN_NAME "dashboard"
34 #define DASHBOARD_WIN_CLASS "dashboard"
40namespace WindowEffects
54 effectName =
"_KDE_SLIDE";
57 effectName =
"_KDE_WINDOW_PREVIEW";
60 effectName =
"_KDE_PRESENT_WINDOWS_DESKTOP";
63 effectName =
"_KDE_PRESENT_WINDOWS_GROUP";
66 effectName =
"_KDE_WINDOW_HIGHLIGHT";
69 effectName =
"_KDE_SHADOW_OVERRIDE";
72 effectName =
"_KDE_NET_WM_BLUR_BEHIND_REGION";
76 effectName =
"_WM_EFFECT_KDE_DASHBOARD";
84 Display *dpy = QX11Info::display();
85 Atom atom = XInternAtom(dpy, effectName.toLatin1(), False);
87 Atom *list = XListProperties(dpy, DefaultRootWindow(dpy), &cnt);
89 bool ret = (qFind(list, list + cnt, atom) != list + cnt);
100 Display *dpy = QX11Info::display();
101 Atom atom = XInternAtom( dpy,
"_KDE_SLIDE", False );
102 QVarLengthArray<long, 2> data(2);
123 XDeleteProperty(dpy,
id, atom);
125 XChangeProperty(dpy,
id, atom, atom, 32, PropModeReplace,
126 reinterpret_cast<unsigned char *
>(data.data()), data.size());
134 Display *dpy = QX11Info::display();
135 Atom atom = XInternAtom( dpy,
"_KDE_SLIDE", False );
136 QVarLengthArray<long, 2> data(2);
156 XDeleteProperty(dpy, widget->effectiveWinId(), atom);
158 XChangeProperty(dpy, widget->effectiveWinId(), atom, atom, 32, PropModeReplace,
159 reinterpret_cast<unsigned char *
>(data.data()), data.size());
167 foreach (WId
id, ids) {
170 KWindowInfo info = KWindowSystem::windowInfo(
id, NET::WMGeometry|NET::WMFrameExtents);
184 if (windows.size() != rects.size()) {
188 Display *dpy = QX11Info::display();
189 Atom atom = XInternAtom(dpy,
"_KDE_WINDOW_PREVIEW", False);
190 if (windows.isEmpty()) {
191 XDeleteProperty(dpy, parent, atom);
195 int numWindows = windows.size();
198 QVarLengthArray<long, 64> data(1 + (6 * numWindows));
199 data[0] = numWindows;
201 QList<WId>::const_iterator windowsIt;
202 QList<QRect>::const_iterator rectsIt = rects.constBegin();
204 for (windowsIt = windows.constBegin(); windowsIt != windows.constEnd(); ++windowsIt) {
206 const int start = (i * 6) + 1;
207 const QRect thumbnailRect = (*rectsIt);
210 data[start+1] = (*windowsIt);
211 data[start+2] = thumbnailRect.x();
212 data[start+3] = thumbnailRect.y();
213 data[start+4] = thumbnailRect.width();
214 data[start+5] = thumbnailRect.height();
219 XChangeProperty(dpy, parent, atom, atom, 32, PropModeReplace,
220 reinterpret_cast<unsigned char *
>(data.data()), data.size());
227 const int numWindows = ids.count();
228 QVarLengthArray<long, 32> data(numWindows);
231 for (
int i = 0; i < numWindows; ++i) {
237 if (actualCount != numWindows) {
238 data.resize(actualCount);
241 if (!data.isEmpty()) {
242 Display *dpy = QX11Info::display();
243 Atom atom = XInternAtom(dpy,
"_KDE_PRESENT_WINDOWS_GROUP", False);
244 XChangeProperty(dpy, controller, atom, atom, 32, PropModeReplace,
245 reinterpret_cast<unsigned char *
>(data.data()), data.size());
253 QVarLengthArray<long, 1> data(1);
255 Display *dpy = QX11Info::display();
256 Atom atom = XInternAtom(dpy,
"_KDE_PRESENT_WINDOWS_DESKTOP", False);
257 XChangeProperty(dpy, controller, atom, atom, 32, PropModeReplace,
258 reinterpret_cast<unsigned char *
>(data.data()), data.size());
265 const int numWindows = ids.count();
266 Display *dpy = QX11Info::display();
267 Atom atom = XInternAtom(dpy,
"_KDE_WINDOW_HIGHLIGHT", False);
269 if (numWindows == 0) {
270 Atom atom = XInternAtom(dpy,
"_KDE_WINDOW_HIGHLIGHT", False);
271 XDeleteProperty(dpy, controller, atom);
274 QVarLengthArray<long, 32> data(numWindows);
277 for (
int i = 0; i < numWindows; ++i) {
283 if (actualCount != numWindows) {
284 data.resize(actualCount);
287 if (!data.isEmpty()) {
288 XChangeProperty(dpy, controller, atom, atom, 32, PropModeReplace,
289 reinterpret_cast<unsigned char *
>(data.data()), data.size());
297 Display *dpy = QX11Info::display();
298 Atom atom = XInternAtom( dpy,
"_KDE_SHADOW_OVERRIDE", False );
300 XDeleteProperty(dpy, window, atom);
302 QVarLengthArray<long, 1> data(1);
304 XChangeProperty(dpy, window, atom, atom, 32, PropModeReplace,
305 reinterpret_cast<unsigned char *
>(data.data()), data.size());
313 Display *dpy = QX11Info::display();
314 Atom atom = XInternAtom(dpy,
"_KDE_NET_WM_BLUR_BEHIND_REGION", False);
317 QVector<QRect> rects = region.rects();
318 QVector<unsigned long> data;
319 foreach (
const QRect &r, rects) {
320 data << r.x() << r.y() << r.width() << r.height();
323 XChangeProperty(dpy, window, atom, XA_CARDINAL, 32, PropModeReplace,
324 reinterpret_cast<const unsigned char *
>(data.constData()), data.size());
326 XDeleteProperty(dpy, window, atom);
334 XClassHint classHint;
337 XSetClassHint(QX11Info::display(), window, &classHint);
static Theme * defaultTheme()
Singleton pattern accessor.
void showWindowThumbnails(WId parent, const QList< WId > &windows, const QList< QRect > &rects)
Paint inside the window parent the thumbnails of the windows list in the respective rectangles of the...
void presentWindows(WId controller, const QList< WId > &ids)
Activate the Present Windows effect for the given groups of windows.
void enableBlurBehind(WId window, bool enable, const QRegion ®ion)
Instructs the window manager to blur the background in the specified region behind the given window.
void slideWindow(WId id, Plasma::Location location, int offset)
Mark a window as sliding from screen edge.
QList< QSize > windowSizes(const QList< WId > &ids)
void markAsDashboard(WId window)
Instructs the window manager to handle the given window as dashboard window as Dashboard windows shou...
void highlightWindows(WId controller, const QList< WId > &ids)
Highlight the selected windows, making all the others translucent.
void overrideShadow(WId window, bool override)
Forbid te windowmanager to automatically generate a shadow for this window.
bool isEffectAvailable(Effect effect)
Namespace for everything in libplasma.
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
@ LeftEdge
Along the left side of the screen.
@ Desktop
On the planar desktop layer, extending across the full screen from edge to edge.
@ TopEdge
Along the top of the screen.
@ RightEdge
Along the right side of the screen.
@ BottomEdge
Along the bottom of the screen.
#define DASHBOARD_WIN_NAME
#define DASHBOARD_WIN_CLASS