Changeset View
Changeset View
Standalone View
Standalone View
screens.cpp
Show All 15 Lines | |||||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "screens.h" | 20 | #include "screens.h" | ||
21 | #include <abstract_client.h> | 21 | #include <abstract_client.h> | ||
22 | #include <x11client.h> | 22 | #include <x11client.h> | ||
23 | #include "cursor.h" | 23 | #include "cursor.h" | ||
24 | #include "orientation_sensor.h" | | |||
25 | #include "utils.h" | 24 | #include "utils.h" | ||
26 | #include "settings.h" | 25 | #include "settings.h" | ||
27 | #include <workspace.h> | 26 | #include <workspace.h> | ||
28 | #include <config-kwin.h> | 27 | #include <config-kwin.h> | ||
29 | #include "platform.h" | 28 | #include "platform.h" | ||
30 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
31 | #ifdef KWIN_UNIT_TEST | 30 | #ifdef KWIN_UNIT_TEST | ||
32 | #include <mock_screens.h> | 31 | #include <mock_screens.h> | ||
Show All 17 Lines | |||||
50 | } | 49 | } | ||
51 | 50 | | |||
52 | Screens::Screens(QObject *parent) | 51 | Screens::Screens(QObject *parent) | ||
53 | : QObject(parent) | 52 | : QObject(parent) | ||
54 | , m_count(0) | 53 | , m_count(0) | ||
55 | , m_current(0) | 54 | , m_current(0) | ||
56 | , m_currentFollowsMouse(false) | 55 | , m_currentFollowsMouse(false) | ||
57 | , m_changedTimer(new QTimer(this)) | 56 | , m_changedTimer(new QTimer(this)) | ||
58 | , m_orientationSensor(new OrientationSensor(this)) | | |||
59 | , m_maxScale(1.0) | 57 | , m_maxScale(1.0) | ||
60 | { | 58 | { | ||
61 | connect(this, &Screens::changed, this, | | |||
62 | [this] { | | |||
63 | int internalIndex = -1; | | |||
64 | for (int i = 0; i < m_count; i++) { | | |||
65 | if (isInternal(i)) { | | |||
66 | internalIndex = i; | | |||
67 | break; | | |||
68 | } | | |||
69 | } | | |||
70 | m_orientationSensor->setEnabled(internalIndex != -1 && supportsTransformations(internalIndex)); | | |||
71 | } | | |||
72 | ); | | |||
73 | } | 59 | } | ||
74 | 60 | | |||
75 | Screens::~Screens() | 61 | Screens::~Screens() | ||
76 | { | 62 | { | ||
77 | s_self = nullptr; | 63 | s_self = nullptr; | ||
78 | } | 64 | } | ||
79 | 65 | | |||
80 | void Screens::init() | 66 | void Screens::init() | ||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Line(s) | |||||
236 | { | 222 | { | ||
237 | Q_UNUSED(screen) | 223 | Q_UNUSED(screen) | ||
238 | return Qt::PrimaryOrientation; | 224 | return Qt::PrimaryOrientation; | ||
239 | } | 225 | } | ||
240 | 226 | | |||
241 | void Screens::setConfig(KSharedConfig::Ptr config) | 227 | void Screens::setConfig(KSharedConfig::Ptr config) | ||
242 | { | 228 | { | ||
243 | m_config = config; | 229 | m_config = config; | ||
244 | if (m_orientationSensor) { | | |||
245 | m_orientationSensor->setConfig(config); | | |||
246 | } | | |||
247 | } | 230 | } | ||
248 | 231 | | |||
249 | } // namespace | 232 | } // namespace |