parent
8890dfac0b
commit
218c4d9373
@ -1,171 +0,0 @@
|
||||
From c1a7d61fbab7620f9f92f25ae82e96b9bf3a589c Mon Sep 17 00:00:00 2001
|
||||
From: Martin Klapetek <mklapetek@kde.org>
|
||||
Date: Wed, 13 Jan 2016 14:27:50 -0500
|
||||
Subject: [PATCH 11/20] [notifications] Place the popup directly when it is
|
||||
displayed
|
||||
|
||||
Now with the geometry being correct right after the popup is
|
||||
being displayed, it can be placed directly to its exact intended
|
||||
position (compared to sliding from default position because the
|
||||
geometry was not known).
|
||||
|
||||
This should fix any issues left with the popups flying across
|
||||
the screen and removes tons of code as a bonus.
|
||||
|
||||
REVIEW: 126668
|
||||
---
|
||||
.../notifications/plugin/notificationshelper.cpp | 72 +++-------------------
|
||||
applets/notifications/plugin/notificationshelper.h | 2 -
|
||||
2 files changed, 10 insertions(+), 64 deletions(-)
|
||||
|
||||
diff --git a/applets/notifications/plugin/notificationshelper.cpp b/applets/notifications/plugin/notificationshelper.cpp
|
||||
index dbc30d6..a6c0efc 100644
|
||||
--- a/applets/notifications/plugin/notificationshelper.cpp
|
||||
+++ b/applets/notifications/plugin/notificationshelper.cpp
|
||||
@@ -55,13 +55,6 @@ void NotificationsHelper::setPopupLocation(PositionOnScreen popupLocation)
|
||||
emit popupLocationChanged();
|
||||
|
||||
repositionPopups();
|
||||
-
|
||||
- // The visible popups are corrected in repositionPopups
|
||||
- // but those that are not on screen need to be corrected
|
||||
- // as well, otherwise they will fly from the old popup location
|
||||
- Q_FOREACH (QQuickWindow *popup, m_availablePopups) {
|
||||
- setDefaultPopupPosition(popup);
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +62,6 @@ void NotificationsHelper::setPlasmoidScreenGeometry(const QRect &plasmoidScreenG
|
||||
{
|
||||
m_plasmoidScreen = plasmoidScreenGeometry;
|
||||
repositionPopups();
|
||||
- Q_FOREACH (QQuickWindow *popup, m_availablePopups) {
|
||||
- setDefaultPopupPosition(popup);
|
||||
- }
|
||||
}
|
||||
|
||||
void NotificationsHelper::addNotificationPopup(QObject *win)
|
||||
@@ -85,50 +75,10 @@ void NotificationsHelper::addNotificationPopup(QObject *win)
|
||||
connect(win, SIGNAL(notificationTimeout()),
|
||||
this, SLOT(onPopupClosed()));
|
||||
|
||||
- // The popup actual height will get changed after it has been filled
|
||||
- // with data, but we set it initially to small value so it's not too
|
||||
- // big for eg. one line notifications
|
||||
- popup->setHeight(1);
|
||||
- setDefaultPopupPosition(popup);
|
||||
-
|
||||
connect(popup, &QWindow::heightChanged, this, &NotificationsHelper::repositionPopups, Qt::UniqueConnection);
|
||||
- connect(popup, &QWindow::widthChanged, this, &NotificationsHelper::repositionPopups, Qt::UniqueConnection);
|
||||
connect(popup, &QWindow::visibleChanged, this, &NotificationsHelper::onPopupShown, Qt::UniqueConnection);
|
||||
-}
|
||||
-
|
||||
-void NotificationsHelper::setDefaultPopupPosition(QQuickWindow *popup)
|
||||
-{
|
||||
- m_mutex->lockForWrite();
|
||||
- if (m_popupLocation == NotificationsHelper::TopLeft
|
||||
- || m_popupLocation == NotificationsHelper::TopCenter
|
||||
- || m_popupLocation == NotificationsHelper::TopRight) {
|
||||
|
||||
- popup->setY(m_plasmoidScreen.y() + m_offset);
|
||||
- } else {
|
||||
- popup->setY(m_plasmoidScreen.y() + m_plasmoidScreen.height());
|
||||
- }
|
||||
-
|
||||
- switch (m_popupLocation) {
|
||||
- case TopRight:
|
||||
- case BottomRight:
|
||||
- popup->setX(m_plasmoidScreen.right() - popup->contentItem()->width() - m_offset);
|
||||
- break;
|
||||
- case TopCenter:
|
||||
- case BottomCenter:
|
||||
- popup->setX(m_plasmoidScreen.x() + (m_plasmoidScreen.width() / 2) - (popup->contentItem()->width() / 2));
|
||||
- break;
|
||||
- case TopLeft:
|
||||
- case BottomLeft:
|
||||
- popup->setX(m_plasmoidScreen.left() + m_offset);
|
||||
- break;
|
||||
- case Left:
|
||||
- case Center:
|
||||
- case Right:
|
||||
- // Fall-through to make the compiler happy
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- m_mutex->unlock();
|
||||
+ popup->setProperty("initialPositionSet", false);
|
||||
}
|
||||
|
||||
void NotificationsHelper::onPopupShown()
|
||||
@@ -195,14 +145,11 @@ void NotificationsHelper::processShow()
|
||||
// Set the source name directly on the popup object too
|
||||
// to avoid looking up the notificationProperties map as above
|
||||
popup->setProperty("sourceName", sourceName);
|
||||
-
|
||||
- // Set the height to random small number so that we actually receive
|
||||
- // the signal connected below
|
||||
- popup->setHeight(1);
|
||||
}
|
||||
|
||||
// Populate the popup with data, this is the component's own QML method
|
||||
QMetaObject::invokeMethod(popup, "populatePopup", Qt::DirectConnection, Q_ARG(QVariant, notificationData));
|
||||
+
|
||||
QTimer::singleShot(300, popup, &QWindow::show);
|
||||
|
||||
if (!m_dispatchTimer->isActive()) {
|
||||
@@ -228,11 +175,10 @@ void NotificationsHelper::processHide()
|
||||
m_mutex->unlock();
|
||||
|
||||
popup->hide();
|
||||
- // Shrink the popup again as notifications with lots of text make the popup
|
||||
- // huge but setting short text won't make it smaller
|
||||
- popup->setHeight(1);
|
||||
- // Make sure it flies in from where it's supposed to
|
||||
- setDefaultPopupPosition(popup);
|
||||
+
|
||||
+ // Make sure the popup gets placed correctly
|
||||
+ // next time it's put on screen
|
||||
+ popup->setProperty("initialPositionSet", false);
|
||||
}
|
||||
|
||||
m_mutex->lockForRead();
|
||||
@@ -354,18 +300,20 @@ void NotificationsHelper::repositionPopups()
|
||||
|| m_popupLocation == NotificationsHelper::TopCenter
|
||||
|| m_popupLocation == NotificationsHelper::TopRight) {
|
||||
|
||||
- if (m_popupsOnScreen[i]->isVisible()) {
|
||||
+ if (m_popupsOnScreen[i]->isVisible() && m_popupsOnScreen[i]->property("initialPositionSet").toBool() == true) {
|
||||
//if it's visible, go through setProperty which animates it
|
||||
m_popupsOnScreen[i]->setProperty("y", m_plasmoidScreen.top() + cumulativeHeight);
|
||||
} else {
|
||||
// ...otherwise just set it directly
|
||||
m_popupsOnScreen[i]->setY(m_plasmoidScreen.top() + cumulativeHeight);
|
||||
+ m_popupsOnScreen[i]->setProperty("initialPositionSet", true);
|
||||
}
|
||||
} else {
|
||||
- if (m_popupsOnScreen[i]->isVisible()) {
|
||||
+ 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());
|
||||
} else {
|
||||
m_popupsOnScreen[i]->setY(m_plasmoidScreen.bottom() - cumulativeHeight - m_popupsOnScreen[i]->contentItem()->height());
|
||||
+ m_popupsOnScreen[i]->setProperty("initialPositionSet", true);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/applets/notifications/plugin/notificationshelper.h b/applets/notifications/plugin/notificationshelper.h
|
||||
index d5c15cc..49649c4 100644
|
||||
--- a/applets/notifications/plugin/notificationshelper.h
|
||||
+++ b/applets/notifications/plugin/notificationshelper.h
|
||||
@@ -78,8 +78,6 @@ private Q_SLOTS:
|
||||
|
||||
private:
|
||||
void repositionPopups();
|
||||
- int popupYPosition();
|
||||
- void setDefaultPopupPosition(QQuickWindow *popup);
|
||||
|
||||
QList<QQuickWindow*> m_popupsOnScreen;
|
||||
QList<QQuickWindow*> m_availablePopups;
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,50 +0,0 @@
|
||||
From 7079e8c20ac127290b25961b420f634f98a9f5b1 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Klapetek <mklapetek@kde.org>
|
||||
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
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 4f05c553f07eee25cda8d92ee6a7c298bb5f9860 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Klapetek <mklapetek@kde.org>
|
||||
Date: Wed, 13 Jan 2016 14:33:42 -0500
|
||||
Subject: [PATCH 13/20] [notifications] Force the max height of the text item
|
||||
to be 0 when no text
|
||||
|
||||
Force the whole thing to collapse if the children are invisible.
|
||||
If there is a big notification followed by a small one, the height
|
||||
of the popup does not always shrink back, so this forces it to
|
||||
height = 0 when those are invisible. -1 means "default to
|
||||
implicitHeight"
|
||||
---
|
||||
applets/notifications/package/contents/ui/NotificationItem.qml | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/applets/notifications/package/contents/ui/NotificationItem.qml b/applets/notifications/package/contents/ui/NotificationItem.qml
|
||||
index 34d611c..f03fd93 100644
|
||||
--- a/applets/notifications/package/contents/ui/NotificationItem.qml
|
||||
+++ b/applets/notifications/package/contents/ui/NotificationItem.qml
|
||||
@@ -184,6 +184,12 @@ Item {
|
||||
id: bottomPart
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
+ // Force the whole thing to collapse if the children are invisible
|
||||
+ // If there is a big notification followed by a small one, the height
|
||||
+ // of the popup does not always shrink back, so this forces it to
|
||||
+ // height=0 when those are invisible. -1 means "default to implicitHeight"
|
||||
+ Layout.maximumHeight: textItemLoader.visible || actionsColumn.visible ? -1 : 0
|
||||
+
|
||||
Loader {
|
||||
id: textItemLoader
|
||||
Layout.fillWidth: true
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 988a7bef7e84a4a2fc6a2f6ec6145e093dfb84f8 Mon Sep 17 00:00:00 2001
|
||||
From: David Edmundson <kde@davidedmundson.co.uk>
|
||||
Date: Thu, 21 Jan 2016 16:38:20 +0000
|
||||
Subject: [PATCH 19/20] Check client geom exists in clicks
|
||||
|
||||
REVIEW:
|
||||
---
|
||||
xembed-sni-proxy/sniproxy.cpp | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/xembed-sni-proxy/sniproxy.cpp b/xembed-sni-proxy/sniproxy.cpp
|
||||
index 9f3ef81..3827fdd 100644
|
||||
--- a/xembed-sni-proxy/sniproxy.cpp
|
||||
+++ b/xembed-sni-proxy/sniproxy.cpp
|
||||
@@ -421,6 +421,10 @@ void SNIProxy::sendClick(uint8_t mouseButton, int x, int y)
|
||||
QScopedPointer<xcb_get_geometry_reply_t, QScopedPointerPodDeleter>
|
||||
clientGeom(xcb_get_geometry_reply(c, cookieSize, Q_NULLPTR));
|
||||
|
||||
+ if (!clientGeom) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
auto cookie = xcb_query_pointer(c, m_windowId);
|
||||
QScopedPointer<xcb_query_pointer_reply_t, QScopedPointerPodDeleter>
|
||||
pointer(xcb_query_pointer_reply(c, cookie, Q_NULLPTR));
|
||||
--
|
||||
2.5.0
|
||||
|
Loading…
Reference in new issue