Mir
abstract_shell.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 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: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_SHELL_ABSTRACT_SHELL_H_
20 #define MIR_SHELL_ABSTRACT_SHELL_H_
21 
22 #include "mir/shell/shell.h"
23 
24 #include <mutex>
25 
26 namespace mir
27 {
28 namespace shell
29 {
31 class AbstractShell : public virtual Shell
32 {
33 public:
35  std::shared_ptr<InputTargeter> const& input_targeter,
36  std::shared_ptr<scene::SurfaceCoordinator> const& surface_coordinator,
37  std::shared_ptr<scene::SessionCoordinator> const& session_coordinator,
38  std::shared_ptr<scene::PromptSessionManager> const& prompt_session_manager);
39 
40  ~AbstractShell() noexcept;
41 
42  std::shared_ptr<scene::Session> open_session(
43  pid_t client_pid,
44  std::string const& name,
45  std::shared_ptr<frontend::EventSink> const& sink) override;
46 
47  void close_session(std::shared_ptr<scene::Session> const& session) override;
48 
49  frontend::SurfaceId create_surface(std::shared_ptr<scene::Session> const& session, scene::SurfaceCreationParameters const& params) override;
50 
51  void destroy_surface(std::shared_ptr<scene::Session> const& session, frontend::SurfaceId surface) override;
52 
53  void handle_surface_created(std::shared_ptr<scene::Session> const& session) override;
54 
56  std::shared_ptr<scene::Session> const& session,
57  std::shared_ptr<scene::Surface> const& surface,
58  MirSurfaceAttrib attrib,
59  int value) override;
60 
62  std::shared_ptr<scene::Surface> const& surface,
63  MirSurfaceAttrib attrib) override;
64 
65  std::shared_ptr<scene::PromptSession> start_prompt_session_for(
66  std::shared_ptr<scene::Session> const& session,
67  scene::PromptSessionCreationParameters const& params) override;
68 
70  std::shared_ptr<scene::PromptSession> const& prompt_session,
71  std::shared_ptr<scene::Session> const& session) override;
72 
73  void stop_prompt_session(std::shared_ptr<scene::PromptSession> const& prompt_session) override;
74 
83  void focus_next() override;
84 
85  std::weak_ptr<scene::Session> focussed_application() const override;
86 
87  void set_focus_to(std::shared_ptr<scene::Session> const& focus) override;
90 protected:
91  std::shared_ptr<InputTargeter> const input_targeter;
92  std::shared_ptr<scene::SurfaceCoordinator> const surface_coordinator;
93  std::shared_ptr<scene::SessionCoordinator> const session_coordinator;
94  std::shared_ptr<scene::PromptSessionManager> const prompt_session_manager;
95 
96 private:
102  virtual void setting_focus_to(std::shared_ptr<scene::Surface> const& next_focus);
103  virtual void setting_focus_to(std::shared_ptr<scene::Session> const& next_focus);
106  std::mutex mutable focus_mutex;
107  std::weak_ptr<scene::Surface> focus_surface;
108  std::weak_ptr<scene::Session> focus_session;
109 
110  void set_focus_to_locked(std::unique_lock<std::mutex> const& lock, std::shared_ptr<scene::Surface> const& next_focus);
111  void set_focus_to_locked(std::unique_lock<std::mutex> const& lock, std::shared_ptr<scene::Session> const& next_focus);
112 };
113 }
114 }
115 
116 #endif /* MIR_SHELL_ABSTRACT_SHELL_H_ */
Definition: shell.h:47
All things Mir.
Definition: buffer_stream.h:37
void add_prompt_provider_for(std::shared_ptr< scene::PromptSession > const &prompt_session, std::shared_ptr< scene::Session > const &session) override
Definition: abstract_shell.cpp:89
~AbstractShell() noexcept
Definition: abstract_shell.cpp:44
std::shared_ptr< scene::SurfaceCoordinator > const surface_coordinator
Definition: abstract_shell.h:92
void close_session(std::shared_ptr< scene::Session > const &session) override
Definition: abstract_shell.cpp:56
int set_surface_attribute(std::shared_ptr< scene::Session > const &session, std::shared_ptr< scene::Surface > const &surface, MirSurfaceAttrib attrib, int value) override
Definition: abstract_shell.cpp:102
std::shared_ptr< scene::SessionCoordinator > const session_coordinator
Definition: abstract_shell.h:93
std::shared_ptr< InputTargeter > const input_targeter
Definition: abstract_shell.h:91
int get_surface_attribute(std::shared_ptr< scene::Surface > const &surface, MirSurfaceAttrib attrib) override
Definition: abstract_shell.cpp:111
frontend::SurfaceId create_surface(std::shared_ptr< scene::Session > const &session, scene::SurfaceCreationParameters const &params) override
Definition: abstract_shell.cpp:63
AbstractShell(std::shared_ptr< InputTargeter > const &input_targeter, std::shared_ptr< scene::SurfaceCoordinator > const &surface_coordinator, std::shared_ptr< scene::SessionCoordinator > const &session_coordinator, std::shared_ptr< scene::PromptSessionManager > const &prompt_session_manager)
Definition: abstract_shell.cpp:32
void stop_prompt_session(std::shared_ptr< scene::PromptSession > const &prompt_session) override
Definition: abstract_shell.cpp:96
MirSurfaceAttrib
Attributes of a surface that the client and server/shell may wish to get or set over the wire...
Definition: common.h:36
Definition: int_wrapper.h:27
void set_focus_to(std::shared_ptr< scene::Session > const &focus) override
Definition: abstract_shell.cpp:135
Definition: surface_creation_parameters.h:41
std::shared_ptr< scene::PromptSession > start_prompt_session_for(std::shared_ptr< scene::Session > const &session, scene::PromptSessionCreationParameters const &params) override
Definition: abstract_shell.cpp:82
std::shared_ptr< scene::PromptSessionManager > const prompt_session_manager
Definition: abstract_shell.h:94
Definition: prompt_session_creation_parameters.h:29
void destroy_surface(std::shared_ptr< scene::Session > const &session, frontend::SurfaceId surface) override
Definition: abstract_shell.cpp:70
Minimal Shell implementation with none of the necessary window management logic.
Definition: abstract_shell.h:31
void handle_surface_created(std::shared_ptr< scene::Session > const &session) override
Definition: abstract_shell.cpp:77
std::shared_ptr< scene::Session > open_session(pid_t client_pid, std::string const &name, std::shared_ptr< frontend::EventSink > const &sink) override
Definition: abstract_shell.cpp:48
void focus_next() override
Definition: abstract_shell.cpp:119
std::weak_ptr< scene::Session > focussed_application() const override
Definition: abstract_shell.cpp:129

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