From 7079e8c20ac127290b25961b420f634f98a9f5b1 Mon Sep 17 00:00:00 2001 From: Martin Klapetek Date: Wed, 13 Jan 2016 14:31:53 -0500 Subject: [PATCH 12/20] [notifications] Also place the popup directly without animation if y == 0 For some reason I have not yet fully identified, the notification popup can get its y coord reset to 0 on resizing. This is a workaround but fixes an annoying problem. --- applets/notifications/plugin/notificationshelper.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/applets/notifications/plugin/notificationshelper.cpp b/applets/notifications/plugin/notificationshelper.cpp index a6c0efc..d1434b0 100644 --- a/applets/notifications/plugin/notificationshelper.cpp +++ b/applets/notifications/plugin/notificationshelper.cpp @@ -300,19 +300,23 @@ void NotificationsHelper::repositionPopups() || m_popupLocation == NotificationsHelper::TopCenter || m_popupLocation == NotificationsHelper::TopRight) { - if (m_popupsOnScreen[i]->isVisible() && m_popupsOnScreen[i]->property("initialPositionSet").toBool() == true) { + int posY = m_plasmoidScreen.top() + cumulativeHeight; + + if (m_popupsOnScreen[i]->isVisible() && m_popupsOnScreen[i]->property("initialPositionSet").toBool() == true && m_popupsOnScreen[i]->y() != 0) { //if it's visible, go through setProperty which animates it - m_popupsOnScreen[i]->setProperty("y", m_plasmoidScreen.top() + cumulativeHeight); + m_popupsOnScreen[i]->setProperty("y", posY); } else { // ...otherwise just set it directly - m_popupsOnScreen[i]->setY(m_plasmoidScreen.top() + cumulativeHeight); + m_popupsOnScreen[i]->setY(posY); m_popupsOnScreen[i]->setProperty("initialPositionSet", true); } } else { - if (m_popupsOnScreen[i]->isVisible() && m_popupsOnScreen[i]->property("initialPositionSet").toBool() == true) { - m_popupsOnScreen[i]->setProperty("y", m_plasmoidScreen.bottom() - cumulativeHeight - m_popupsOnScreen[i]->contentItem()->height()); + int posY = m_plasmoidScreen.bottom() - cumulativeHeight - m_popupsOnScreen[i]->contentItem()->height(); + + if (m_popupsOnScreen[i]->isVisible() && m_popupsOnScreen[i]->property("initialPositionSet").toBool() == true && m_popupsOnScreen[i]->y() != 0) { + m_popupsOnScreen[i]->setProperty("y", posY); } else { - m_popupsOnScreen[i]->setY(m_plasmoidScreen.bottom() - cumulativeHeight - m_popupsOnScreen[i]->contentItem()->height()); + m_popupsOnScreen[i]->setY(posY); m_popupsOnScreen[i]->setProperty("initialPositionSet", true); } } -- 2.5.0