diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2017-02-23 12:03:00 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2017-02-23 15:59:57 +0000 |
commit | 23a0e5a929b5b03f91ae532a765e2b7a543c3a99 (patch) | |
tree | e5f0838f3419e1abe58a3724f999ab32b190d3d9 | |
parent | 74ea212de781f79c7455f1fbc01abda7a594f1fa (diff) | |
download | qtapplicationmanager-23a0e5a929b5b03f91ae532a765e2b7a543c3a99.tar.gz |
Code and debug output cleanup for application starts
This reduces the amount of cryptic output when starting applications in
Wayland mode.
Change-Id: I0b49b27e8b3322cfe77b1a086b400a0814af8774
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r-- | src/manager-lib/applicationmanager.cpp | 7 | ||||
-rw-r--r-- | src/manager-lib/processcontainer.cpp | 2 | ||||
-rw-r--r-- | src/manager/main.cpp | 1 | ||||
-rw-r--r-- | src/window-lib/windowmanager.cpp | 66 | ||||
-rw-r--r-- | src/window-lib/windowmanager.h | 2 | ||||
-rw-r--r-- | src/window-lib/windowmanager_p.h | 2 |
6 files changed, 41 insertions, 39 deletions
diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp index 106ccc61..a3a6c9cb 100644 --- a/src/manager-lib/applicationmanager.cpp +++ b/src/manager-lib/applicationmanager.cpp @@ -926,8 +926,7 @@ bool ApplicationManager::startApplication(const Application *app, const QString runtime->deleteLater(); return ok; } else { - auto f = [=]() { - qCDebug(LogSystem) << "Container ready for app (" << app->id() <<")!"; + auto startInContainer = [app, attachRuntime, runtime]() { bool successfullyStarted = attachRuntime ? runtime->attachApplicationToQuickLauncher(app) : runtime->start(); if (!successfullyStarted) @@ -938,11 +937,11 @@ bool ApplicationManager::startApplication(const Application *app, const QString if (container->isReady()) { // Since the container is already ready, start the app immediately - return f(); + return startInContainer(); } else { // We postpone the starting of the application to a later point in time since the container is not ready yet - connect(container, &AbstractContainer::ready, f); + connect(container, &AbstractContainer::ready, startInContainer); return true; // we return true for now, since we don't know at this point in time whether the container will be able to start the application. TODO : fix } } diff --git a/src/manager-lib/processcontainer.cpp b/src/manager-lib/processcontainer.cpp index 54bd1b5e..3ff1d805 100644 --- a/src/manager-lib/processcontainer.cpp +++ b/src/manager-lib/processcontainer.cpp @@ -226,7 +226,7 @@ AbstractContainerProcess *ProcessContainer::start(const QStringList &arguments, command = cmd.takeFirst(); args = cmd; } - qCDebug(LogSystem) << "Running command:" << command << args; + qCDebug(LogSystem) << "Running command:" << command << "arguments:" << args; process->start(command, args); m_process = process; diff --git a/src/manager/main.cpp b/src/manager/main.cpp index 10545d3b..3b6c7893 100644 --- a/src/manager/main.cpp +++ b/src/manager/main.cpp @@ -577,6 +577,7 @@ int main(int argc, char *argv[]) loggingRules.prepend(qSL("qt.qpa.*.debug=false")); loggingRules.prepend(qSL("qt.quick.*.debug=false")); loggingRules.prepend(qSL("qt.scenegraph.*.debug=false")); + loggingRules.prepend(qSL("qt.compositor.input.*.debug=false")); loggingRules.prepend(qSL("*.debug=true")); } diff --git a/src/window-lib/windowmanager.cpp b/src/window-lib/windowmanager.cpp index d596db49..cea0bf8c 100644 --- a/src/window-lib/windowmanager.cpp +++ b/src/window-lib/windowmanager.cpp @@ -438,11 +438,11 @@ QVariant WindowManager::data(const QModelIndex &index, int role) const #if defined(AM_MULTI_PROCESS) auto ww = qobject_cast<const WaylandWindow*>(win); if (ww && ww->surface() && ww->surface()->surface()) -#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) +# if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) return ww->surface()->surface()->isMapped(); -#else +# else return ww->surface()->surface()->hasContent(); -#endif +# endif #endif return false; } @@ -569,9 +569,6 @@ void WindowManager::registerCompositorView(QQuickWindow *view) if (!ApplicationManager::instance()->isSingleProcess()) { if (!d->waylandCompositor) { d->waylandCompositor = new WaylandCompositor(view, d->waylandSocketName, this); - connect(view, &QWindow::heightChanged, this, &WindowManager::resize); - connect(view, &QWindow::widthChanged, this, &WindowManager::resize); - // export the actual socket name for our child processes. qputenv("WAYLAND_DISPLAY", d->waylandCompositor->socketName()); qCDebug(LogWayland).nospace() << "WindowManager: running in Wayland mode [socket: " @@ -686,44 +683,40 @@ void WindowManager::setupWindow(Window *window) #if defined(AM_MULTI_PROCESS) -void WindowManager::resize() -{ -# if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) - d->waylandCompositor->setOutputGeometry(d->views.at(0)->geometry()); -# endif -} - void WindowManager::waylandSurfaceCreated(WindowSurface *surface) { - qCDebug(LogWayland) << "waylandSurfaceCreate" << surface->surface() << "(PID:" << surface->processId() << ")" << surface->windowProperties(); + Q_UNUSED(surface) + // this function is still useful for Wayland debugging + //qCDebug(LogWayland) << "New Wayland surface:" << surface->surface() << "pid:" << surface->processId(); } void WindowManager::waylandSurfaceMapped(WindowSurface *surface) { - qCDebug(LogWayland) << "waylandSurfaceMapped" << surface->surface(); - Q_ASSERT(surface != 0); - qint64 processId = surface->processId(); if (processId == 0) return; //TODO: find out what those surfaces are and what I should do with them ;) - const Application* app = ApplicationManager::instance()->fromProcessId(processId); + const Application *app = ApplicationManager::instance()->fromProcessId(processId); if (!app && ApplicationManager::instance()->securityChecksEnabled()) { - qCWarning(LogWayland) << "SECURITY ALERT: an unknown application tried to create a wayland-surface!"; + qCCritical(LogWayland) << "SECURITY ALERT: an unknown application with pid" << processId + << "tried to map a Wayland surface!"; return; } + Q_ASSERT(surface); Q_ASSERT(surface->item()); - //Only create a new Window if we don't have it already in the window list, as the user controls whether windows are removed or not + qCDebug(LogWayland) << "Mapping Wayland surface" << surface->item() << "of" << d->applicationId(app, surface); + + // Only create a new Window if we don't have it already in the window list, as the user controls + // whether windows are removed or not int index = d->findWindowByWaylandSurface(surface->surface()); if (index == -1) { WaylandWindow *w = new WaylandWindow(app, surface); setupWindow(w); } else { QModelIndex modelIndex = QAbstractListModel::index(index); - qCDebug(LogWayland) << "emitting dataChanged, index: " << modelIndex.row() << ", isMapped: true"; emit dataChanged(modelIndex, modelIndex, QVector<int>() << IsMapped); emit windowReady(index, d->windows.at(index)->windowItem()); } @@ -740,23 +733,25 @@ void WindowManager::waylandSurfaceMapped(WindowSurface *surface) void WindowManager::waylandSurfaceUnmapped(WindowSurface *surface) { - qCDebug(LogWayland) << "waylandSurfaceUnmapped" << surface->surface(); - int index = d->findWindowByWaylandSurface(surface->surface()); + if (index == -1) { - qCWarning(LogWayland) << "waylandSurfaceUnmapped: could not find an application window for surface" << surface; + qCWarning(LogWayland) << "Unmapping a surface failed, because no application window is " + "registered for Wayland surface" << surface->item(); return; } WaylandWindow *win = qobject_cast<WaylandWindow *>(d->windows.at(index)); if (!win) return; + qCDebug(LogWayland) << "Unmapping Wayland surface" << surface->item() << "of" + << d->applicationId(win->application(), surface); + // switch off Wayland ping/pong if (d->watchdogEnabled) win->enablePing(false); QModelIndex modelIndex = QAbstractListModel::index(index); - qCDebug(LogWayland) << "emitting dataChanged, index: " << modelIndex.row() << ", isMapped: false"; emit dataChanged(modelIndex, modelIndex, QVector<int>() << IsMapped); emit windowClosing(index, win->windowItem()); //TODO: rename to windowUnmapped @@ -764,16 +759,18 @@ void WindowManager::waylandSurfaceUnmapped(WindowSurface *surface) void WindowManager::waylandSurfaceDestroyed(WindowSurface *surface) { - qCDebug(LogWayland) << "waylandSurfaceDestroyed" << surface; int index = d->findWindowByWaylandSurface(surface->surface()); if (index == -1) { - qCWarning(LogWayland) << "waylandSurfaceDestroyed: could not find an application window for surface" << surface; + // this is a surface that was only created, but never mapped - just ignore it return; } WaylandWindow *win = qobject_cast<WaylandWindow *>(d->windows.at(index)); if (!win) return; + qCDebug(LogWayland) << "Destroying Wayland surface" << (surface ? surface->item() : nullptr) + << "of" << d->applicationId(win->application(), surface); + win->setClosing(); emit windowLost(index, win->windowItem()); //TODO: rename to windowDestroyed @@ -1018,12 +1015,7 @@ bool WindowManager::makeScreenshot(const QString &filename, const QString &selec } #if defined(AM_MULTI_PROCESS) else if (const WaylandWindow *wlw = qobject_cast<const WaylandWindow *>(w)) { -# if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) - Q_UNUSED(wlw) - onScreen = true; -# else onScreen = wlw->surface() && (wlw->surface()->outputWindow() == view); -# endif } #endif if (onScreen) { @@ -1120,6 +1112,16 @@ int WindowManagerPrivate::findWindowByWaylandSurface(QWaylandSurface *waylandSur return -1; } +QString WindowManagerPrivate::applicationId(const Application *app, WindowSurface *windowSurface) +{ + if (app) + return app->id(); + else if (windowSurface && windowSurface->surface() && windowSurface->surface()->client()) + return qSL("pid: ") + QString::number(windowSurface->surface()->client()->processId()); + else + return qSL("<unknown client>"); +} + #endif // defined(AM_MULTI_PROCESS) QT_END_NAMESPACE_AM diff --git a/src/window-lib/windowmanager.h b/src/window-lib/windowmanager.h index 6305b30b..13999648 100644 --- a/src/window-lib/windowmanager.h +++ b/src/window-lib/windowmanager.h @@ -166,8 +166,6 @@ private slots: void waylandSurfaceUnmapped(QT_PREPEND_NAMESPACE_AM(WindowSurface) *surface); void waylandSurfaceDestroyed(QT_PREPEND_NAMESPACE_AM(WindowSurface) *surface); - void resize(); - private: void handleWaylandSurfaceDestroyedOrUnmapped(QWaylandSurface *surface); #endif diff --git a/src/window-lib/windowmanager_p.h b/src/window-lib/windowmanager_p.h index d6aa6d64..3304e303 100644 --- a/src/window-lib/windowmanager_p.h +++ b/src/window-lib/windowmanager_p.h @@ -61,6 +61,8 @@ public: int findWindowByWaylandSurface(QWaylandSurface *waylandSurface) const; WaylandCompositor *waylandCompositor = nullptr; + + static QString applicationId(const Application *app, WindowSurface *windowSurface); #endif QHash<int, QByteArray> roleNames; |