SHA256
1
0
forked from pool/kxmlgui
Hrvoje Senjan 2016-03-13 16:29:04 +00:00 committed by Git OBS Bridge
parent 8d027c7282
commit 327e5d4b8f
2 changed files with 21 additions and 118 deletions

View File

@ -1,117 +0,0 @@
From f7cbcc77722256db084d3b0ab6ce76173e959f0e Mon Sep 17 00:00:00 2001
From: Andreas Hartmetz <ahartmetz@gmail.com>
Date: Fri, 19 Feb 2016 19:37:36 +0100
Subject: [PATCH 1/1] Fix session management broken since KF5 / Qt5.
Requires Qt 5.6 branch not more than a few days old, or >= 5.6.0
when it is released.
Parts of the fix are:
- Call QGuiApplication::setFallbackSessionManagementEnabled(false)
to prevent application suicide through a mechanism that tries to
help applications without any proper session management support,
but badly interferes with applications that do implement proper
session management, such as KDE applications.
- Add back commitData[Request] handling. For some reason it was
removed during porting.
- Change the returned types of saveState() and commitData() to void.
The return values were unused.
BUG: 354724
---
src/kmainwindow.cpp | 44 +++++++++++++++++++++++++++++++++++++++++---
src/kmainwindow_p.h | 3 ++-
2 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/src/kmainwindow.cpp b/src/kmainwindow.cpp
index cae655d..c384b67 100644
--- a/src/kmainwindow.cpp
+++ b/src/kmainwindow.cpp
@@ -121,13 +121,15 @@ KMWSessionManager::KMWSessionManager()
{
connect(qApp, SIGNAL(saveStateRequest(QSessionManager&)),
this, SLOT(saveState(QSessionManager&)));
+ connect(qApp, SIGNAL(commitDataRequest(QSessionManager&)),
+ this, SLOT(commitData(QSessionManager&)));
}
KMWSessionManager::~KMWSessionManager()
{
}
-bool KMWSessionManager::saveState(QSessionManager &sm)
+void KMWSessionManager::saveState(QSessionManager &sm)
{
KConfigGui::setSessionConfig(sm.sessionId(), sm.sessionKey());
@@ -158,8 +160,42 @@ bool KMWSessionManager::saveState(QSessionManager &sm)
discard << localFilePath;
sm.setDiscardCommand(discard);
}
+}
- return true;
+void KMWSessionManager::commitData(QSessionManager &sm)
+{
+ if (!sm.allowsInteraction()) {
+ return;
+ }
+
+ /*
+ Purpose of this exercise: invoke queryClose() without actually closing the
+ windows, because
+ - queryClose() may contain session management code, so it must be invoked
+ - actually closing windows may quit the application - cf.
+ QGuiApplication::quitOnLastWindowClosed()
+ - quitting the application and thus closing the session manager connection
+ violates the X11 XSMP protocol.
+ The exact requirement of XSMP that would be broken is,
+ in the description of the client's state machine:
+
+ save-yourself-done: (changing state is forbidden)
+
+ Closing the session manager connection causes a state change.
+ Worst of all, that is a real problem with ksmserver - it will not save
+ applications that quit on their own in state save-yourself-done.
+ */
+ foreach (KMainWindow *window, KMainWindow::memberList()) {
+ if (window->testAttribute(Qt::WA_WState_Hidden)) {
+ continue;
+ }
+ QCloseEvent e;
+ QApplication::sendEvent(window, &e);
+ if (!e.isAccepted()) {
+ sm.cancel();
+ return;
+ }
+ }
}
Q_GLOBAL_STATIC(KMWSessionManager, ksm)
@@ -180,7 +216,9 @@ KMainWindow::KMainWindow(KMainWindowPrivate &dd, QWidget *parent, Qt::WindowFlag
void KMainWindowPrivate::init(KMainWindow *_q)
{
q = _q;
-
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ QGuiApplication::setFallbackSessionManagementEnabled(false);
+#endif
q->setAnimated(q->style()->styleHint(QStyle::SH_Widget_Animate, 0, q));
q->setAttribute(Qt::WA_DeleteOnClose);
diff --git a/src/kmainwindow_p.h b/src/kmainwindow_p.h
index 8204ce1..910680d 100644
--- a/src/kmainwindow_p.h
+++ b/src/kmainwindow_p.h
@@ -81,7 +81,8 @@ public:
~KMWSessionManager();
private Q_SLOTS:
- bool saveState(QSessionManager &);
+ void saveState(QSessionManager &);
+ void commitData(QSessionManager &);
};
#endif
--
2.6.2

View File

@ -1,9 +1,29 @@
-------------------------------------------------------------------
Sun Mar 6 10:03:25 UTC 2016 - hrvoje.senjan@gmail.com
- Update to 5.20.0
- Update to 5.20.0 (boo#970856)
* Use non-native Language name as fallback
* Fix session management broken since KF5 / Qt5
(kde#354724, boo#955280)
* Shortcut schemes: support globally installed schemes
* Use Qt's qHash(QKeySequence) when building against Qt 5.6+
* Shortcut schemes: fix bug where two KXMLGUIClients with the
same name overwrite each other's scheme file
* kxmlguiwindowtest: add shortcuts dialog, for testing the
shortcut schemes editor
* Shortcut schemes: improve usability by changing texts in GUI
* Shortcut schemes: improve scheme list combo
(automatic size, don't clear on unknown scheme)
* Shortcut schemes: don't prepend the guiclient name
to the filename
* Shortcut schemes: create dir before trying to save
a new shortcut scheme
* Shortcut schemes: restore layout margin, it looks
very cramped otherwise
* Fix memory leak in KXmlGui startup hook
* For more details please see:
https://www.kde.org/announcements/kde-frameworks-5.20.0.php
- Drop upstreamed fix-session-saving.patch
-------------------------------------------------------------------
Fri Feb 26 14:56:56 UTC 2016 - wbauer@tmo.at