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;
|
Location location = Desktop;
|
||||||
|
int offset = 0;
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case Down:
|
case Down:
|
||||||
location = BottomEdge;
|
location = BottomEdge;
|
||||||
|
offset = geometry().bottom();
|
||||||
break;
|
break;
|
||||||
case Right:
|
case Right:
|
||||||
location = RightEdge;
|
location = RightEdge;
|
||||||
|
offset = geometry().left();
|
||||||
break;
|
break;
|
||||||
case Left:
|
case Left:
|
||||||
location = LeftEdge;
|
location = LeftEdge;
|
||||||
|
offset = geometry().right();
|
||||||
break;
|
break;
|
||||||
case Up:
|
case Up:
|
||||||
location = TopEdge;
|
location = TopEdge;
|
||||||
|
offset = geometry().top();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Plasma::WindowEffects::setSlidingWindow(winId(), location);
|
Plasma::WindowEffects::setSlidingWindow(winId(), location, offset);
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
@ -606,25 +611,30 @@ void Dialog::animatedShow(Plasma::Direction direction)
|
|||||||
|
|
||||||
//copied to not add new api
|
//copied to not add new api
|
||||||
Location location = Desktop;
|
Location location = Desktop;
|
||||||
|
int offset = 0;
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case Up:
|
case Up:
|
||||||
location = BottomEdge;
|
location = BottomEdge;
|
||||||
|
offset = geometry().bottom();
|
||||||
break;
|
break;
|
||||||
case Left:
|
case Left:
|
||||||
location = RightEdge;
|
location = RightEdge;
|
||||||
|
offset = geometry().left();
|
||||||
break;
|
break;
|
||||||
case Right:
|
case Right:
|
||||||
location = LeftEdge;
|
location = LeftEdge;
|
||||||
|
offset = geometry().right();
|
||||||
break;
|
break;
|
||||||
case Down:
|
case Down:
|
||||||
location = TopEdge;
|
location = TopEdge;
|
||||||
|
offset = geometry().top();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Plasma::WindowEffects::setSlidingWindow(winId(), location);
|
Plasma::WindowEffects::setSlidingWindow(winId(), location, offset);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
|
@ -28,42 +28,26 @@ namespace Plasma
|
|||||||
namespace WindowEffects
|
namespace WindowEffects
|
||||||
{
|
{
|
||||||
|
|
||||||
void setSlidingWindow(WId id, Plasma::Location location)
|
void setSlidingWindow(WId id, Plasma::Location location, int offset)
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
Display *dpy = QX11Info::display();
|
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 );
|
Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False );
|
||||||
QVarLengthArray<long, 1024> data(2);
|
QVarLengthArray<long, 1024> data(2);
|
||||||
|
|
||||||
|
data[0] = offset;
|
||||||
|
|
||||||
switch (location) {
|
switch (location) {
|
||||||
case LeftEdge:
|
case LeftEdge:
|
||||||
data[0] = avail.left();
|
|
||||||
data[1] = 0;
|
data[1] = 0;
|
||||||
break;
|
break;
|
||||||
case TopEdge:
|
case TopEdge:
|
||||||
data[0] = avail.top();
|
|
||||||
data[1] = 1;
|
data[1] = 1;
|
||||||
break;
|
break;
|
||||||
case RightEdge:
|
case RightEdge:
|
||||||
data[0] = avail.right();
|
|
||||||
data[1] = 2;
|
data[1] = 2;
|
||||||
break;
|
break;
|
||||||
case BottomEdge:
|
case BottomEdge:
|
||||||
data[0] = avail.bottom();
|
|
||||||
data[1] = 3;
|
data[1] = 3;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -48,9 +48,10 @@ namespace WindowEffects
|
|||||||
* @arg id of the window on which we want to apply the effect
|
* @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.
|
* @arg location edge of the screen from which we want the slifing effect.
|
||||||
* Desktop and FLoating won't have effect.
|
* Desktop and FLoating won't have effect.
|
||||||
|
* @arg offset distance in pixels from the screen edge defined by location
|
||||||
* @since 4.4
|
* @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
|
} // namespace Plasma
|
||||||
|
Loading…
x
Reference in New Issue
Block a user