plasma-framework/windoweffects.cpp
Marco Martin 8ecfc801de pass the offset in the api, rather that trying to do magic with
qdesktopwidget

svn path=/trunk/KDE/kdelibs/; revision=1003244
2009-07-27 21:53:36 +00:00

68 lines
1.7 KiB
C++

/*
* Copyright 2009 Marco Martin <notmart@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "windoweffects.h"
#include <QVarLengthArray>
namespace Plasma
{
namespace WindowEffects
{
void setSlidingWindow(WId id, Plasma::Location location, int offset)
{
#ifdef Q_WS_X11
Display *dpy = QX11Info::display();
Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False );
QVarLengthArray<long, 1024> data(2);
data[0] = offset;
switch (location) {
case LeftEdge:
data[1] = 0;
break;
case TopEdge:
data[1] = 1;
break;
case RightEdge:
data[1] = 2;
break;
case BottomEdge:
data[1] = 3;
default:
break;
}
if (location == Desktop || location == Floating) {
XDeleteProperty(dpy, id, atom);
} else {
XChangeProperty(dpy, id, atom, atom, 32, PropModeReplace,
reinterpret_cast<unsigned char *>(data.data()), data.size());
}
#endif
}
}
}