Mir
server_example_window_management_info.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_SERVER_EXAMPLE_WINDOW_MANAGEMENT_INFO_H
20 #define MIR_SERVER_EXAMPLE_WINDOW_MANAGEMENT_INFO_H
21 
23 #include "mir/optional_value.h"
25 
26 #include <vector>
27 
28 namespace mir
29 {
30 namespace scene { class Session; class Surface; class SurfaceCreationParameters; }
31 namespace examples
32 {
34 {
36  std::shared_ptr <scene::Session> const& session,
37  std::shared_ptr <scene::Surface> const& surface,
38  scene::SurfaceCreationParameters const& params);
39 
40  bool can_be_active() const;
41 
42  bool can_morph_to(MirWindowType new_type) const;
43 
44  bool must_have_parent() const;
45 
46  bool must_not_have_parent() const;
47 
48  bool is_visible() const;
49 
50  static bool needs_titlebar(MirWindowType type);
51 
52  void constrain_resize(
53  std::shared_ptr <scene::Surface> const& surface,
54  geometry::Point& requested_pos,
55  geometry::Size& requested_size,
56  const bool left_resize,
57  const bool top_resize,
58  geometry::Rectangle const& bounds) const;
59 
63  std::weak_ptr <scene::Session> session;
64  std::weak_ptr <scene::Surface> parent;
65  std::vector <std::weak_ptr<scene::Surface>> children;
66  std::shared_ptr <scene::Surface> titlebar;
69  bool is_titlebar = false;
79 
80  void init_titlebar(
81  std::shared_ptr<scene::Session> const& session,
82  std::shared_ptr<scene::Surface> const& surface);
83 
84  void paint_titlebar(int intensity);
85 
86 private:
87 
88  struct StreamPainter;
89  struct AllocatingPainter;
90 
91  std::shared_ptr <StreamPainter> stream_painter;
92 };
93 
95 {
96  std::vector<std::weak_ptr<scene::Surface>> surfaces;
97 
98  // This is only used by the TilingWindowManagerPolicy,
99  // perhaps we need a more extensible mechanism. (std::experimental::any?)
101 };
102 }
103 }
104 
105 #endif //MIR_SERVER_EXAMPLE_WINDOW_MANAGEMENT_INFO_H
Definition: size.h:30
MirWindowType type
Definition: server_example_window_management_info.h:60
Definition: as_render_target.h:27
std::weak_ptr< scene::Session > session
Definition: server_example_window_management_info.h:63
mir::optional_value< shell::SurfaceAspectRatio > min_aspect
Definition: server_example_window_management_info.h:76
geometry::Height max_height
Definition: server_example_window_management_info.h:73
mir::optional_value< geometry::DeltaX > width_inc
Definition: server_example_window_management_info.h:74
Definition: point.h:30
std::shared_ptr< scene::Surface > titlebar
Definition: server_example_window_management_info.h:66
frontend::BufferStreamId titlebar_stream_id
Definition: server_example_window_management_info.h:68
std::vector< std::weak_ptr< scene::Surface > > surfaces
Definition: server_example_window_management_info.h:96
Definition: session.h:37
geometry::Width min_width
Definition: server_example_window_management_info.h:70
std::weak_ptr< scene::Surface > parent
Definition: server_example_window_management_info.h:64
mir::optional_value< shell::SurfaceAspectRatio > max_aspect
Definition: server_example_window_management_info.h:77
geometry::Rectangle tile
Definition: server_example_window_management_info.h:100
MirWindowType
Definition: common.h:109
std::vector< std::weak_ptr< scene::Surface > > children
Definition: server_example_window_management_info.h:65
mir::optional_value< geometry::DeltaY > height_inc
Definition: server_example_window_management_info.h:75
geometry::Rectangle restore_rect
Definition: server_example_window_management_info.h:62
mir::optional_value< graphics::DisplayConfigurationOutputId > output_id
Definition: server_example_window_management_info.h:78
Definition: surface_creation_parameters.h:41
Definition: rectangle.h:33
Definition: server_example_window_management_info.h:94
MirWindowState
Definition: common.h:139
Definition: surface.h:49
Definition: server_example_window_management_info.h:33
geometry::Height min_height
Definition: server_example_window_management_info.h:71
frontend::SurfaceId titlebar_id
Definition: server_example_window_management_info.h:67
geometry::Width max_width
Definition: server_example_window_management_info.h:72
MirWindowState state
Definition: server_example_window_management_info.h:61

Copyright © 2012-2016 Canonical Ltd.
Generated on Mon Jun 5 13:49:26 UTC 2017