2
* Copyright (C) 2016 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License version 3, as published by
6
* the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
#ifndef WINDOWMANAGEMENTPOLICY_H
18
#define WINDOWMANAGEMENTPOLICY_H
20
#include "miral/canonical_window_manager.h"
22
#include "qteventfeeder.h"
23
#include "windowcontroller.h"
24
#include "windowmodelnotifier.h"
26
#include <QScopedPointer>
29
using namespace mir::geometry;
33
class WindowManagementPolicy : public miral::CanonicalWindowManagerPolicy
36
WindowManagementPolicy(const miral::WindowManagerTools &tools,
37
qtmir::WindowModelNotifier &windowModel,
38
qtmir::WindowController &windowController,
39
const QSharedPointer<ScreensModel> screensModel);
41
// From WindowManagementPolicy
42
auto place_new_surface(const miral::ApplicationInfo &app_info,
43
const miral::WindowSpecification &request_parameters)
44
-> miral::WindowSpecification override;
46
void handle_window_ready(miral::WindowInfo &windowInfo) override;
47
void handle_modify_window(
48
miral::WindowInfo &windowInfo,
49
const miral::WindowSpecification &modifications) override;
50
void handle_raise_window(miral::WindowInfo &windowInfo) override;
52
bool handle_keyboard_event(const MirKeyboardEvent *event) override;
53
bool handle_touch_event(const MirTouchEvent *event) override;
54
bool handle_pointer_event(const MirPointerEvent *event) override;
56
void advise_begin() override;
57
void advise_end() override;
59
void advise_new_app(miral::ApplicationInfo &application) override;
60
void advise_delete_app(const miral::ApplicationInfo &application) override;
62
void advise_new_window(const miral::WindowInfo &windowInfo) override;
63
void advise_focus_lost(const miral::WindowInfo &info) override;
64
void advise_focus_gained(const miral::WindowInfo &info) override;
65
void advise_state_change(const miral::WindowInfo &info, MirSurfaceState state) override;
66
void advise_move_to(const miral::WindowInfo &windowInfo, Point topLeft) override;
67
void advise_resize(const miral::WindowInfo &info, const Size &newSize) override;
68
void advise_delete_window(const miral::WindowInfo &windowInfo) override;
69
void advise_raise(const std::vector<miral::Window> &windows) override;
71
// Methods for consumption by WindowControllerInterface
72
void deliver_keyboard_event(const MirKeyboardEvent *event, const miral::Window &window);
73
void deliver_touch_event (const MirTouchEvent *event, const miral::Window &window);
74
void deliver_pointer_event (const MirPointerEvent *event, const miral::Window &window);
76
void focus (const miral::Window &window);
77
void resize(const miral::Window &window, const Size size);
78
void move (const miral::Window &window, const Point topLeft);
80
void ask_client_to_close(const miral::Window &window);
85
miral::WindowManagerTools m_tools;
86
qtmir::WindowModelNotifier &m_windowModel;
87
const QScopedPointer<QtEventFeeder> m_eventFeeder;
90
#endif // WINDOWMANAGEMENTPOLICY_H