2
* Copyright © 2015 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Alan Griffiths <alan@octopull.co.uk>
19
#ifndef MIR_SERVER_EXAMPLE_WINDOW_MANAGEMENT_INFO_H
20
#define MIR_SERVER_EXAMPLE_WINDOW_MANAGEMENT_INFO_H
22
#include "mir/geometry/rectangles.h"
23
#include "mir/optional_value.h"
24
#include "mir/shell/surface_specification.h"
30
namespace scene { class Session; class Surface; class SurfaceCreationParameters; }
36
std::shared_ptr <scene::Session> const& session,
37
std::shared_ptr <scene::Surface> const& surface,
38
scene::SurfaceCreationParameters const& params);
40
bool can_be_active() const;
42
bool can_morph_to(MirWindowType new_type) const;
44
bool must_have_parent() const;
46
bool must_not_have_parent() const;
48
bool is_visible() const;
50
static bool needs_titlebar(MirWindowType type);
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;
62
geometry::Rectangle restore_rect;
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;
67
frontend::SurfaceId titlebar_id;
68
frontend::BufferStreamId titlebar_stream_id;
69
bool is_titlebar = false;
70
geometry::Width min_width;
71
geometry::Height min_height;
72
geometry::Width max_width;
73
geometry::Height max_height;
74
mir::optional_value<geometry::DeltaX> width_inc;
75
mir::optional_value<geometry::DeltaY> height_inc;
76
mir::optional_value<shell::SurfaceAspectRatio> min_aspect;
77
mir::optional_value<shell::SurfaceAspectRatio> max_aspect;
78
mir::optional_value<graphics::DisplayConfigurationOutputId> output_id;
81
std::shared_ptr<scene::Session> const& session,
82
std::shared_ptr<scene::Surface> const& surface);
84
void paint_titlebar(int intensity);
89
struct AllocatingPainter;
91
std::shared_ptr <StreamPainter> stream_painter;
96
std::vector<std::weak_ptr<scene::Surface>> surfaces;
98
// This is only used by the TilingWindowManagerPolicy,
99
// perhaps we need a more extensible mechanism. (std::experimental::any?)
100
geometry::Rectangle tile;
105
#endif //MIR_SERVER_EXAMPLE_WINDOW_MANAGEMENT_INFO_H