new effect: highlightWindows, uses _KDE_WINDOW_HIGHLIGHT atom
svn path=/trunk/KDE/kdelibs/; revision=1042972
This commit is contained in:
parent
9ceef1a821
commit
f9672ff394
@ -56,6 +56,9 @@ bool isEffectAvailable(Effect effect)
|
||||
case PresentWindowsGroup:
|
||||
effectName = "_KDE_PRESENT_WINDOWS_GROUP";
|
||||
break;
|
||||
case HighlightWindows:
|
||||
effectName = "_KDE_WINDOW_HIGHLIGHT";
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -242,6 +245,38 @@ void presentWindows(WId controler, int desktop)
|
||||
#endif
|
||||
}
|
||||
|
||||
void highlightWindows(WId controller, const QList<WId> &ids)
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
const int numWindows = ids.count();
|
||||
Display *dpy = QX11Info::display();
|
||||
Atom atom = XInternAtom(dpy, "_KDE_WINDOW_HIGHLIGHT", False);
|
||||
|
||||
if (numWindows == 0) {
|
||||
Atom atom = XInternAtom(dpy, "_KDE_WINDOW_HIGHLIGHT", False);
|
||||
XDeleteProperty(dpy, controller, atom);
|
||||
}
|
||||
|
||||
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()) {
|
||||
XChangeProperty(dpy, controller, atom, atom, 32, PropModeReplace,
|
||||
reinterpret_cast<unsigned char *>(data.data()), data.size());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ namespace WindowEffects
|
||||
Slide = 1,
|
||||
WindowPreview = 2,
|
||||
PresentWindows = 3,
|
||||
PresentWindowsGroup = 4
|
||||
PresentWindowsGroup = 4,
|
||||
HighlightWindows = 5
|
||||
};
|
||||
|
||||
/**
|
||||
@ -96,21 +97,32 @@ namespace WindowEffects
|
||||
/**
|
||||
* Activate the Present Windows effect for the given groups of windows.
|
||||
*
|
||||
* @param controler The window which is the controler of this effect. The property
|
||||
* @param controller The window which is the controller 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);
|
||||
/**
|
||||
PLASMA_EXPORT void presentWindows(WId controller, 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
|
||||
* @param controller The window which is the controller 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);
|
||||
PLASMA_EXPORT void presentWindows(WId controller, int desktop = -1);
|
||||
|
||||
/**
|
||||
* Highlight the selected windos, making all the others translucent
|
||||
*
|
||||
* @param controller The window which is the controller 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 highlighted.
|
||||
* @since 4.4
|
||||
*/
|
||||
PLASMA_EXPORT void highlightWindows(WId controller, const QList<WId> &ids);
|
||||
}
|
||||
|
||||
} // namespace Plasma
|
||||
|
Loading…
Reference in New Issue
Block a user