Mir
nested_display_configuration.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: Eleni Maria Stea <elenimaria.stea@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_NESTED_NESTED_DISPLAY_CONFIGURATION_H_
20 #define MIR_GRAPHICS_NESTED_NESTED_DISPLAY_CONFIGURATION_H_
21 
24 #include <memory>
25 #include <mutex>
26 #include <unordered_map>
27 
28 namespace mir
29 {
30 namespace graphics
31 {
32 namespace nested
33 {
35 {
36 public:
38  std::shared_ptr<MirDisplayConfiguration> const& display_config);
40 
41  void for_each_card(std::function<void(DisplayConfigurationCard const&)>) const override;
42  void for_each_output(std::function<void(DisplayConfigurationOutput const&)>) const override;
43  void for_each_output(std::function<void(UserDisplayConfigurationOutput&)>) override;
44  std::unique_ptr<DisplayConfiguration> clone() const override;
45 
46  operator MirDisplayConfiguration*() const { return display_config.get(); }
47 
48 private:
49  std::shared_ptr<MirDisplayConfiguration> display_config;
50 
51  /*
52  * The client display config doesn't currently expose the form factor or scaling factor, nor is it
53  * entirely clear that it should allow a client to set them.
54  *
55  * We therefore need to store these explicitly in the NestedConfiguration.
56  */
57  std::mutex mutable local_config_mutex;
58  struct LocalOutputConfig
59  {
60  float scale;
61  MirFormFactor form_factor;
62  };
63  std::unordered_map<uint32_t, LocalOutputConfig> mutable local_config;
64 
65  LocalOutputConfig get_local_config_for(uint32_t output_id) const;
66  void set_local_config_for(uint32_t output_id, LocalOutputConfig const& config);
67 };
68 
69 }
70 }
71 }
72 
73 #endif // MIR_GRAPHICS_NESTED_NESTED_DISPLAY_CONFIGURATION_H_
Mirror of a DisplayConfigurationOutput, with some fields limited to being read-only, preventing users from changing things they shouldn&#39;t.
Definition: display_configuration.h:129
All things Mir.
Definition: atomic_callback.h:25
Definition: client_types.h:347
Configuration information for a display card.
Definition: display_configuration.h:44
Definition: nested_display_configuration.h:34
NestedDisplayConfiguration(std::shared_ptr< MirDisplayConfiguration > const &display_config)
void for_each_card(std::function< void(DisplayConfigurationCard const &)>) const override
Executes a function object for each card in the configuration.
std::unique_ptr< DisplayConfiguration > clone() const override
MirFormFactor
Form factor associated with a physical output.
Definition: common.h:197
Configuration information for a display output.
Definition: display_configuration.h:84
void for_each_output(std::function< void(DisplayConfigurationOutput const &)>) const override
Executes a function object for each output in the configuration.
Interface to a configuration of display cards and outputs.
Definition: display_configuration.h:167

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