From 9214b478ca3d69225e57072ab3a6dfd3191cda2a Mon Sep 17 00:00:00 2001 From: reionwong Date: Tue, 5 Oct 2021 05:39:56 +0800 Subject: [PATCH] Make polkit dialog movable --- notificationd/qml/NotificationPopup.qml | 8 +++++--- notificationd/qml/main.qml | 3 +++ polkit-agent/main.qml | 11 +++++++++++ session/main.cpp | 2 +- session/processmanager.cpp | 21 ++++----------------- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/notificationd/qml/NotificationPopup.qml b/notificationd/qml/NotificationPopup.qml index 0b43ff2..ad7dfa3 100644 --- a/notificationd/qml/NotificationPopup.qml +++ b/notificationd/qml/NotificationPopup.qml @@ -139,13 +139,14 @@ Window { Rectangle { property color hoveredColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.backgroundColor, 2) - : Qt.darker(FishUI.Theme.backgroundColor, 1.2) + : Qt.darker(FishUI.Theme.backgroundColor, 1.2) property color pressedColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.backgroundColor, 1.5) - : Qt.darker(FishUI.Theme.backgroundColor, 1.3) + : Qt.darker(FishUI.Theme.backgroundColor, 1.3) z: -1 anchors.fill: parent - color: _closeBtnArea.pressed ? pressedColor : _closeBtnArea.containsMouse ? hoveredColor : "transparent" + color: "transparent" + // color: _closeBtnArea.pressed ? pressedColor : _closeBtnArea.containsMouse ? hoveredColor : "transparent" radius: height / 2 } @@ -153,6 +154,7 @@ Window { id: _closeBtnArea anchors.fill: parent hoverEnabled: true + onEntered: timer.stop() onClicked: { notificationsModel.close(model.notificationId) } diff --git a/notificationd/qml/main.qml b/notificationd/qml/main.qml index 03d862a..d048894 100644 --- a/notificationd/qml/main.qml +++ b/notificationd/qml/main.qml @@ -80,6 +80,9 @@ Item { popup.y = y y += popup.height + (popup.height > 0 ? popupSpacing : 0) + // Horizontal + popup.x = screenRect.x + (screenRect.width - popup.width) / 2 + // don't let notifications take more than popupMaximumScreenFill of the screen var visible = true if (i > 0) { // however always show at least one popup diff --git a/polkit-agent/main.qml b/polkit-agent/main.qml index 4832ad4..abe6dd3 100644 --- a/polkit-agent/main.qml +++ b/polkit-agent/main.qml @@ -16,6 +16,17 @@ Item { color: FishUI.Theme.secondBackgroundColor } + DragHandler { + target: null + acceptedDevices: PointerDevice.GenericPointer + grabPermissions: TapHandler.CanTakeOverFromAnything + onActiveChanged: if (active) { windowHelper.startSystemMove(rootWindow) } + } + + FishUI.WindowHelper { + id: windowHelper + } + FishUI.WindowShadow { view: rootWindow geometry: Qt.rect(root.x, root.y, root.width, root.height) diff --git a/session/main.cpp b/session/main.cpp index 55f87eb..7823ab6 100644 --- a/session/main.cpp +++ b/session/main.cpp @@ -22,7 +22,7 @@ int main(int argc, char *argv[]) { - putenv((char *)"SESSION_MANAGER="); + // putenv((char *)"SESSION_MANAGER="); // force xcb QPA plugin as session manager server is very X11 specific. qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("xcb")); diff --git a/session/processmanager.cpp b/session/processmanager.cpp index bc449e9..3bf1b55 100644 --- a/session/processmanager.cpp +++ b/session/processmanager.cpp @@ -75,26 +75,13 @@ void ProcessManager::logout() QDBusConnection::sessionBus()); if (kwinIface.isValid()) { - // kwinIface.call("aboutToSaveSession", "cutefish"); + kwinIface.call("aboutToSaveSession", "cutefish"); kwinIface.call("setState", uint(2)); // Quit } - QMapIterator i(m_systemProcess); - - while (i.hasNext()) { - i.next(); - QProcess *p = i.value(); - p->terminate(); - } - i.toFront(); - - while (i.hasNext()) { - i.next(); - QProcess *p = i.value(); - if (p->state() != QProcess::NotRunning && !p->waitForFinished(2000)) { - p->kill(); - } - } + QProcess s; + s.start("killall", QStringList() << "kglobalaccel5"); + s.waitForFinished(-1); QDBusInterface iface("org.freedesktop.login1", "/org/freedesktop/login1/session/self",