pass the offset in the api, rather that trying to do magic with
qdesktopwidget svn path=/trunk/KDE/kdelibs/; revision=1003244
This commit is contained in:
parent
85cb69d28f
commit
8ecfc801de
14
dialog.cpp
14
dialog.cpp
@ -574,25 +574,30 @@ void Dialog::animatedHide(Plasma::Direction direction)
|
||||
}
|
||||
|
||||
Location location = Desktop;
|
||||
int offset = 0;
|
||||
|
||||
switch (direction) {
|
||||
case Down:
|
||||
location = BottomEdge;
|
||||
offset = geometry().bottom();
|
||||
break;
|
||||
case Right:
|
||||
location = RightEdge;
|
||||
offset = geometry().left();
|
||||
break;
|
||||
case Left:
|
||||
location = LeftEdge;
|
||||
offset = geometry().right();
|
||||
break;
|
||||
case Up:
|
||||
location = TopEdge;
|
||||
offset = geometry().top();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Plasma::WindowEffects::setSlidingWindow(winId(), location);
|
||||
Plasma::WindowEffects::setSlidingWindow(winId(), location, offset);
|
||||
|
||||
hide();
|
||||
}
|
||||
@ -606,25 +611,30 @@ void Dialog::animatedShow(Plasma::Direction direction)
|
||||
|
||||
//copied to not add new api
|
||||
Location location = Desktop;
|
||||
int offset = 0;
|
||||
|
||||
switch (direction) {
|
||||
case Up:
|
||||
location = BottomEdge;
|
||||
offset = geometry().bottom();
|
||||
break;
|
||||
case Left:
|
||||
location = RightEdge;
|
||||
offset = geometry().left();
|
||||
break;
|
||||
case Right:
|
||||
location = LeftEdge;
|
||||
offset = geometry().right();
|
||||
break;
|
||||
case Down:
|
||||
location = TopEdge;
|
||||
offset = geometry().top();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Plasma::WindowEffects::setSlidingWindow(winId(), location);
|
||||
Plasma::WindowEffects::setSlidingWindow(winId(), location, offset);
|
||||
|
||||
show();
|
||||
|
||||
|
@ -28,42 +28,26 @@ namespace Plasma
|
||||
namespace WindowEffects
|
||||
{
|
||||
|
||||
void setSlidingWindow(WId id, Plasma::Location location)
|
||||
void setSlidingWindow(WId id, Plasma::Location location, int offset)
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
Display *dpy = QX11Info::display();
|
||||
//set again the atom, the location could have changed
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
|
||||
Window dummy;
|
||||
int x;
|
||||
int y;
|
||||
uint width;
|
||||
uint height;
|
||||
uint bw;
|
||||
uint d;
|
||||
XGetGeometry(dpy, id, &dummy, &x, &y, &width, &height, &bw, &d);
|
||||
|
||||
QRect avail = desktop->availableGeometry(QPoint(x, y));//desktop->screenNumber(pos()));
|
||||
|
||||
Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False );
|
||||
QVarLengthArray<long, 1024> data(2);
|
||||
|
||||
data[0] = offset;
|
||||
|
||||
switch (location) {
|
||||
case LeftEdge:
|
||||
data[0] = avail.left();
|
||||
data[1] = 0;
|
||||
break;
|
||||
case TopEdge:
|
||||
data[0] = avail.top();
|
||||
data[1] = 1;
|
||||
break;
|
||||
case RightEdge:
|
||||
data[0] = avail.right();
|
||||
data[1] = 2;
|
||||
break;
|
||||
case BottomEdge:
|
||||
data[0] = avail.bottom();
|
||||
data[1] = 3;
|
||||
default:
|
||||
break;
|
||||
|
@ -48,9 +48,10 @@ namespace WindowEffects
|
||||
* @arg id of the window on which we want to apply the effect
|
||||
* @arg location edge of the screen from which we want the slifing effect.
|
||||
* Desktop and FLoating won't have effect.
|
||||
* @arg offset distance in pixels from the screen edge defined by location
|
||||
* @since 4.4
|
||||
*/
|
||||
PLASMA_EXPORT void setSlidingWindow(WId id, Plasma::Location location);
|
||||
PLASMA_EXPORT void setSlidingWindow(WId id, Plasma::Location location, int offset);
|
||||
}
|
||||
|
||||
} // namespace Plasma
|
||||
|
Loading…
Reference in New Issue
Block a user