~mir-team/qtmir/trunk

« back to all changes in this revision

Viewing changes to src/modules/Unity/Application/application_manager.cpp

  • Committer: CI Train Bot
  • Author(s): Daniel d'Andrada
  • Date: 2016-02-12 00:06:46 UTC
  • mfrom: (381.4.16 initialSurfaceGeom)
  • Revision ID: ci-train-bot@canonical.com-20160212000646-kcsjdiesdyazpp53
Let shell decide the initial surface size Fixes: #1532974
Approved by: Nick Dedekind

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "sessionlistener.h"
33
33
#include "sessionauthorizer.h"
34
34
#include "logging.h"
 
35
#include <mirwindowmanager.h>
35
36
 
36
37
// mir
37
38
#include <mir/scene/surface.h>
118
119
        return nullptr;
119
120
    }
120
121
 
121
 
    auto mirServer = nativeInterface->m_mirServer;
 
122
    auto mirServer = nativeInterface->m_mirServer.lock();
122
123
 
123
124
    SessionListener *sessionListener = static_cast<SessionListener*>(nativeInterface->nativeResourceForIntegration("SessionListener"));
124
125
    SessionAuthorizer *sessionAuthorizer = static_cast<SessionAuthorizer*>(nativeInterface->nativeResourceForIntegration("SessionAuthorizer"));
146
147
    connectToSessionListener(appManager, sessionListener);
147
148
    connectToSessionAuthorizer(appManager, sessionAuthorizer);
148
149
    connectToTaskController(appManager, taskController.data());
 
150
    connect(mirServer->windowManager(), &MirWindowManager::sessionAboutToCreateSurface,
 
151
        appManager, &ApplicationManager::onSessionAboutToCreateSurface,
 
152
        Qt::BlockingQueuedConnection);
149
153
 
150
154
    // Emit signal to notify Upstart that Mir is ready to receive client connections
151
155
    // see http://upstart.ubuntu.com/cookbook/#expect-stop
858
862
    return nullptr;
859
863
}
860
864
 
 
865
void ApplicationManager::onSessionAboutToCreateSurface(
 
866
        const std::shared_ptr<mir::scene::Session> &session, int type, QSize &size)
 
867
{
 
868
    if (type == mir_surface_type_normal) {
 
869
        Application* application = findApplicationWithSession(session);
 
870
 
 
871
        if (application) {
 
872
            qCDebug(QTMIR_APPLICATIONS).nospace() << "ApplicationManager::onSessionAboutToCreateSurface appId="
 
873
                << application->appId();
 
874
            size = application->initialSurfaceSize();
 
875
        } else {
 
876
            qCDebug(QTMIR_APPLICATIONS).nospace() << "ApplicationManager::onSessionAboutToCreateSurface unknown app";
 
877
        }
 
878
    } else {
 
879
        qCDebug(QTMIR_APPLICATIONS).nospace() << "ApplicationManager::onSessionAboutToCreateSurface type=" << type
 
880
            << " NOOP";
 
881
    }
 
882
}
 
883
 
861
884
} // namespace qtmir