Adding a highlevel method to activate the present windows effect for a desktop or a group of windows.
svn path=/trunk/KDE/kdelibs/; revision=1038529
This commit is contained in:
parent
848de50e21
commit
cdfbfc2a8f
@ -50,6 +50,12 @@ bool isEffectAvailable(Effect effect)
|
||||
case WindowPreview:
|
||||
effectName = "_KDE_WINDOW_PREVIEW";
|
||||
break;
|
||||
case PresentWindows:
|
||||
effectName = "_KDE_PRESENT_WINDOWS_DESKTOP";
|
||||
break;
|
||||
case PresentWindowsGroup:
|
||||
effectName = "_KDE_PRESENT_WINDOWS_GROUP";
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -198,6 +204,44 @@ void showWindowThumbnails(WId parent, const QList<WId> &windows, const QList<QRe
|
||||
#endif
|
||||
}
|
||||
|
||||
void presentWindows(WId controler, const QList<WId> &ids)
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
const int numWindows = ids.count();
|
||||
QVarLengthArray<long, 32> data(numWindows);
|
||||
int actualCount = 0;
|
||||
|
||||
for (int i = 0; i < numWindows; ++i) {
|
||||
data[i] = ids.at(i);
|
||||
++actualCount;
|
||||
|
||||
}
|
||||
|
||||
if (actualCount != numWindows) {
|
||||
data.resize(actualCount);
|
||||
}
|
||||
|
||||
if (!data.isEmpty()) {
|
||||
Display *dpy = QX11Info::display();
|
||||
Atom atom = XInternAtom(dpy, "_KDE_PRESENT_WINDOWS_GROUP", False);
|
||||
XChangeProperty(dpy, controler, atom, atom, 32, PropModeReplace,
|
||||
reinterpret_cast<unsigned char *>(data.data()), data.size());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void presentWindows(WId controler, int desktop)
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
QVarLengthArray<long, 32> data(1);
|
||||
data[0] = desktop;
|
||||
Display *dpy = QX11Info::display();
|
||||
Atom atom = XInternAtom(dpy, "_KDE_PRESENT_WINDOWS_DESKTOP", False);
|
||||
XChangeProperty(dpy, controler, atom, atom, 32, PropModeReplace,
|
||||
reinterpret_cast<unsigned char *>(data.data()), data.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,9 @@ namespace WindowEffects
|
||||
{
|
||||
enum Effect {
|
||||
Slide = 1,
|
||||
WindowPreview = 2
|
||||
WindowPreview = 2,
|
||||
PresentWindows = 3,
|
||||
PresentWindowsGroup = 4
|
||||
};
|
||||
|
||||
/**
|
||||
@ -90,6 +92,25 @@ namespace WindowEffects
|
||||
* @since 4.4
|
||||
*/
|
||||
PLASMA_EXPORT void showWindowThumbnails(WId parent, const QList<WId> &windows = QList<WId>(), const QList<QRect> &rects = QList<QRect>());
|
||||
|
||||
/**
|
||||
* Activate the Present Windows effect for the given groups of windows.
|
||||
*
|
||||
* @param controler The window which is the controler of this effect. The property
|
||||
* will be set on this window. It will be removed by the effect
|
||||
* @param ids all the windows which should be presented.
|
||||
* @since 4.4
|
||||
*/
|
||||
PLASMA_EXPORT void presentWindows(WId controler, const QList<WId> &ids);
|
||||
/**
|
||||
* Activate the Present Windows effect for the windows of the given desktop.
|
||||
*
|
||||
* @param controler The window which is the controler of this effect. The property
|
||||
* will be set on this window. It will be removed by the effect
|
||||
* @param desktop The desktop whose windows should be presented. -1 for all desktops
|
||||
* @since 4.4
|
||||
*/
|
||||
PLASMA_EXPORT void presentWindows(WId controler, int desktop = -1);
|
||||
}
|
||||
|
||||
} // namespace Plasma
|
||||
|
Loading…
Reference in New Issue
Block a user