Changeset View
Changeset View
Standalone View
Standalone View
backends/kwayland/waylandscreen.cpp
Show All 9 Lines | |||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | ||
12 | * Lesser General Public License for more details. * | 12 | * Lesser General Public License for more details. * | ||
13 | * * | 13 | * * | ||
14 | * You should have received a copy of the GNU Lesser General Public * | 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 * | 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 * | 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * | ||
17 | *************************************************************************************/ | 17 | *************************************************************************************/ | ||
18 | #include "waylandscreen.h" | ||||
18 | 19 | | |||
19 | #include "waylandconfig.h" | 20 | #include "waylandconfig.h" | ||
20 | #include "waylandscreen.h" | | |||
21 | #include "waylandoutput.h" | 21 | #include "waylandoutput.h" | ||
22 | 22 | | |||
23 | #include <mode.h> | 23 | #include <mode.h> | ||
24 | 24 | | |||
25 | | ||||
26 | using namespace KScreen; | 25 | using namespace KScreen; | ||
27 | 26 | | |||
28 | WaylandScreen::WaylandScreen(WaylandConfig *config) | 27 | WaylandScreen::WaylandScreen(WaylandConfig *config) | ||
29 | : QObject(config) | 28 | : QObject(config) | ||
30 | , m_outputCount(0) | 29 | , m_outputCount(0) | ||
31 | { | 30 | { | ||
32 | } | 31 | } | ||
33 | 32 | | |||
34 | WaylandScreen::~WaylandScreen() | | |||
35 | { | | |||
36 | } | | |||
37 | | ||||
38 | ScreenPtr WaylandScreen::toKScreenScreen(KScreen::ConfigPtr &parent) const | 33 | ScreenPtr WaylandScreen::toKScreenScreen(KScreen::ConfigPtr &parent) const | ||
39 | { | 34 | { | ||
40 | Q_UNUSED(parent); | 35 | Q_UNUSED(parent); | ||
36 | | ||||
41 | KScreen::ScreenPtr kscreenScreen(new KScreen::Screen); | 37 | KScreen::ScreenPtr kscreenScreen(new KScreen::Screen); | ||
42 | updateKScreenScreen(kscreenScreen); | 38 | updateKScreenScreen(kscreenScreen); | ||
43 | return kscreenScreen; | 39 | return kscreenScreen; | ||
44 | } | 40 | } | ||
45 | 41 | | |||
46 | void WaylandScreen::setOutputs(const QList<WaylandOutput*> &outputs) | 42 | void WaylandScreen::setOutputs(const QList<WaylandOutput*> &outputs) | ||
47 | { | 43 | { | ||
48 | m_outputCount = outputs.count(); | 44 | m_outputCount = outputs.count(); | ||
45 | | ||||
49 | QRect r; | 46 | QRect r; | ||
50 | Q_FOREACH (auto o, outputs) { | 47 | for (const auto *out : outputs) { | ||
51 | if (o->enabled()) { | 48 | if (out->enabled()) { | ||
52 | r |= QRect(o->outputDevice()->globalPosition(), o->outputDevice()->pixelSize() / o->outputDevice()->scale()); | 49 | const auto *dev = out->outputDevice(); | ||
50 | r |= QRect(dev->globalPosition(), dev->pixelSize() / dev->scale()); | ||||
53 | } | 51 | } | ||
54 | } | 52 | } | ||
55 | m_size = r.size(); | 53 | m_size = r.size(); | ||
56 | } | 54 | } | ||
57 | 55 | | |||
58 | void WaylandScreen::updateKScreenScreen(KScreen::ScreenPtr &screen) const | 56 | void WaylandScreen::updateKScreenScreen(KScreen::ScreenPtr &screen) const | ||
59 | { | 57 | { | ||
60 | screen->setMinSize(QSize(0, 0)); | 58 | screen->setMinSize(QSize(0, 0)); | ||
61 | screen->setMaxSize(QSize(64000, 64000)); // 64000^2 should be enough for everyone. | 59 | | ||
60 | // 64000^2 should be enough for everyone. | ||||
61 | screen->setMaxSize(QSize(64000, 64000)); | ||||
62 | | ||||
62 | screen->setCurrentSize(m_size); | 63 | screen->setCurrentSize(m_size); | ||
63 | screen->setMaxActiveOutputsCount(m_outputCount); | 64 | screen->setMaxActiveOutputsCount(m_outputCount); | ||
64 | } | 65 | } | ||
65 | 66 | |