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
#include <mir/scene/surface_creation_parameters.h>
19
#include "creationhints.h"
21
using namespace qtmir;
23
inline const char* shellChromeToString(Mir::ShellChrome chrome) {
25
case Mir::ShellChrome::NormalChrome:
27
case Mir::ShellChrome::LowChrome:
33
CreationHints::CreationHints(const mir::scene::SurfaceCreationParameters ¶ms)
35
minWidth = params.min_width.is_set() ? params.min_width.value().as_int() : 0;
36
maxWidth = params.max_width.is_set() ? params.max_width.value().as_int() : 0;
38
minHeight = params.min_height.is_set() ? params.min_height.value().as_int() : 0;
39
maxHeight = params.max_height.is_set() ? params.max_height.value().as_int() : 0;
41
widthIncrement = params.width_inc.is_set() ? params.width_inc.value().as_int() : 0;
42
heightIncrement = params.height_inc.is_set() ? params.height_inc.value().as_int() : 0;
44
if (params.shell_chrome.is_set()) {
45
switch (params.shell_chrome.value()) {
46
case mir_shell_chrome_normal:
48
shellChrome = Mir::ShellChrome::NormalChrome;
50
case mir_shell_chrome_low:
51
shellChrome = Mir::ShellChrome::LowChrome;
57
QString CreationHints::toString() const
59
return QString("CreationHints(minW=%1,minH=%2,maxW=%3,maxH=%4,wIncr=%5,hInc=%6,shellChrome=%7)")
66
.arg(shellChromeToString(shellChrome));