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"
25 #include "mir/input/input_region.h"
26 
27 #include <mutex>
28 #include <map>
29 
30 namespace mir
31 {
32 class ServerActionQueue;
33 
34 namespace graphics
35 {
36  class Display;
37  class DisplayConfigurationPolicy;
38  class DisplayConfigurationReport;
39 }
40 namespace compositor { class Compositor; }
41 namespace input
42 {
43 class InputRegion;
44 }
45 namespace scene
46 {
47 class SessionEventHandlerRegister;
48 class SessionContainer;
49 class Session;
50 
52  public mir::DisplayChanger,
54 {
55 public:
57  std::shared_ptr<graphics::Display> const& display,
58  std::shared_ptr<compositor::Compositor> const& compositor,
59  std::shared_ptr<graphics::DisplayConfigurationPolicy> const& display_configuration_policy,
60  std::shared_ptr<SessionContainer> const& session_container,
61  std::shared_ptr<SessionEventHandlerRegister> const& session_event_handler_register,
62  std::shared_ptr<ServerActionQueue> const& server_action_queue,
63  std::shared_ptr<graphics::DisplayConfigurationReport> const& report,
64  std::shared_ptr<input::InputRegion> const& region);
65 
66  /* From mir::frontend::DisplayChanger */
67  std::shared_ptr<graphics::DisplayConfiguration> base_configuration() override;
68  void configure(std::shared_ptr<frontend::Session> const& session,
69  std::shared_ptr<graphics::DisplayConfiguration> const& conf) override;
70 
71  /* From mir::DisplayChanger */
72  void configure_for_hardware_change(
73  std::shared_ptr<graphics::DisplayConfiguration> const& conf,
74  SystemStateHandling pause_resume_system) override;
75 
76  void pause_display_config_processing() override;
77  void resume_display_config_processing() override;
78 
79  /* From shell::DisplayConfigurationController */
80  void set_base_configuration(std::shared_ptr<graphics::DisplayConfiguration> const &conf) override;
81 
82 private:
83  void focus_change_handler(std::shared_ptr<Session> const& session);
84  void no_focus_handler();
85  void session_stopping_handler(std::shared_ptr<Session> const& session);
86 
87  void apply_config(std::shared_ptr<graphics::DisplayConfiguration> const& conf,
88  SystemStateHandling pause_resume_system);
89  void apply_base_config(SystemStateHandling pause_resume_system);
90  void send_config_to_all_sessions(
91  std::shared_ptr<graphics::DisplayConfiguration> const& conf);
92  void update_input_rectangles(graphics::DisplayConfiguration const& conf);
93 
94  std::shared_ptr<graphics::Display> const display;
95  std::shared_ptr<compositor::Compositor> const compositor;
96  std::shared_ptr<graphics::DisplayConfigurationPolicy> const display_configuration_policy;
97  std::shared_ptr<SessionContainer> const session_container;
98  std::shared_ptr<SessionEventHandlerRegister> const session_event_handler_register;
99  std::shared_ptr<ServerActionQueue> const server_action_queue;
100  std::shared_ptr<graphics::DisplayConfigurationReport> const report;
101  std::mutex configuration_mutex;
102  std::map<std::weak_ptr<frontend::Session>,
103  std::shared_ptr<graphics::DisplayConfiguration>,
104  std::owner_less<std::weak_ptr<frontend::Session>>> config_map;
105  std::weak_ptr<frontend::Session> focused_session;
106  std::shared_ptr<graphics::DisplayConfiguration> base_configuration_;
107  bool base_configuration_applied;
108  std::shared_ptr<input::InputRegion> const region;
109 };
110 
111 }
112 }
113 
114 #endif /* MIR_SCENE_MEDIATING_DISPLAY_CHANGER_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: display_changer.h:31
Definition: display_changer.h:35
Definition: mediating_display_changer.h:51
SystemStateHandling
Definition: display_changer.h:36
Definition: display_configuration_controller.h:33
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