Mir
display.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser 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 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  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_GRAPHICS_DISPLAY_H_
20 #define MIR_GRAPHICS_DISPLAY_H_
21 
22 #include <memory>
23 #include <functional>
24 #include <chrono>
25 
26 namespace mir
27 {
28 
29 namespace graphics
30 {
31 
32 class DisplayBuffer;
33 class DisplayConfiguration;
34 class Cursor;
35 class CursorImage;
36 class GLContext;
37 class EventHandlerRegister;
39 
40 typedef std::function<bool()> DisplayPauseHandler;
41 typedef std::function<bool()> DisplayResumeHandler;
42 typedef std::function<void()> DisplayConfigurationChangeHandler;
43 
56 {
57 public:
61  virtual void for_each_display_buffer(std::function<void(DisplayBuffer&)> const& f) = 0;
62 
67  virtual void post() = 0;
68 
76  virtual std::chrono::milliseconds recommended_sleep() const = 0;
77 
78  virtual ~DisplaySyncGroup() = default;
79 protected:
80  DisplaySyncGroup() = default;
81  DisplaySyncGroup(DisplaySyncGroup const&) = delete;
83 };
84 
88 class Display
89 {
90 public:
94  virtual void for_each_display_sync_group(std::function<void(DisplaySyncGroup&)> const& f) = 0;
95 
99  virtual std::unique_ptr<DisplayConfiguration> configuration() const = 0;
100 
104  virtual void configure(DisplayConfiguration const& conf) = 0;
105 
115  virtual void register_configuration_change_handler(
116  EventHandlerRegister& handlers,
117  DisplayConfigurationChangeHandler const& conf_change_handler) = 0;
118 
125  virtual void register_pause_resume_handlers(
126  EventHandlerRegister& handlers,
127  DisplayPauseHandler const& pause_handler,
128  DisplayResumeHandler const& resume_handler) = 0;
129 
136  virtual void pause() = 0;
137 
141  virtual void resume() = 0;
142 
146  virtual std::shared_ptr<Cursor> create_hardware_cursor(std::shared_ptr<CursorImage> const& initial_image) = 0;
147 
154  virtual std::unique_ptr<GLContext> create_gl_context() = 0;
155 
160  virtual std::unique_ptr<VirtualOutput> create_virtual_output(int width, int height) = 0;
161 
162  Display() = default;
163  virtual ~Display() = default;
164 private:
165  Display(Display const&) = delete;
166  Display& operator=(Display const&) = delete;
167 };
168 }
169 }
170 
171 #endif /* MIR_GRAPHICS_DISPLAY_H_ */
All things Mir.
Definition: atomic_callback.h:25
Interface to an output framebuffer.
Definition: display_buffer.h:47
DisplaySyncGroup represents a group of displays that need to be output in unison as a single post() c...
Definition: display.h:55
virtual void for_each_display_buffer(std::function< void(DisplayBuffer &)> const &f)=0
Executes a functor that allows the DisplayBuffer contents to be updated.
std::function< bool()> DisplayResumeHandler
Definition: display.h:41
DisplaySyncGroup & operator=(DisplaySyncGroup const &)=delete
unsigned int width
Definition: touchspot_image.c:4
std::function< bool()> DisplayPauseHandler
Definition: display.h:38
virtual ~DisplaySyncGroup()=default
unsigned int height
Definition: touchspot_image.c:5
virtual std::chrono::milliseconds recommended_sleep() const =0
Returns a recommendation to the compositor as to how long it should wait before sampling the scene fo...
Interface to a virtual output.
Definition: virtual_output.h:31
virtual void post()=0
Post the content of the DisplayBuffers associated with this DisplaySyncGroup.
Interface to the display subsystem.
Definition: display.h:88
std::function< void()> DisplayConfigurationChangeHandler
Definition: display.h:42
Interface to a configuration of display cards and outputs.
Definition: display_configuration.h:167
Definition: event_handler_register.h:32

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016