GCC Code Coverage Report


Directory: ./
File: backends/wayland/waylandscreen.cpp
Date: 2023-04-20 22:59:23
Exec Total Coverage
Lines: 21 21 100.0%
Branches: 3 4 75.0%

Line Branch Exec Source
1 /*************************************************************************************
2 * Copyright 2014-2015 Sebastian K├╝gler <sebas@kde.org> *
3 * *
4 * This library is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * This library is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with this library; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
17 *************************************************************************************/
18 #include "waylandscreen.h"
19
20 #include "waylandoutput.h"
21
22 #include <mode.h>
23
24 #include <QRect>
25
26 using namespace Disman;
27
28 21 WaylandScreen::WaylandScreen(QObject* parent)
29 : QObject(parent)
30 21 , m_outputCount(0)
31 {
32 21 }
33
34 280 ScreenPtr WaylandScreen::toDismanScreen(Disman::ConfigPtr& parent) const
35 {
36 Q_UNUSED(parent);
37
38 280 Disman::ScreenPtr dismanScreen(new Disman::Screen);
39 280 updateDismanScreen(dismanScreen);
40 280 return dismanScreen;
41 }
42
43 44 void WaylandScreen::setOutputs(std::vector<WaylandOutput*> const& outputs)
44 {
45 44 m_outputCount = outputs.size();
46
47 44 QRect r;
48
2/2
✓ Branch 5 taken 57 times.
✓ Branch 6 taken 44 times.
101 for (auto const out : outputs) {
49
1/2
✓ Branch 1 taken 57 times.
✗ Branch 2 not taken.
57 if (out->head.enabled()) {
50 57 r |= out->geometry().toRect();
51 }
52 }
53 44 m_size = r.size();
54 44 }
55
56 560 void WaylandScreen::updateDismanScreen(Disman::ScreenPtr& screen) const
57 {
58 560 screen->set_min_size(QSize(0, 0));
59
60 // 64000^2 should be enough for everyone.
61 560 screen->set_max_size(QSize(64000, 64000));
62
63 560 screen->set_current_size(m_size);
64 560 screen->set_max_outputs_count(m_outputCount);
65 560 }
66