~alan-griffiths/mir/knee-jerk-mir_surface_state_automatic

« back to all changes in this revision

Viewing changes to src/frontend/application_proxy.cpp

  • Committer: Kevin DuBois
  • Date: 2012-11-13 01:36:29 UTC
  • mfrom: (245 trunk)
  • mto: This revision was merged to the branch mainline in revision 246.
  • Revision ID: kevin.dubois@canonical.com-20121113013629-q4496w4mp5e33auk
merge in base branch. move the demo clients to a new directory, examples/

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include "mir/frontend/application_proxy.h"
20
20
#include "mir/frontend/application_listener.h"
 
21
#include "mir/frontend/application_session_factory.h"
 
22
#include "mir/frontend/application_session.h"
21
23
#include "mir/frontend/resource_cache.h"
22
24
 
23
25
#include "mir/compositor/buffer_ipc_package.h"
30
32
#include "mir/surfaces/surface.h"
31
33
 
32
34
mir::frontend::ApplicationProxy::ApplicationProxy(
33
 
    std::shared_ptr<surfaces::ApplicationSurfaceOrganiser> const& surface_organiser,
 
35
    std::shared_ptr<frontend::ApplicationSessionFactory> const& session_factory,
34
36
    std::shared_ptr<graphics::Platform> const & graphics_platform,
35
37
    std::shared_ptr<graphics::Display> const& graphics_display,
36
38
    std::shared_ptr<ApplicationListener> const& listener,
37
39
    std::shared_ptr<ResourceCache> const& resource_cache) :
38
 
    surface_organiser(surface_organiser),
 
40
    session_factory(session_factory),
39
41
    graphics_platform(graphics_platform),
40
42
    graphics_display(graphics_display),
41
43
    listener(listener),
52
54
{
53
55
    app_name = request->application_name();
54
56
    listener->application_connect_called(app_name);
 
57
    
 
58
    application_session = session_factory->open_session(app_name);
55
59
 
56
60
    auto ipc_package = graphics_platform->get_ipc_package();
57
61
    auto platform = response->mutable_platform();
79
83
{
80
84
    listener->application_create_surface_called(app_name);
81
85
 
82
 
    auto handle = surface_organiser->create_surface(
 
86
    auto handle = application_session->create_surface(
83
87
        surfaces::SurfaceCreationParameters()
84
88
        .of_name(request->surface_name())
85
 
        .of_size(geometry::Size{geometry::Width{request->width()},
86
 
                                geometry::Height{request->height()}})
 
89
        .of_size(request->width(), request->height())            
87
90
        .of_buffer_usage(static_cast<compositor::BufferUsage>(request->buffer_usage()))
88
91
        );
89
92
 
168
171
 
169
172
    if (p != surfaces.end())
170
173
    {
171
 
        surface_organiser->destroy_surface(p->second);
 
174
        application_session->destroy_surface((p->second).lock());
172
175
        surfaces.erase(p);
173
176
    }
174
177
    else
190
193
{
191
194
    listener->application_disconnect_called(app_name);
192
195
 
193
 
    for (auto p = surfaces.begin(); p != surfaces.end(); ++p)
194
 
    {
195
 
        surface_organiser->destroy_surface(p->second);
196
 
    }
 
196
    session_factory->close_session(application_session);
197
197
 
198
198
    done->Run();
199
199
}