mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-12 12:58:16 +03:00
fix #96, fix right click for systray
This commit is contained in:
parent
444c12f1c5
commit
5a390e95b3
@ -551,23 +551,31 @@ void DockView::mousePressEvent(QMouseEvent *event)
|
||||
//qDebug() << "3...";
|
||||
//FIXME: very inefficient appletAt() implementation
|
||||
Plasma::Applet *applet = 0;
|
||||
bool inSystray = false;
|
||||
|
||||
foreach (Plasma::Applet *appletTemp, containment()->applets()) {
|
||||
PlasmaQuick::AppletQuickItem *ai = appletTemp->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
|
||||
if (ai && ai->isVisible() && ai->contains(ai->mapFromItem(contentItem(), event->pos()))) {
|
||||
applet = ai->applet();
|
||||
KPluginMetaData meta = applet->kPackage().metadata();
|
||||
|
||||
//Try to find applets inside a secondary containment e.g. systray
|
||||
if (applet->isContainment()) {
|
||||
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(applet);
|
||||
//Try to find applets inside a systray
|
||||
if (meta.pluginId() == "org.kde.plasma.systemtray") {
|
||||
auto systrayId = applet->config().readEntry("SystrayContainmentId");
|
||||
|
||||
foreach (Plasma::Applet *appletCont, cont->applets()) {
|
||||
PlasmaQuick::AppletQuickItem *ai2 = appletCont->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
applet = 0;
|
||||
inSystray = true;
|
||||
Plasma::Containment *cont = containmentById(systrayId.toInt());
|
||||
|
||||
if (ai2 && ai2->isVisible() && ai2->contains(ai2->mapFromItem(contentItem(), event->pos()))) {
|
||||
applet = ai2->applet();
|
||||
break;
|
||||
if (cont) {
|
||||
foreach (Plasma::Applet *appletCont, cont->applets()) {
|
||||
PlasmaQuick::AppletQuickItem *ai2 = appletCont->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
|
||||
if (ai2 && ai2->isVisible() && ai2->contains(ai2->mapFromItem(contentItem(), event->pos()))) {
|
||||
applet = ai2->applet();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -578,7 +586,7 @@ void DockView::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
if (!applet) {
|
||||
if (!applet && !inSystray) {
|
||||
applet = containment();
|
||||
}
|
||||
|
||||
@ -785,6 +793,18 @@ void DockView::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Plasma::Containment *DockView::containmentById(int id)
|
||||
{
|
||||
foreach (auto containment, corona()->containments()) {
|
||||
if (id == containment->id()) {
|
||||
return containment;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//!END overriding context menus behavior
|
||||
|
||||
}
|
||||
|
@ -137,6 +137,8 @@ private:
|
||||
void updateFormFactor();
|
||||
|
||||
private:
|
||||
Plasma::Containment *containmentById(int id);
|
||||
|
||||
int m_maxLength{INT_MAX};
|
||||
int m_maxThickness{24};
|
||||
int m_shadow{0};
|
||||
|
Loading…
x
Reference in New Issue
Block a user