diff --git a/popupapplet.cpp b/popupapplet.cpp index 59a20319c..d714b1abb 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -260,6 +260,24 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints) } } + //If the popup is more than two times larger than the applet + //center it (or taller in case of vertical panels + if (f == Plasma::Vertical) { + if ((gWidget && gWidget->size().height() > q->size().height() *2 ) || + (qWidget && qWidget->size().height() > q->size().height() *2 )) { + popupAlignment = Qt::AlignCenter; + } else { + popupAlignment = Qt::AlignLeft; + } + } else { + if ((gWidget && gWidget->size().width() > q->size().width() *2 ) || + (qWidget && qWidget->size().width() > q->size().width() *2 )) { + popupAlignment = Qt::AlignCenter; + } else { + popupAlignment = Qt::AlignLeft; + } + } + //Applet on desktop if ((!parentApplet || parentApplet->isContainment() ) && icon && (!icon->svg().isEmpty() || !icon->icon().isNull()) && ((f != Plasma::Vertical && f != Plasma::Horizontal) || ((f == Plasma::Vertical && parentSize.width() >= minimum.width()) ||