Mir
fake_display.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 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: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_TEST_DOUBLES_FAKE_DISPLAY_H_
20 #define MIR_TEST_DOUBLES_FAKE_DISPLAY_H_
21 
23 #include "mir/fd.h"
24 
25 #include "mir/geometry/rectangle.h"
26 
27 #include <atomic>
28 #include <mutex>
29 #include <vector>
30 
31 namespace mir
32 {
33 namespace test
34 {
35 namespace doubles
36 {
37 class StubDisplayConfig;
38 class FakeDisplay : public NullDisplay
39 {
40 public:
41  FakeDisplay();
42 
43  explicit FakeDisplay(std::vector<geometry::Rectangle> const& output_rects);
44 
45  void for_each_display_sync_group(std::function<void(mir::graphics::DisplaySyncGroup&)> const& f) override;
46 
47  std::unique_ptr<mir::graphics::DisplayConfiguration> configuration() const override;
48 
50  mir::graphics::EventHandlerRegister& handlers,
51  mir::graphics::DisplayConfigurationChangeHandler const& handler) override;
52 
53  bool apply_if_configuration_preserves_display_buffers(graphics::DisplayConfiguration const&) override;
54  void configure(mir::graphics::DisplayConfiguration const&) override;
55 
57  std::shared_ptr<mir::graphics::DisplayConfiguration> const& new_config);
58 
60 
61 private:
62  std::shared_ptr<StubDisplayConfig> config;
63  std::vector<std::unique_ptr<StubDisplaySyncGroup>> groups;
64  Fd const wakeup_trigger;
65  std::atomic<bool> handler_called;
66  std::mutex mutable configuration_mutex;
67 };
68 }
69 }
70 }
71 
72 #endif //MIR_TEST_DOUBLES_FAKE_DISPLAY_H_
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: sw_splash.h:26
void for_each_display_sync_group(std::function< void(mir::graphics::DisplaySyncGroup &)> const &f) override
Definition: fd.h:33
std::unique_ptr< mir::graphics::DisplayConfiguration > configuration() const override
void configure(mir::graphics::DisplayConfiguration const &) override
void emit_configuration_change_event(std::shared_ptr< mir::graphics::DisplayConfiguration > const &new_config)
Definition: stub_display_configuration.h:66
void register_configuration_change_handler(mir::graphics::EventHandlerRegister &handlers, mir::graphics::DisplayConfigurationChangeHandler const &handler) override
Definition: null_display.h:36
Definition: fake_display.h:38
bool apply_if_configuration_preserves_display_buffers(graphics::DisplayConfiguration const &) override

Copyright © 2012-2017 Canonical Ltd.
Generated on Mon Oct 30 19:44:55 UTC 2017