Mir
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 class ServerActionQueue;
31 
32 namespace graphics
33 {
34  class Display;
35  class DisplayConfigurationPolicy;
36 }
37 namespace compositor { class Compositor; }
38 namespace scene
39 {
40 class SessionEventHandlerRegister;
41 class SessionContainer;
42 class Session;
43 
45  public mir::DisplayChanger
46 {
47 public:
49  std::shared_ptr<graphics::Display> const& display,
50  std::shared_ptr<compositor::Compositor> const& compositor,
51  std::shared_ptr<graphics::DisplayConfigurationPolicy> const& display_configuration_policy,
52  std::shared_ptr<SessionContainer> const& session_container,
53  std::shared_ptr<SessionEventHandlerRegister> const& session_event_handler_register,
54  std::shared_ptr<ServerActionQueue> const& server_action_queue);
55 
56  /* From mir::frontend::DisplayChanger */
57  std::shared_ptr<graphics::DisplayConfiguration> active_configuration() override;
58  void configure(std::shared_ptr<frontend::Session> const& session,
59  std::shared_ptr<graphics::DisplayConfiguration> const& conf) override;
60 
61  /* From mir::DisplayChanger */
63  std::shared_ptr<graphics::DisplayConfiguration> const& conf,
64  SystemStateHandling pause_resume_system) override;
65 
66  void pause_display_config_processing() override;
67  void resume_display_config_processing() override;
68 
69 private:
70  void focus_change_handler(std::shared_ptr<Session> const& session);
71  void no_focus_handler();
72  void session_stopping_handler(std::shared_ptr<Session> const& session);
73 
74  void apply_config(std::shared_ptr<graphics::DisplayConfiguration> const& conf,
75  SystemStateHandling pause_resume_system);
76  void apply_base_config(SystemStateHandling pause_resume_system);
77  void send_config_to_all_sessions(
78  std::shared_ptr<graphics::DisplayConfiguration> const& conf);
79 
80  std::shared_ptr<graphics::Display> const display;
81  std::shared_ptr<compositor::Compositor> const compositor;
82  std::shared_ptr<graphics::DisplayConfigurationPolicy> const display_configuration_policy;
83  std::shared_ptr<SessionContainer> const session_container;
84  std::shared_ptr<SessionEventHandlerRegister> const session_event_handler_register;
85  std::shared_ptr<ServerActionQueue> const server_action_queue;
86  std::mutex configuration_mutex;
87  std::map<std::weak_ptr<frontend::Session>,
88  std::shared_ptr<graphics::DisplayConfiguration>,
89  std::owner_less<std::weak_ptr<frontend::Session>>> config_map;
90  std::weak_ptr<frontend::Session> focused_session;
91  std::shared_ptr<graphics::DisplayConfiguration> base_configuration;
92  bool base_configuration_applied;
93 };
94 
95 }
96 }
97 
98 #endif /* MIR_SCENE_MEDIATING_DISPLAY_CHANGER_H_ */
All things Mir.
Definition: buffer_stream.h:37
Definition: display_changer.h:31
void pause_display_config_processing() override
Definition: mediating_display_changer.cpp:166
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, std::shared_ptr< ServerActionQueue > const &server_action_queue)
Definition: mediating_display_changer.cpp:61
void configure_for_hardware_change(std::shared_ptr< graphics::DisplayConfiguration > const &conf, SystemStateHandling pause_resume_system) override
Definition: mediating_display_changer.cpp:140
void configure(std::shared_ptr< frontend::Session > const &session, std::shared_ptr< graphics::DisplayConfiguration > const &conf) override
Definition: mediating_display_changer.cpp:112
Definition: display_changer.h:34
void resume_display_config_processing() override
Definition: mediating_display_changer.cpp:171
Definition: mediating_display_changer.h:44
std::shared_ptr< graphics::DisplayConfiguration > active_configuration() override
Definition: mediating_display_changer.cpp:133
SystemStateHandling
Definition: display_changer.h:36

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Mar 24 16:15:19 UTC 2015