Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mediating_display_changer.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: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_SCENE_MEDIATING_DISPLAY_CHANGER_H_
20 #define MIR_SCENE_MEDIATING_DISPLAY_CHANGER_H_
21 
23 #include "mir/display_changer.h"
24 
25 #include <mutex>
26 #include <map>
27 
28 namespace mir
29 {
30 
31 namespace graphics
32 {
33  class Display;
34  class DisplayConfigurationPolicy;
35 }
36 namespace compositor { class Compositor; }
37 namespace scene
38 {
39 class SessionEventHandlerRegister;
40 class SessionContainer;
41 
43  public mir::DisplayChanger
44 {
45 public:
47  std::shared_ptr<graphics::Display> const& display,
48  std::shared_ptr<compositor::Compositor> const& compositor,
49  std::shared_ptr<graphics::DisplayConfigurationPolicy> const& display_configuration_policy,
50  std::shared_ptr<SessionContainer> const& session_container,
51  std::shared_ptr<SessionEventHandlerRegister> const& session_event_handler_register);
52 
53  /* From mir::frontend::DisplayChanger */
54  std::shared_ptr<graphics::DisplayConfiguration> active_configuration();
55  void configure(std::shared_ptr<frontend::Session> const& session,
56  std::shared_ptr<graphics::DisplayConfiguration> const& conf);
57 
58  /* From mir::DisplayChanger */
60  std::shared_ptr<graphics::DisplayConfiguration> const& conf,
61  SystemStateHandling pause_resume_system);
62 
63 private:
64  void apply_config(std::shared_ptr<graphics::DisplayConfiguration> const& conf,
65  SystemStateHandling pause_resume_system);
66  void apply_base_config(SystemStateHandling pause_resume_system);
67  void send_config_to_all_sessions(
68  std::shared_ptr<graphics::DisplayConfiguration> const& conf);
69 
70  std::shared_ptr<graphics::Display> const display;
71  std::shared_ptr<compositor::Compositor> const compositor;
72  std::shared_ptr<graphics::DisplayConfigurationPolicy> const display_configuration_policy;
73  std::shared_ptr<SessionContainer> const session_container;
74  std::shared_ptr<SessionEventHandlerRegister> const session_event_handler_register;
75  std::mutex configuration_mutex;
76  std::map<std::weak_ptr<frontend::Session>,
77  std::shared_ptr<graphics::DisplayConfiguration>,
78  std::owner_less<std::weak_ptr<frontend::Session>>> config_map;
79  std::weak_ptr<frontend::Session> focused_session;
80  std::shared_ptr<graphics::DisplayConfiguration> base_configuration;
81  bool base_configuration_applied;
82 };
83 
84 }
85 }
86 
87 #endif /* MIR_SCENE_MEDIATING_DISPLAY_CHANGER_H_ */
void configure(std::shared_ptr< frontend::Session > const &session, std::shared_ptr< graphics::DisplayConfiguration > const &conf)
Definition: mediating_display_changer.cpp:120
Definition: display_changer.h:31
std::shared_ptr< graphics::DisplayConfiguration > active_configuration()
Definition: mediating_display_changer.cpp:136
MediatingDisplayChanger(std::shared_ptr< graphics::Display > const &display, std::shared_ptr< compositor::Compositor > const &compositor, std::shared_ptr< graphics::DisplayConfigurationPolicy > const &display_configuration_policy, std::shared_ptr< SessionContainer > const &session_container, std::shared_ptr< SessionEventHandlerRegister > const &session_event_handler_register)
Definition: mediating_display_changer.cpp:61
void configure_for_hardware_change(std::shared_ptr< graphics::DisplayConfiguration > const &conf, SystemStateHandling pause_resume_system)
Definition: mediating_display_changer.cpp:143
Definition: display_changer.h:34
Definition: mediating_display_changer.h:42
SystemStateHandling
Definition: display_changer.h:36

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