From 71839078e3ea2462552453373bdd9a207d3ff663 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Mon, 25 Jan 2016 12:36:05 -0600 Subject: [PATCH] pull in upstream fixes (notifications/xembedsniproxy) --- ...ace-the-popup-directly-when-it-is-di.patch | 171 ++++++++++++++++++ ...so-place-the-popup-directly-without-.patch | 50 +++++ ...rce-the-max-height-of-the-text-item-.patch | 35 ++++ 0019-Check-client-geom-exists-in-clicks.patch | 28 +++ plasma-workspace.spec | 14 +- 5 files changed, 297 insertions(+), 1 deletion(-) create mode 100644 0011-notifications-Place-the-popup-directly-when-it-is-di.patch create mode 100644 0012-notifications-Also-place-the-popup-directly-without-.patch create mode 100644 0013-notifications-Force-the-max-height-of-the-text-item-.patch create mode 100644 0019-Check-client-geom-exists-in-clicks.patch diff --git a/0011-notifications-Place-the-popup-directly-when-it-is-di.patch b/0011-notifications-Place-the-popup-directly-when-it-is-di.patch new file mode 100644 index 0000000..fadc3b3 --- /dev/null +++ b/0011-notifications-Place-the-popup-directly-when-it-is-di.patch @@ -0,0 +1,171 @@ +From c1a7d61fbab7620f9f92f25ae82e96b9bf3a589c Mon Sep 17 00:00:00 2001 +From: Martin Klapetek +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 m_popupsOnScreen; + QList m_availablePopups; +-- +2.5.0 + diff --git a/0012-notifications-Also-place-the-popup-directly-without-.patch b/0012-notifications-Also-place-the-popup-directly-without-.patch new file mode 100644 index 0000000..31319b1 --- /dev/null +++ b/0012-notifications-Also-place-the-popup-directly-without-.patch @@ -0,0 +1,50 @@ +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 + diff --git a/0013-notifications-Force-the-max-height-of-the-text-item-.patch b/0013-notifications-Force-the-max-height-of-the-text-item-.patch new file mode 100644 index 0000000..8403393 --- /dev/null +++ b/0013-notifications-Force-the-max-height-of-the-text-item-.patch @@ -0,0 +1,35 @@ +From 4f05c553f07eee25cda8d92ee6a7c298bb5f9860 Mon Sep 17 00:00:00 2001 +From: Martin Klapetek +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 + diff --git a/0019-Check-client-geom-exists-in-clicks.patch b/0019-Check-client-geom-exists-in-clicks.patch new file mode 100644 index 0000000..6ea02be --- /dev/null +++ b/0019-Check-client-geom-exists-in-clicks.patch @@ -0,0 +1,28 @@ +From 988a7bef7e84a4a2fc6a2f6ec6145e093dfb84f8 Mon Sep 17 00:00:00 2001 +From: David Edmundson +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 + clientGeom(xcb_get_geometry_reply(c, cookieSize, Q_NULLPTR)); + ++ if (!clientGeom) { ++ return; ++ } ++ + auto cookie = xcb_query_pointer(c, m_windowId); + QScopedPointer + pointer(xcb_query_pointer_reply(c, cookie, Q_NULLPTR)); +-- +2.5.0 + diff --git a/plasma-workspace.spec b/plasma-workspace.spec index d44600f..a47599d 100644 --- a/plasma-workspace.spec +++ b/plasma-workspace.spec @@ -7,7 +7,7 @@ Name: plasma-workspace Summary: Plasma workspace, applications and applets Version: 5.5.3 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ URL: https://projects.kde.org/plasma-workspace @@ -45,6 +45,11 @@ Patch102: 0002-notifications-Replace-the-mainItem-s-Layout.max-minW.patch Patch103: 0003-notifications-Ensure-the-applet-gets-correct-screen-.patch Patch104: 0004-Device-Notifier-Improve-legibility-of-device-status-.patch Patch105: 0005-Check-for-null-geometry-in-client-window.patch +Patch111: 0011-notifications-Place-the-popup-directly-when-it-is-di.patch +Patch112: 0012-notifications-Also-place-the-popup-directly-without-.patch +Patch113: 0013-notifications-Force-the-max-height-of-the-text-item-.patch +Patch119: 0019-Check-client-geom-exists-in-clicks.patch + ## master branch Patches @@ -351,6 +356,10 @@ Requires: qt5-qttools %patch103 -p1 -b .0003 %patch104 -p1 -b .0004 %patch105 -p1 -b .0005 +%patch111 -p1 -b .0011 +%patch112 -p1 -b .0012 +%patch113 -p1 -b .0013 +%patch119 -p1 -b .0019 %patch1 -p1 -b .installdbgsymbols %patch10 -p1 -b .konsole-in-contextmenu @@ -574,6 +583,9 @@ fi %changelog +* Mon Jan 25 2016 Rex Dieter 5.5.3-6 +- pull in upstream fixes (notifications/xembedsniproxy) + * Mon Jan 11 2016 Rex Dieter 5.5.3-5 - -wayland: Requires: qt5-qtools (for qdbus-qt5)