Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
null_display.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: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_TEST_DOUBLES_NULL_DISPLAY_H_
20 #define MIR_TEST_DOUBLES_NULL_DISPLAY_H_
21 
22 #include "mir/graphics/display.h"
23 #include "null_gl_context.h"
25 #include <thread>
26 
27 namespace mir
28 {
29 namespace test
30 {
31 namespace doubles
32 {
33 
35 {
36  public:
37  void for_each_display_buffer(std::function<void(graphics::DisplayBuffer&)> const&)
38  {
39  /* yield() is needed to ensure reasonable runtime under valgrind for some tests */
40  std::this_thread::yield();
41  }
42  std::unique_ptr<graphics::DisplayConfiguration> configuration() const override
43  {
44  return std::unique_ptr<graphics::DisplayConfiguration>(
46  );
47  }
52  {
53  }
56  graphics::DisplayResumeHandler const&) override
57  {
58  }
59  void pause() {}
60  void resume() {}
61  std::weak_ptr<graphics::Cursor> the_cursor() { return {}; }
62  std::unique_ptr<graphics::GLContext> create_gl_context()
63  {
64  return std::unique_ptr<NullGLContext>{new NullGLContext()};
65  }
66 };
67 
68 }
69 }
70 }
71 
72 #endif /* MIR_TEST_DOUBLES_NULL_DISPLAY_H_ */
void register_configuration_change_handler(graphics::EventHandlerRegister &, graphics::DisplayConfigurationChangeHandler const &) override
Registers a handler for display configuration changes.
Definition: null_display.h:49
void for_each_display_buffer(std::function< void(graphics::DisplayBuffer &)> const &)
Definition: null_display.h:37
Interface to an output framebuffer.
Definition: display_buffer.h:39
void resume()
Resumes the display.
Definition: null_display.h:60
void configure(graphics::DisplayConfiguration const &)
Sets a new output configuration.
Definition: null_display.h:48
std::unique_ptr< graphics::DisplayConfiguration > configuration() const override
Gets a copy of the current output configuration.
Definition: null_display.h:42
void register_pause_resume_handlers(graphics::EventHandlerRegister &, graphics::DisplayPauseHandler const &, graphics::DisplayResumeHandler const &) override
Registers handlers for pausing and resuming the display subsystem.
Definition: null_display.h:54
std::weak_ptr< graphics::Cursor > the_cursor()
Gets the hardware cursor object.
Definition: null_display.h:61
Definition: null_display_configuration.h:30
std::function< bool()> DisplayResumeHandler
Definition: display.h:38
Definition: null_gl_context.h:31
std::function< bool()> DisplayPauseHandler
Definition: display.h:35
std::unique_ptr< graphics::GLContext > create_gl_context()
Creates a GLContext object that shares resources with the Display's GL context.
Definition: null_display.h:62
Definition: null_display.h:34
Interface to the display subsystem.
Definition: display.h:44
std::function< void()> DisplayConfigurationChangeHandler
Definition: display.h:39
void pause()
Pauses the display.
Definition: null_display.h:59
Interface to a configuration of display cards and outputs.
Definition: display_configuration.h:159
Definition: event_handler_register.h:31

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014