~alan-griffiths/miral/revised-resize

« back to all changes in this revision

Viewing changes to miral/window.cpp

  • Committer: Alan Griffiths
  • Date: 2016-04-25 16:38:30 UTC
  • mfrom: (158.2.15 miral)
  • Revision ID: alan@octopull.co.uk-20160425163830-kzlig7vmgp79oj6v
More removal of redundant mechanisms - especially the Application object

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
miral::Window::Self::Self(std::shared_ptr<mir::scene::Session> const& session, mir::frontend::SurfaceId surface) :
35
35
    id{surface}, session{session}, surface{session->surface(surface)} {}
36
36
 
37
 
miral::Window::Window(std::shared_ptr<mir::scene::Session> const& session, mir::frontend::SurfaceId surface) :
38
 
    self{std::make_shared<Self>(session, surface)}
 
37
miral::Window::Window(Application const& application, mir::frontend::SurfaceId surface) :
 
38
    self{std::make_shared<Self>(application, surface)}
39
39
{
40
40
}
41
41
 
123
123
        surface->request_client_surface_close();
124
124
}
125
125
 
126
 
auto miral::Window::state() const
127
 
-> MirSurfaceState
128
 
{
129
 
    if (self)
130
 
    {
131
 
        if (auto const surface = self->surface.lock())
132
 
            return surface->state();
133
 
    }
134
 
 
135
 
    return mir_surface_state_unknown;
136
 
}
137
 
 
138
126
auto miral::Window::top_left() const
139
127
-> mir::geometry::Point
140
128
{
159
147
    return {};
160
148
}
161
149
 
162
 
auto miral::Window::session() const
163
 
-> std::shared_ptr<mir::scene::Session>
 
150
auto miral::Window::application() const
 
151
-> Application
164
152
{
165
153
    if (!self) return {};
166
154
    return self->session.lock();
173
161
    return self->id;
174
162
}
175
163
 
176
 
auto miral::Window::input_bounds() const
177
 
-> mir::geometry::Rectangle
178
 
{
179
 
    if (self)
180
 
    {
181
 
        if (auto const surface = self->surface.lock())
182
 
            return surface->input_bounds();
183
 
    }
184
 
 
185
 
    return {};
186
 
}
187
 
 
188
164
auto miral::Window::input_area_contains(mir::geometry::Point const& point) const
189
165
-> bool
190
166
{
208
184
        for (auto const& stream : config)
209
185
            dest.push_back(mir::shell::StreamSpecification{mir::frontend::BufferStreamId{stream.stream_id.as_value()}, stream.displacement});
210
186
 
211
 
        session()->configure_streams(*surface, dest);
 
187
        application()->configure_streams(*surface, dest);
212
188
    }
213
189
}
214
190