~mir-team/qtmir/devel-mir-next

« back to all changes in this revision

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

  • Committer: Bileto Bot
  • Author(s): Alan Griffiths
  • Date: 2017-03-20 21:14:51 UTC
  • mfrom: (606.3.13 qtmir)
  • Revision ID: ci-train-bot@canonical.com-20170320211451-qj7mygvtyjhoc1pc
Reduce dependencies on mirserver by reworking ../Application/mirbuffersgtexture.cpp and ../Application/surfacemanager.cpp

Approved by: Gerry Boland, Unity8 CI Bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include <debughelpers.h>
28
28
#include <mirqtconversion.h>
29
29
 
30
 
// Mir
31
 
#include <mir/scene/surface.h>
32
 
 
33
30
// Qt
34
31
#include <QGuiApplication>
35
32
 
88
85
 
89
86
void SurfaceManager::onWindowAdded(const NewWindow &window)
90
87
{
 
88
    const auto &windowInfo = window.windowInfo;
91
89
    {
92
 
        std::shared_ptr<mir::scene::Surface> surface = window.surface;
93
 
        DEBUG_MSG << " mir::scene::Surface[type=" << mirSurfaceTypeToStr(surface->type())
94
 
            << ",parent=" << (void*)(surface->parent().get())
95
 
            << ",state=" << mirSurfaceStateToStr(surface->state())
96
 
            << ",top_left=" << toQPoint(surface->top_left())
 
90
        DEBUG_MSG << " mir::scene::Surface[type=" << mirSurfaceTypeToStr(windowInfo.type())
 
91
            << ",parent=" << (void*)(std::shared_ptr<mir::scene::Surface>{windowInfo.parent()}.get())
 
92
            << ",state=" << mirSurfaceStateToStr(windowInfo.state())
 
93
            << ",top_left=" << toQPoint(windowInfo.window().top_left())
97
94
            << "]";
98
95
    }
99
96
 
100
 
    auto mirSession = window.windowInfo.window().application();
 
97
    auto mirSession = windowInfo.window().application();
101
98
    SessionInterface* session = ApplicationManager::singleton()->findSession(mirSession.get());
102
99
 
103
 
    MirSurface *parentSurface;
104
 
    {
105
 
        std::shared_ptr<mir::scene::Surface> surface = window.windowInfo.window();
106
 
        parentSurface = find(surface->parent());
107
 
    }
108
 
 
109
 
    auto surface = new MirSurface(window, m_windowController, session, parentSurface);
 
100
    const auto parentSurface = find(windowInfo.parent());
 
101
    const auto surface = new MirSurface(window, m_windowController, session, parentSurface);
110
102
    rememberMirSurface(surface);
111
103
 
112
104
    if (parentSurface) {
144
136
    return nullptr;
145
137
}
146
138
 
147
 
MirSurface *SurfaceManager::find(const std::shared_ptr<mir::scene::Surface> &needle) const
148
 
{
149
 
    Q_FOREACH(const auto surface, m_allSurfaces) {
150
 
        if (surface->window() == needle) {
151
 
            return surface;
152
 
        }
153
 
    }
154
 
    return nullptr;
155
 
}
156
 
 
157
139
void SurfaceManager::onWindowReady(const miral::WindowInfo &windowInfo)
158
140
{
159
141
    if (auto mirSurface = find(windowInfo)) {