check to see which applet is under the event, defaulting to the host applet.

CCBUG:235252

svn path=/trunk/KDE/kdelibs/; revision=1124305
This commit is contained in:
Aaron J. Seigo 2010-05-08 19:10:07 +00:00
parent 32fd43651d
commit 3c80abf735

View File

@ -475,7 +475,21 @@ bool PopupApplet::eventFilter(QObject *watched, QEvent *event)
//because all the code for showing an applet's contextmenu is actually in Containment.
Containment *c = containment();
if (c) {
return c->d->showAppletContextMenu(this, static_cast<QContextMenuEvent*>(event)->globalPos());
Applet *applet = this;
Dialog *dialog = d->dialogPtr.data();
if (dialog && dialog->graphicsWidget()) {
const QPoint eventPos = static_cast<QContextMenuEvent*>(event)->pos();
QPointF pos = dialog->graphicsWidget()->mapToScene(eventPos);
int left, top, right, bottom;
dialog->getContentsMargins(&left, &top, &right, &bottom);
pos += QPointF(-left, -top);
if (Applet *actual = c->d->appletAt(pos)) {
applet = actual;
}
}
return c->d->showAppletContextMenu(applet, static_cast<QContextMenuEvent*>(event)->globalPos());
}
}