summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp62
1 files changed, 61 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp
index cf852fc..d3b9658 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -49,7 +49,10 @@
#include <kdecoration.h>
#include <kwin.h>
#include <klocale.h>
+#include <kprocess.h>
+#include <kstandarddirs.h>
+#include <netwm.h>
#include <qapplication.h>
#include <qlayout.h>
@@ -112,7 +115,8 @@ m_popup (0),
m_advanced_popup (0),
m_viewport_menu (0),
m_appearance_menu (0),
-m_brightness_menu (0), m_saturation_menu (0), m_opacity_menu (0)
+m_brightness_menu (0), m_saturation_menu (0), m_opacity_menu (0),
+mProcessKiller (0)
{
KWin::WindowInfo wInf = KWin::windowInfo (m_wid, NET::WMState, 0);
m_state = wInf.state ();
@@ -1827,3 +1831,59 @@ Aquamarine::Window::eventFilter (QObject * watched, QEvent * event)
return rv;
}
+void Aquamarine::Window::handleProcessKillerExited (void)
+{
+ if (mProcessKiller)
+ {
+ delete mProcessKiller;
+ mProcessKiller = NULL;
+ }
+}
+
+void Aquamarine::Window::showKillProcessDialog (Time timestamp)
+{
+ KWin::WindowInfo kWinInfo =
+ KWin::windowInfo (m_wid, 0, NET::WM2WindowClass | NET::WM2ClientMachine);
+ NETWinInfo wInfo = NETWinInfo (qt_xdisplay(), m_wid,
+ qt_xrootwin (), NET::WMPid);
+ QCString clientMachine, resourceClass;
+ pid_t pid;
+ char buf[257];
+
+ if (mProcessKiller)
+ return;
+
+ clientMachine = kWinInfo.clientMachine ();
+ resourceClass = kWinInfo.windowClassClass ();
+ pid = wInfo.pid ();
+
+ if (gethostname (buf, sizeof (buf) - 1) == 0)
+ {
+ if (strcmp (buf, clientMachine) == 0)
+ clientMachine = "localhost";
+ }
+
+ mProcessKiller = new KProcess (this);
+
+ *mProcessKiller << KStandardDirs::findExe ("kwin_killer_helper") <<
+ "--pid" << QCString ().setNum (pid) <<
+ "--hostname" << clientMachine <<
+ "--windowname" << m_name.utf8 () <<
+ "--applicationname" << resourceClass <<
+ "--wid" << QCString ().setNum (m_wid) <<
+ "--timestamp" << QCString ().setNum (timestamp);
+
+ connect (mProcessKiller, SIGNAL (processExited (KProcess *)),
+ SLOT (handleProcessKillerExited ()));
+
+ if (!mProcessKiller->start (KProcess::NotifyOnExit))
+ {
+ delete mProcessKiller;
+ mProcessKiller = NULL;
+ }
+}
+
+void Aquamarine::Window::hideKillProcessDialog (void)
+{
+ handleProcessKillerExited ();
+}