Applet drag & drop works again on a dashboard.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=808449
This commit is contained in:
parent
26dc704a5a
commit
3bce3a18b8
@ -302,6 +302,19 @@ void AppletHandle::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
bool AppletHandle::goTopLevel(const QPoint & pos) {
|
||||
Plasma::View *v = Plasma::View::topLevelViewAt(pos);
|
||||
if (v) {
|
||||
Containment *c = v->containment();
|
||||
|
||||
if (c && c != m_containment) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
//kDebug() << "button pressed:" << m_pressedButton << ", fade pending?" << m_pendingFade;
|
||||
@ -366,16 +379,13 @@ void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
|
||||
//find out if we were dropped on a panel or something
|
||||
Plasma::View *v = Plasma::View::topLevelViewAt(m_screenRect.center());
|
||||
if (v) {
|
||||
Containment *c = v->containment();
|
||||
//We decide where we've been dropped by looking at the center of the
|
||||
//applet.
|
||||
QPoint pos = v->mapFromGlobal(m_screenRect.center());
|
||||
|
||||
//XXX the dashboard view won't give us a containment. if it did,
|
||||
//this could break shit.
|
||||
if (c && c != m_containment) {
|
||||
if (goTopLevel(m_screenRect.center())) {
|
||||
Plasma::View *v = Plasma::View::topLevelViewAt(m_screenRect.center());
|
||||
if (v) {
|
||||
Containment *c = v->containment();
|
||||
//We decide where we've been dropped by looking at the center of the
|
||||
//applet.
|
||||
QPoint pos = v->mapFromGlobal(m_screenRect.center());
|
||||
//we actually have been dropped on another containment, so
|
||||
//move there: we have a screenpos, we need a scenepos
|
||||
//FIXME how reliable is this transform?
|
||||
@ -409,15 +419,6 @@ qreal _k_angleForPoints(const QPointF ¢er, const QPointF &pt1, const QPointF
|
||||
return beta - alpha;
|
||||
}
|
||||
|
||||
bool AppletHandle::goTopLevel(const QPoint & pos) {
|
||||
Plasma::View *v = Plasma::View::topLevelViewAt(pos);
|
||||
if (v != m_applet->containment()->view()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
static const qreal snapAngle = M_PI_2 /* $i 3.14159 / 2.0 */;
|
||||
|
Loading…
x
Reference in New Issue
Block a user