Mir
focus_controller.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: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_SHELL_FOCUS_CONTROLLER_H_
20 #define MIR_SHELL_FOCUS_CONTROLLER_H_
21 
22 #include <memory>
23 #include <set>
24 
25 namespace mir
26 {
27 namespace geometry { struct Point; }
28 namespace scene { class Session; class Surface; }
29 
30 namespace shell
31 {
32 using SurfaceSet = std::set<std::weak_ptr<scene::Surface>, std::owner_less<std::weak_ptr<scene::Surface>>>;
33 
34 // TODO I don't think this interface serves a meaningful purpose
35 // TODO (It is referenced by a couple of example WindowManagers, and
36 // TODO to get the active session in unity-system-compositor.)
37 // TODO I think there's a better approach possible.
39 {
40 public:
41  virtual ~FocusController() = default;
42 
43  virtual void focus_next_session() = 0;
44 
45  virtual auto focused_session() const -> std::shared_ptr<scene::Session> = 0;
46 
47  virtual void set_focus_to(
48  std::shared_ptr<scene::Session> const& focus_session,
49  std::shared_ptr<scene::Surface> const& focus_surface) = 0;
50 
51  virtual std::shared_ptr<scene::Surface> focused_surface() const = 0;
52 
53  virtual auto surface_at(geometry::Point cursor) const -> std::shared_ptr<scene::Surface> = 0;
54 
55  virtual void raise(SurfaceSet const& surfaces) = 0;
56 
57 protected:
58  FocusController() = default;
59  FocusController(FocusController const&) = delete;
60  FocusController& operator=(FocusController const&) = delete;
61 };
62 
63 }
64 } // namespace mir
65 
66 #endif // MIR_SHELL_FOCUS_CONTROLLER_H_
All things Mir.
Definition: atomic_callback.h:25
Definition: point.h:30
std::set< std::weak_ptr< scene::Surface >, std::owner_less< std::weak_ptr< scene::Surface >>> SurfaceSet
Definition: focus_controller.h:32
Definition: focus_controller.h:38

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016