mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
kwin: check only the exit code of xkill
its state is already tracked by QProcess too Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
30ebc8458c
commit
c8991662be
2 changed files with 10 additions and 10 deletions
|
@ -29,14 +29,13 @@ namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
KillWindow::KillWindow(QObject *parent)
|
KillWindow::KillWindow(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent)
|
||||||
m_active(false)
|
|
||||||
{
|
{
|
||||||
m_xkill = KStandardDirs::findExe("xkill");
|
m_xkill = KStandardDirs::findExe("xkill");
|
||||||
m_proc = new QProcess(this);
|
m_proc = new QProcess(this);
|
||||||
connect(
|
connect(
|
||||||
m_proc, SIGNAL(stateChanged(QProcess::ProcessState)),
|
m_proc, SIGNAL(finished(int)),
|
||||||
this, SLOT(slotProcessStateChanged(QProcess::ProcessState))
|
this, SLOT(slotProcessFinished(int))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +46,8 @@ KillWindow::~KillWindow()
|
||||||
|
|
||||||
void KillWindow::start()
|
void KillWindow::start()
|
||||||
{
|
{
|
||||||
if (m_active) {
|
if (m_proc->state() == QProcess::Running) {
|
||||||
|
kDebug(1212) << "xkill already started";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_xkill.isEmpty()) {
|
if (m_xkill.isEmpty()) {
|
||||||
|
@ -55,12 +55,13 @@ void KillWindow::start()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_proc->start(m_xkill);
|
m_proc->start(m_xkill);
|
||||||
m_active = m_proc->waitForStarted(5000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KillWindow::slotProcessStateChanged(QProcess::ProcessState state)
|
void KillWindow::slotProcessFinished(const int exitcode)
|
||||||
{
|
{
|
||||||
m_active = (state == QProcess::Running);
|
if (exitcode != 0) {
|
||||||
|
kWarning(1212) << "xkill exited abnormally" << exitcode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -38,12 +38,11 @@ public:
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void slotProcessStateChanged(QProcess::ProcessState state);
|
void slotProcessFinished(const int exitcode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_xkill;
|
QString m_xkill;
|
||||||
QProcess* m_proc;
|
QProcess* m_proc;
|
||||||
bool m_active;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Add table
Reference in a new issue