Mir
surface.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef MIROIL_SURFACE_H
17#define MIROIL_SURFACE_H
18#include <memory>
19#include <unordered_map>
21#include <mir_toolkit/common.h>
22#include <mir/graphics/renderable.h>
23
24namespace mir {
25 namespace scene { class Surface; }
26 namespace shell { class InputTargeter; }
27 namespace geometry { struct Rectangle; }
28 namespace graphics { class CursorImage; }
29 namespace compositor { class BufferStream; }
30}
31
32namespace miroil {
33
34class SurfaceObserver;
35class SurfaceObserverImpl;
36
37using CompositorID = void const*;
38
40{
41public:
42 Surface(std::shared_ptr<mir::scene::Surface> wrapped);
43 ~Surface() = default;
44
45 mir::scene::Surface *get_wrapped() const;
46 void add_observer(std::shared_ptr<miroil::SurfaceObserver> const& observer);
47 void remove_observer(std::shared_ptr<miroil::SurfaceObserver> const& observer);
48
49 int buffers_ready_for_compositor(void const* compositor_id) const;
50 mir::graphics::RenderableList generate_renderables(miroil::CompositorID id) const;
51
52
55
57 std::shared_ptr<mir::scene::Surface> parent() const;
60 bool visible() const;
61
62 // TODO a legacy of old interactions and needs removing
63 int configure(MirWindowAttrib attrib, int value);
64 // TODO a legacy of old interactions and needs removing
65 int query(MirWindowAttrib attrib) const;
66 // TODO a legacy of old interactions and needs removing
67 void set_keymap(MirInputDeviceId id, std::string const& model, std::string const& layout,
68 std::string const& variant, std::string const& options);
69
70private:
71 std::shared_ptr<mir::scene::Surface> wrapped;
72 std::unordered_map<std::shared_ptr<miroil::SurfaceObserver>, std::shared_ptr<miroil::SurfaceObserverImpl>> observers;
73};
74
75}
76
77#endif
Definition: surface.h:40
mir::graphics::RenderableList generate_renderables(miroil::CompositorID id) const
~Surface()=default
int configure(MirWindowAttrib attrib, int value)
bool is_confined_to_window()
void set_orientation(MirOrientation orientation)
void set_confine_pointer_state(MirPointerConfinementState state)
std::shared_ptr< mir::scene::Surface > parent() const
void remove_observer(std::shared_ptr< miroil::SurfaceObserver > const &observer)
int query(MirWindowAttrib attrib) const
void add_observer(std::shared_ptr< miroil::SurfaceObserver > const &observer)
Surface(std::shared_ptr< mir::scene::Surface > wrapped)
mir::geometry::Point top_left() const
Top-left corner (of the window frame if present)
void set_keymap(MirInputDeviceId id, std::string const &model, std::string const &layout, std::string const &variant, std::string const &options)
mir::scene::Surface * get_wrapped() const
bool visible() const
int buffers_ready_for_compositor(void const *compositor_id) const
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:193
MirPointerConfinementState
Pointer Confinement.
Definition: common.h:385
MirWindowAttrib
Attributes of a window that the client and server/shell may wish to get or set over the wire.
Definition: common.h:39
int64_t MirInputDeviceId
Definition: mir_input_device_types.h:27
Definition: splash_session.h:22
Definition: compositor.h:21
void const * CompositorID
Definition: surface.h:37
Definition: point.h:30

Copyright © 2012-2022 Canonical Ltd.
Generated on Thu Jul 21 23:32:06 UTC 2022
This documentation is licensed under the GPL version 2 or 3.