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>
20 #include <mir_toolkit/mir_input_device_types.h>
21 #include <mir_toolkit/common.h>
22 #include <mir/graphics/renderable.h>
23 
24 namespace mir {
25  namespace scene { class Surface; }
26  namespace shell { class InputTargeter; }
27  namespace graphics { class CursorImage; }
28  namespace compositor { class BufferStream; }
29 }
30 
31 namespace miroil {
32 
33 class SurfaceObserver;
34 class SurfaceObserverImpl;
35 
36 using CompositorID = void const*;
37 
38 class Surface
39 {
40 public:
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 
69 private:
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

Copyright © 2012-2022 Canonical Ltd.
Generated on Tue Sep 13 03:20:30 UTC 2022
This documentation is licensed under the GPL version 2 or 3.