Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
surface.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 
20 #ifndef MIR_SHELL_SURFACE_H_
21 #define MIR_SHELL_SURFACE_H_
22 
24 #include "mir/frontend/surface.h"
26 #include "mir/surfaces/surface.h"
27 
28 #include "mir_toolkit/common.h"
29 
30 #include <string>
31 
32 namespace mir
33 {
34 namespace frontend
35 {
36 class EventSink;
37 }
38 namespace shell
39 {
40 class InputTargeter;
41 class Session;
42 class SurfaceBuilder;
43 class SurfaceConfigurator;
44 class SurfaceController;
45 struct SurfaceCreationParameters;
46 
48 {
49 public:
50  Surface(
51  Session* session,
52  std::shared_ptr<SurfaceBuilder> const& builder,
53  std::shared_ptr<SurfaceConfigurator> const& configurator,
54  SurfaceCreationParameters const& params,
56  std::shared_ptr<frontend::EventSink> const& event_sink);
57 
58  ~Surface() noexcept;
59 
60  virtual void hide();
61  virtual void show();
62 
63  virtual void force_requests_to_complete();
64 
65  virtual std::string name() const;
66 
67  virtual void move_to(geometry::Point const& top_left);
68 
69  virtual geometry::Size size() const;
70  virtual geometry::Point top_left() const;
71 
72  virtual geometry::PixelFormat pixel_format() const;
73 
74  virtual void with_most_recent_buffer_do(
75  std::function<void(graphics::Buffer&)> const& exec);
76  virtual std::shared_ptr<graphics::Buffer> advance_client_buffer();
77 
78  virtual bool supports_input() const;
79  virtual int client_input_fd() const;
80 
81  virtual int configure(MirSurfaceAttrib attrib, int value);
82  virtual MirSurfaceType type() const;
83  virtual MirSurfaceState state() const;
84 
85  virtual void take_input_focus(std::shared_ptr<InputTargeter> const& targeter);
86  virtual void set_input_region(std::vector<geometry::Rectangle> const& region);
87 
88  virtual void allow_framedropping(bool);
89 
90  virtual void raise(std::shared_ptr<SurfaceController> const& controller);
91 private:
92  bool set_type(MirSurfaceType t); // Use configure() to make public changes
93  bool set_state(MirSurfaceState s);
94  void notify_change(MirSurfaceAttrib attrib, int value);
95 
96  std::shared_ptr<SurfaceBuilder> const builder;
97  std::shared_ptr<SurfaceConfigurator> const configurator;
98  std::shared_ptr<mir::surfaces::Surface> const surface;
99 
100  frontend::SurfaceId const id;
101  std::shared_ptr<frontend::EventSink> const event_sink;
102 
103  MirSurfaceType type_value;
104  MirSurfaceState state_value;
105 };
106 }
107 }
108 
109 #endif /* MIR_SHELL_SURFACE_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013