Mir
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 2 or 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 "mir/graphics/virtual_output.h"
28 
29 namespace mir
30 {
31 namespace test
32 {
33 namespace doubles
34 {
35 
36 class NullDisplay : public graphics::Display,
37  public graphics::NativeDisplay,
39 {
40  public:
41  void for_each_display_sync_group(std::function<void(graphics::DisplaySyncGroup&)> const& f) override
42  {
43  f(group);
44  }
45  std::unique_ptr<graphics::DisplayConfiguration> configuration() const override
46  {
47  return std::unique_ptr<graphics::DisplayConfiguration>(
49  );
50  }
51  bool apply_if_configuration_preserves_display_buffers(graphics::DisplayConfiguration const&) override
52  {
53  return false;
54  }
55  void configure(graphics::DisplayConfiguration const&) override{}
57  graphics::EventHandlerRegister&,
58  graphics::DisplayConfigurationChangeHandler const&) override
59  {
60  }
61  void register_pause_resume_handlers(graphics::EventHandlerRegister&,
62  graphics::DisplayPauseHandler const&,
63  graphics::DisplayResumeHandler const&) override
64  {
65  }
66  void pause() override{}
67  void resume() override {}
68 
69  std::shared_ptr<graphics::Cursor> create_hardware_cursor() override
70  {
71  return {};
72  }
73  std::unique_ptr<graphics::VirtualOutput> create_virtual_output(int /*width*/, int /*height*/) override
74  {
75  return nullptr;
76  }
77  graphics::NativeDisplay* native_display() override
78  {
79  return this;
80  }
81  std::unique_ptr<renderer::gl::Context> create_gl_context() override
82  {
83  return std::unique_ptr<NullGLContext>{new NullGLContext()};
84  }
85  graphics::Frame last_frame_on(unsigned) const override
86  {
87  return {};
88  }
90 };
91 
92 }
93 }
94 }
95 
96 #endif /* MIR_TEST_DOUBLES_NULL_DISPLAY_H_ */
Definition: null_display_sync_group.h:68
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: sw_splash.h:26
void register_configuration_change_handler(graphics::EventHandlerRegister &, graphics::DisplayConfigurationChangeHandler const &) override
Definition: null_display.h:56
std::unique_ptr< renderer::gl::Context > create_gl_context() override
Definition: null_display.h:81
std::unique_ptr< graphics::VirtualOutput > create_virtual_output(int, int) override
Definition: null_display.h:73
std::unique_ptr< graphics::DisplayConfiguration > configuration() const override
Definition: null_display.h:45
void register_pause_resume_handlers(graphics::EventHandlerRegister &, graphics::DisplayPauseHandler const &, graphics::DisplayResumeHandler const &) override
Definition: null_display.h:61
Definition: null_display_configuration.h:30
Definition: null_gl_context.h:31
void configure(graphics::DisplayConfiguration const &) override
Definition: null_display.h:55
void resume() override
Definition: null_display.h:67
void pause() override
Definition: null_display.h:66
std::shared_ptr< graphics::Cursor > create_hardware_cursor() override
Definition: null_display.h:69
graphics::Frame last_frame_on(unsigned) const override
Definition: null_display.h:85
graphics::NativeDisplay * native_display() override
Definition: null_display.h:77
bool apply_if_configuration_preserves_display_buffers(graphics::DisplayConfiguration const &) override
Definition: null_display.h:51
Definition: null_display.h:36
void for_each_display_sync_group(std::function< void(graphics::DisplaySyncGroup &)> const &f) override
Definition: null_display.h:41
Definition: context_source.h:32
NullDisplaySyncGroup group
Definition: null_display.h:89

Copyright © 2012-2018 Canonical Ltd.
Generated on Mon Feb 19 14:06:43 UTC 2018