1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
/*
* Copyright © 2015 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License version 3, as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mirwindowmanager.h"
#include "logging.h"
#include "tracepoints.h" // generated from tracepoints.tp
#include <mir/geometry/rectangle.h>
#include <mir/scene/session.h>
#include <mir/scene/surface_creation_parameters.h>
#include <mir/scene/surface.h>
#include <mir/shell/display_layout.h>
namespace ms = mir::scene;
MirWindowManager::MirWindowManager(const std::shared_ptr<mir::shell::DisplayLayout> &displayLayout) :
m_displayLayout{displayLayout}
{
qCDebug(QTMIR_MIR_MESSAGES) << "MirWindowManager::MirWindowManager";
}
void MirWindowManager::add_session(std::shared_ptr<ms::Session> const& /*session*/)
{
}
void MirWindowManager::remove_session(std::shared_ptr<ms::Session> const& /*session*/)
{
}
auto MirWindowManager::add_surface(
std::shared_ptr<ms::Session> const& session,
ms::SurfaceCreationParameters const& requestParameters,
std::function<mir::frontend::SurfaceId(std::shared_ptr<ms::Session> const& session, ms::SurfaceCreationParameters const& params)> const& build)
-> mir::frontend::SurfaceId
{
tracepoint(qtmirserver, surfacePlacementStart);
// TODO: Callback unity8 so that it can make a decision on that.
// unity8 must bear in mind that the called function will be on a Mir thread though.
// The QPA shouldn't be deciding for itself on such things.
ms::SurfaceCreationParameters placedParameters = requestParameters;
// Just make it fullscreen for now
mir::geometry::Rectangle rect{requestParameters.top_left, requestParameters.size};
m_displayLayout->size_to_output(rect);
placedParameters.size = rect.size;
qCDebug(QTMIR_MIR_MESSAGES) << "MirWindowManager::add_surface(): size requested ("
<< requestParameters.size.width.as_int() << "," << requestParameters.size.height.as_int() << ") and placed ("
<< placedParameters.size.width.as_int() << "," << placedParameters.size.height.as_int() << ")";
tracepoint(qtmirserver, surfacePlacementEnd);
return build(session, placedParameters);
}
void MirWindowManager::remove_surface(
std::shared_ptr<ms::Session> const& /*session*/,
std::weak_ptr<ms::Surface> const& /*surface*/)
{
}
void MirWindowManager::add_display(mir::geometry::Rectangle const& /*area*/)
{
}
void MirWindowManager::remove_display(mir::geometry::Rectangle const& /*area*/)
{
}
bool MirWindowManager::handle_keyboard_event(MirKeyboardEvent const* /*event*/)
{
return false;
}
bool MirWindowManager::handle_touch_event(MirTouchEvent const* /*event*/)
{
return false;
}
bool MirWindowManager::handle_pointer_event(MirPointerEvent const* /*event*/)
{
return false;
}
int MirWindowManager::set_surface_attribute(
std::shared_ptr<ms::Session> const& /*session*/,
std::shared_ptr<ms::Surface> const& surface,
MirSurfaceAttrib attrib,
int value)
{
return surface->configure(attrib, value);
}
void MirWindowManager::modify_surface(const std::shared_ptr<mir::scene::Session>&, const std::shared_ptr<mir::scene::Surface>&, const mir::shell::SurfaceSpecification&)
{
// TODO support surface modifications
}
|