Mir
surface.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 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>
20#include <mir_toolkit/mir_input_device_types.h>
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 graphics { class CursorImage; }
28 namespace compositor { class BufferStream; }
29}
30
31namespace miroil {
32
33class SurfaceObserver;
34class SurfaceObserverImpl;
35
36using CompositorID = void const*;
37
39{
40public:
41 Surface(std::shared_ptr<mir::scene::Surface> wrapped);
42 ~Surface() = default;
43
44 mir::scene::Surface *get_wrapped() const;
45 void add_observer(std::shared_ptr<miroil::SurfaceObserver> const& observer);
46 void remove_observer(std::shared_ptr<miroil::SurfaceObserver> const& observer);
47
48 int buffers_ready_for_compositor(void const* compositor_id) const;
50
51
53 void set_orientation(MirOrientation orientation);
54
55 void set_confine_pointer_state(MirPointerConfinementState state);
56 std::shared_ptr<mir::scene::Surface> parent() const;
57 /// Top-left corner (of the window frame if present)
59 bool visible() const;
60
61 // TODO a legacy of old interactions and needs removing
62 int configure(MirWindowAttrib attrib, int value);
63 // TODO a legacy of old interactions and needs removing
64 int query(MirWindowAttrib attrib) const;
65 // TODO a legacy of old interactions and needs removing
66 void set_keymap(MirInputDeviceId id, std::string const& model, std::string const& layout,
67 std::string const& variant, std::string const& options);
68
69private:
70 std::shared_ptr<mir::scene::Surface> wrapped;
71 std::unordered_map<std::shared_ptr<miroil::SurfaceObserver>, std::shared_ptr<miroil::SurfaceObserverImpl>> observers;
72};
73
74}
75
76#endif
Definition: surface.h:39
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
Definition: surface_observer.h:34
int64_t MirInputDeviceId
Definition: mir_input_device_types.h:27
Definition: display_listener_wrapper.h:25
Definition: output.h:28
Definition: internal_client.h:24
Definition: window_specification.h:32
Definition: runner.h:27
Definition: compositor.h:21

Copyright © 2012-2023 Canonical Ltd.
Generated on Tue 2 May 10:01:24 UTC 2023
This documentation is licensed under the GPL version 2 or 3.