new effect: highlightWindows, uses _KDE_WINDOW_HIGHLIGHT atom

svn path=/trunk/KDE/kdelibs/; revision=1042972
This commit is contained in:
Marco Martin 2009-10-31 10:58:06 +00:00
parent 9ceef1a821
commit f9672ff394
2 changed files with 53 additions and 6 deletions

View File

@ -56,6 +56,9 @@ bool isEffectAvailable(Effect effect)
case PresentWindowsGroup: case PresentWindowsGroup:
effectName = "_KDE_PRESENT_WINDOWS_GROUP"; effectName = "_KDE_PRESENT_WINDOWS_GROUP";
break; break;
case HighlightWindows:
effectName = "_KDE_WINDOW_HIGHLIGHT";
break;
default: default:
return false; return false;
} }
@ -242,6 +245,38 @@ void presentWindows(WId controler, int desktop)
#endif #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
}
} }
} }

View File

@ -39,7 +39,8 @@ namespace WindowEffects
Slide = 1, Slide = 1,
WindowPreview = 2, WindowPreview = 2,
PresentWindows = 3, 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. * 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 * will be set on this window. It will be removed by the effect
* @param ids all the windows which should be presented. * @param ids all the windows which should be presented.
* @since 4.4 * @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. * 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 * 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 * @param desktop The desktop whose windows should be presented. -1 for all desktops
* @since 4.4 * @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 } // namespace Plasma