summaryrefslogtreecommitdiffstats
path: root/src/windowmanager.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2019-10-18 19:33:20 +0200
committerSimon Rettberg2019-10-18 19:33:20 +0200
commit31777a980e0f4b1b258713158524c0cd9a1dc30f (patch)
tree459c5bff4bcb2ff5c8c4d7b40f47bbcaf5d59f54 /src/windowmanager.cpp
parentProperly handle key press events; prevent double-execution (diff)
downloadvmchooser2-31777a980e0f4b1b258713158524c0cd9a1dc30f.tar.gz
vmchooser2-31777a980e0f4b1b258713158524c0cd9a1dc30f.tar.xz
vmchooser2-31777a980e0f4b1b258713158524c0cd9a1dc30f.zip
Use execv() to start selected session
Prevent vmchooser from lingering in the background, like a zombie, haunting you with invisible windows. Also seems to be notably faster when launching the openbox session.
Diffstat (limited to 'src/windowmanager.cpp')
-rw-r--r--src/windowmanager.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/windowmanager.cpp b/src/windowmanager.cpp
index 2505c89..c05e234 100644
--- a/src/windowmanager.cpp
+++ b/src/windowmanager.cpp
@@ -38,12 +38,16 @@ void ensureRunning()
});
}
-void stopOwnInstance()
+void stopOwnInstance(bool waitSync)
{
if (wm.state() == QProcess::Running) {
qDebug() << "- Politely terminating spawned WM";
- wm.terminate();
- QTimer::singleShot(500, killInstance);
+ if (waitSync) {
+ killInstance();
+ } else {
+ wm.terminate();
+ QTimer::singleShot(500, killInstance);
+ }
}
}
@@ -51,7 +55,9 @@ void killInstance()
{
if (wm.state() == QProcess::Running) {
wm.terminate();
- QThread::msleep(50);
+ }
+ for (int i = 0; i < 50 && wm.state() == QProcess::Running; ++i) {
+ QThread::msleep(10);
}
if (wm.state() == QProcess::Running) {
qDebug() << "- Forcefully killing spawned WM";