#ifndef MIR_EXAMPLE_CANONICAL_WINDOW_MANAGER_H_
#define MIR_EXAMPLE_CANONICAL_WINDOW_MANAGER_H_
#include <atomic>
{
namespace shell { class DisplayLayout; }
namespace examples
{
struct CanonicalSessionInfoCopy
{
};
struct CanonicalSurfaceInfoCopy
{
std::shared_ptr<scene::Session>
const&
session,
std::shared_ptr<scene::Surface> const& surface,
scene::SurfaceCreationParameters const& params);
std::shared_ptr<scene::Surface> const& surface,
geometry::Point& requested_pos,
geometry::Size& requested_size,
const bool left_resize,
const bool top_resize,
geometry::Rectangle const& bounds) const;
std::weak_ptr<scene::Session>
session;
std::weak_ptr<scene::Surface>
parent;
std::vector<std::weak_ptr<scene::Surface>>
children;
std::shared_ptr<scene::Surface>
titlebar;
void init_titlebar(std::shared_ptr<scene::Surface>
const& surface);
private:
struct PaintingImpl;
std::shared_ptr<PaintingImpl> painting_impl;
};
class CanonicalWindowManagerPolicyCopy
{
public:
using Tools = BasicWindowManagerToolsCopy<CanonicalSessionInfoCopy, CanonicalSurfaceInfoCopy>;
std::shared_ptr<shell::DisplayLayout> const& display_layout);
void click(geometry::Point cursor);
void resize(geometry::Point cursor);
std::shared_ptr<scene::Session> const& session,
scene::SurfaceCreationParameters const& request_parameters)
-> scene::SurfaceCreationParameters;
void handle_new_surface(std::shared_ptr<scene::Session>
const& session, std::shared_ptr<scene::Surface>
const& surface);
std::shared_ptr<scene::Session> const& session,
std::shared_ptr<scene::Surface> const& surface,
shell::SurfaceSpecification const& modifications);
void handle_delete_surface(std::shared_ptr<scene::Session>
const& session, std::weak_ptr<scene::Surface>
const& surface);
void drag(geometry::Point cursor);
std::shared_ptr<scene::Session> const& session,
std::shared_ptr<scene::Surface> const& surface,
std::function<
frontend::SurfaceId(std::shared_ptr<scene::Session>
const& session, scene::SurfaceCreationParameters
const& params)>
const& build);
private:
static const int modifier_mask =
void select_active_surface(std::shared_ptr<scene::Surface> const& surface);
auto active_surface() const -> std::shared_ptr<scene::Surface>;
bool resize(std::shared_ptr<scene::Surface>
const& surface, geometry::Point cursor, geometry::Point old_cursor, geometry::Rectangle bounds);
bool drag(std::shared_ptr<scene::Surface> surface, geometry::Point to, geometry::Point from, geometry::Rectangle bounds);
void move_tree(std::shared_ptr<scene::Surface> const& root, geometry::Displacement movement) const;
void raise_tree(std::shared_ptr<scene::Surface> const& root) const;
void apply_resize(
std::shared_ptr<mir::scene::Surface> const& surface,
std::shared_ptr<mir::scene::Surface> const& titlebar,
geometry::Point const& new_pos,
geometry::Size const& new_size) const;
std::shared_ptr<shell::DisplayLayout> const display_layout;
geometry::Rectangle display_area;
geometry::Point old_cursor{};
std::weak_ptr<scene::Surface> active_surface_;
};
}
}
#endif