GCC Code Coverage Report


Directory: ./
File: backends/xrandr/xrandrmode.cpp
Date: 2023-04-20 22:59:23
Exec Total Coverage
Lines: 0 24 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*************************************************************************************
2 * Copyright 2012, 2013 Daniel Vrátil <dvratil@redhat.com> *
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 "xrandrmode.h"
19
20 #include "mode.h"
21 #include "output.h"
22 #include "xrandroutput.h"
23
24 XRandRMode::XRandRMode(const xcb_randr_mode_info_t& modeInfo, XRandROutput* output)
25 : QObject(output)
26 {
27 m_id = modeInfo.id;
28 // FIXME XCB
29 // m_name = QString::fromUtf8(modeInfo->name);
30 m_size = QSize(modeInfo.width, modeInfo.height);
31 m_refreshRate = (float)modeInfo.dot_clock / ((float)modeInfo.htotal * (float)modeInfo.vtotal);
32 // From RandR: pub const RR_DoubleScan: c_int = 32
33 m_doubleScan = modeInfo.mode_flags & 32;
34 }
35
36 XRandRMode::~XRandRMode()
37 {
38 }
39
40 Disman::ModePtr XRandRMode::toDismanMode()
41 {
42 Disman::ModePtr dismanMode(new Disman::Mode);
43
44 dismanMode->set_id(std::to_string(m_id));
45 dismanMode->set_name(m_name.toStdString());
46 dismanMode->set_size(m_size);
47 dismanMode->set_refresh(m_refreshRate * 1000);
48
49 return dismanMode;
50 }
51
52 xcb_randr_mode_t XRandRMode::id() const
53 {
54 return m_id;
55 }
56
57 QSize XRandRMode::size() const
58 {
59 return m_size;
60 }
61
62 float XRandRMode::refreshRate() const
63 {
64 return m_refreshRate;
65 }
66
67 bool XRandRMode::doubleScan() const
68 {
69 return m_doubleScan;
70 }
71
72 QString XRandRMode::name() const
73 {
74 return m_name;
75 }
76