From c22860511e43ac88a2bad398a0dfcea537501e16 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 29 Sep 2017 13:32:06 +0200 Subject: democompositor: Store the AppEntry in the Chrome Keep the AppEntry in the Chrome and set it when a new surface is created. Handle the situation when an external application is launched and check for null. Change-Id: Ib327ec266587bba9a2c48eacbcb79c508b2066d0 Reviewed-by: Paul Olav Tvete --- wayland/democompositor/qml/Chrome.qml | 2 ++ wayland/democompositor/qml/Screen.qml | 2 +- wayland/democompositor/qml/main.qml | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'wayland') diff --git a/wayland/democompositor/qml/Chrome.qml b/wayland/democompositor/qml/Chrome.qml index 33a5b99..9c21cd1 100644 --- a/wayland/democompositor/qml/Chrome.qml +++ b/wayland/democompositor/qml/Chrome.qml @@ -65,6 +65,8 @@ Rectangle { property int marginWidth : 5 property int titlebarHeight : 5 + property var appEntry + function requestSize(w, h) { surfaceItem.requestSize(Qt.size(w - 2 * marginWidth, h - titlebarHeight - marginWidth)) } diff --git a/wayland/democompositor/qml/Screen.qml b/wayland/democompositor/qml/Screen.qml index 7ab7481..ef3be4d 100644 --- a/wayland/democompositor/qml/Screen.qml +++ b/wayland/democompositor/qml/Screen.qml @@ -189,7 +189,7 @@ WaylandOutput { pressedColor: pressedCol text.maximumLineCount: 1 - text.text: modelData.shellSurface.title.length > 0 ? modelData.shellSurface.title : "Untitled" + text.text: winItem.appEntry === null ? "Untitled" : winItem.appEntry.appName text.elide: Text.ElideRight text.color: textCol onTriggered: { diff --git a/wayland/democompositor/qml/main.qml b/wayland/democompositor/qml/main.qml index 75d1adc..3947b52 100644 --- a/wayland/democompositor/qml/main.qml +++ b/wayland/democompositor/qml/main.qml @@ -72,12 +72,16 @@ WaylandCompositor { onWlShellSurfaceCreated: { const pid = shellSurface.surface.client.processId; const appState = mainScreen.appLauncher.appStateForPid(pid); + var appEntry; if (!appState) { console.log("shellSurface of unknown application. Continuing. PID=" + pid); } else { console.log("shellSurface belonging to " + appState.appEntry.executableName); + appEntry = appState.appEntry; } - chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } ); + chromeComponent.createObject(defaultOutput.surfaceArea, { + "shellSurface": shellSurface, + "appEntry": appEntry } ); defaultOutput.relayout(); } } -- cgit v1.2.3