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
|
/*
* Copyright (C) 2014 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 "mirplacementstrategy.h"
#include "logging.h"
#include <mir/geometry/rectangle.h>
#include <mir/shell/display_layout.h>
#include <mir/scene/surface_creation_parameters.h>
namespace ms = mir::scene;
namespace msh = mir::shell;
MirPlacementStrategy::MirPlacementStrategy(
std::shared_ptr<msh::DisplayLayout> const& display_layout)
: m_displayLayout(display_layout)
{
qCDebug(QTMIR_MIR_MESSAGES) << "MirPlacementStrategy::MirPlacementStrategy";
}
ms::SurfaceCreationParameters
MirPlacementStrategy::place(ms::Session const& /*session*/,
ms::SurfaceCreationParameters const& requestParameters)
{
// 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) << "MirPlacementStrategy: requested ("
<< requestParameters.size.width.as_int() << "," << requestParameters.size.height.as_int() << ") and returned ("
<< placedParameters.size.width.as_int() << "," << placedParameters.size.height.as_int() << ")";
return placedParameters;
}
|