summaryrefslogtreecommitdiff
path: root/kde
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2008-09-10 20:07:40 +0200
committerDennis kasprzyk <onestone@compiz-fusion.org>2008-09-10 20:07:40 +0200
commitccf71c4ed3d5507b1dead7f7a4576d0ef737bad5 (patch)
tree43d515263aa616626c3289bd3c01a89e8bcc41c1 /kde
parentec56e44a17b66b4b8d0714ad79ec85004908ee26 (diff)
downloadzcomp-ccf71c4ed3d5507b1dead7f7a4576d0ef737bad5.tar.gz
zcomp-ccf71c4ed3d5507b1dead7f7a4576d0ef737bad5.tar.bz2
Improved handling of the "process killer" process.
Diffstat (limited to 'kde')
-rw-r--r--kde/window-decorator-kde4/window.cpp44
-rw-r--r--kde/window-decorator-kde4/window.h4
2 files changed, 21 insertions, 27 deletions
diff --git a/kde/window-decorator-kde4/window.cpp b/kde/window-decorator-kde4/window.cpp
index 9e29c6b..028334d 100644
--- a/kde/window-decorator-kde4/window.cpp
+++ b/kde/window-decorator-kde4/window.cpp
@@ -87,7 +87,7 @@ KWD::Window::Window (WId parentId,
mMapped (false),
mPendingMap (0),
mPendingConfigure (0),
- mProcessKiller (0),
+ mProcessKiller (this),
mKeys (this),
mResizeOpAction (0),
mMoveOpAction (0),
@@ -183,8 +183,16 @@ KWD::Window::~Window (void)
if (mPopup)
delete mPopup;
- if (mProcessKiller)
- delete mProcessKiller;
+ if (mProcessKiller.state () == QProcess::Running)
+ {
+ mProcessKiller.terminate ();
+ mProcessKiller.waitForFinished (10000);
+ if (mProcessKiller.state () == QProcess::Running)
+ {
+ mProcessKiller.kill ();
+ mProcessKiller.waitForFinished (5000);
+ }
+ }
}
bool
@@ -2148,16 +2156,6 @@ KWD::Window::processDamage (void)
}
void
-KWD::Window::handleProcessKillerExited (void)
-{
- if (mProcessKiller)
- {
- delete mProcessKiller;
- mProcessKiller = NULL;
- }
-}
-
-void
KWD::Window::showKillProcessDialog (Time timestamp)
{
KWindowInfo kWinInfo =
@@ -2169,7 +2167,7 @@ KWD::Window::showKillProcessDialog (Time timestamp)
pid_t pid;
char buf[257];
- if (mProcessKiller)
+ if (mProcessKiller.state () == QProcess::Running)
return;
clientMachine = kWinInfo.clientMachine ();
@@ -2182,25 +2180,21 @@ KWD::Window::showKillProcessDialog (Time timestamp)
clientMachine = "localhost";
}
- mProcessKiller = new QProcess (this);
-
- connect (mProcessKiller, SIGNAL (finished (int, QProcess::ExitStatus)),
- SLOT (handleProcessKillerExited ()));
- connect (mProcessKiller, SIGNAL (error (QProcess::ProcessError)),
- SLOT (handleProcessKillerExited ()));
-
-
- mProcessKiller->start (KStandardDirs::findExe ("kwin_killer_helper"),
+ mProcessKiller.start (KStandardDirs::findExe ("kwin_killer_helper"),
QStringList () << "--pid" << QByteArray ().setNum (pid) <<
"--hostname" << clientMachine <<
"--windowname" << mName.toUtf8 () <<
"--applicationname" << resourceClass <<
"--wid" << QByteArray ().setNum ((unsigned int) mClientId) <<
- "--timestamp" << QByteArray ().setNum ((unsigned int) timestamp));
+ "--timestamp" << QByteArray ().setNum ((unsigned int) timestamp),
+ QIODevice::NotOpen);
}
void
KWD::Window::hideKillProcessDialog (void)
{
- handleProcessKillerExited ();
+ if (mProcessKiller.state () == QProcess::Running)
+ {
+ mProcessKiller.terminate ();
+ }
}
diff --git a/kde/window-decorator-kde4/window.h b/kde/window-decorator-kde4/window.h
index a59bcbf..56b06c6 100644
--- a/kde/window-decorator-kde4/window.h
+++ b/kde/window-decorator-kde4/window.h
@@ -29,6 +29,7 @@
#include <qpixmap.h>
#include <qwidget.h>
+#include <qprocess.h>
#include <decoration.h>
@@ -207,7 +208,6 @@ class Window:public QWidget, public KDecorationBridge {
void handleOpacityPopupActivated (QAction *action);
void handleDesktopPopupActivated (QAction *action);
void handlePopupAboutToShow (void);
- void handleProcessKillerExited (void);
private:
Type mType;
@@ -250,7 +250,7 @@ class Window:public QWidget, public KDecorationBridge {
int mPendingMap;
int mPendingConfigure;
QSize mSize;
- QProcess *mProcessKiller;
+ QProcess mProcessKiller;
KActionCollection mKeys;
bool mFakeRelease;