summaryrefslogtreecommitdiffstats
path: root/wayland/democompositor/processlauncher.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2017-08-13 12:00:08 +0200
committerHolger Freyther <holger+qt@freyther.de>2017-09-12 06:17:19 +0000
commitff2b5b5468fcfce0a2277cb2baad494344144ad8 (patch)
tree998de756c5094772ccde5593d0e8eb9bedebb1e5 /wayland/democompositor/processlauncher.cpp
parente9dc7f1db47f5b59d4bf85bc5c8971c2df1dc807 (diff)
democompositor: Provide an example to detect unknown apps
When a new wlShellSurface is created we can check the identity of the client and if it is belongs to an application launched by the democompositor. In the future such apps might be killed and their surface not displayed. Introduce appStateForPid to find the AppState and return it as a QVariant to easily use it in QML. Use int as type as one can not easily use Q_PID in QML. Change-Id: Ibb9ac004a8016bd76f61679f5c837c99783fa7e8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'wayland/democompositor/processlauncher.cpp')
-rw-r--r--wayland/democompositor/processlauncher.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/wayland/democompositor/processlauncher.cpp b/wayland/democompositor/processlauncher.cpp
index c8fe15c..bb11cb9 100644
--- a/wayland/democompositor/processlauncher.cpp
+++ b/wayland/democompositor/processlauncher.cpp
@@ -74,6 +74,19 @@ WaylandProcessLauncher::~WaylandProcessLauncher()
{
}
+QVariant WaylandProcessLauncher::appStateForPid(int pid) const
+{
+ for (auto state : m_appStates) {
+ if (state.process->pid() == pid) {
+ qCDebug(procs) << "Found state for" << pid << state.appEntry.executableName;
+ return QVariant::fromValue(state);
+ }
+ }
+
+ qCDebug(procs) << "Couldn't find entry for" << pid;
+ return QVariant();
+}
+
bool WaylandProcessLauncher::isRunning(const AppEntry& entry) const
{
for (auto state : m_appStates) {