Mir
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 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: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_CLIENT_DISPLAY_CONFIGURATION_H_
20 #define MIR_CLIENT_DISPLAY_CONFIGURATION_H_
21 
23 #include "mir_protobuf.pb.h"
24 
25 #include <mutex>
26 #include <functional>
27 #include <vector>
28 #include <memory>
29 
30 namespace mir
31 {
32 namespace client
33 {
35 {
36 public:
37  DisplayOutput(size_t num_modes_, size_t num_formats);
38 
39  DisplayOutput(DisplayOutput const&) = delete;
42 };
43 
44 //convenient helper
46 
48 {
49 public:
52 
53  void set_configuration(mir::protobuf::DisplayConfiguration const& msg);
54  void update_configuration(mir::protobuf::DisplayConfiguration const& msg);
55  void set_display_change_handler(std::function<void()> const&);
56 
57  //copying to a c POD, so kinda kludgy
58  MirDisplayConfiguration* copy_to_client() const;
59  std::unique_ptr<protobuf::DisplayConfiguration> take_snapshot() const;
60 
61 private:
62  std::mutex mutable guard;
63  protobuf::DisplayConfiguration config;
64 
65  std::function<void()> notify_change;
66 };
67 
68 
69 }
70 }
71 
72 #endif /* MIR_CLIENT_DISPLAY_CONFIGURATION_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: display_configuration.h:47
Definition: client_types.h:353
~DisplayOutput()
Definition: display_configuration.cpp:63
DisplayOutput(size_t num_modes_, size_t num_formats)
Definition: display_configuration.cpp:47
Definition: client_types.h:325
Definition: display_configuration.h:34
void delete_config_storage(MirDisplayConfiguration *config)
Definition: display_configuration.cpp:26

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016