KWin
Loading...
Searching...
No Matches
tabletmodemanager.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5
6*/
7
8#pragma once
9
10#include "effect/globals.h"
11#include <KConfigWatcher>
12#include <QObject>
13#include <config-kwin.h>
14#include <kwin_export.h>
15
16namespace KWin
17{
18
19class KWIN_EXPORT TabletModeManager : public QObject
20{
21 Q_OBJECT
22 Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.TabletModeManager")
23 // assuming such a switch is not pluggable for now
24 Q_PROPERTY(bool tabletModeAvailable READ isTabletModeAvailable NOTIFY tabletModeAvailableChanged)
25 Q_PROPERTY(bool tabletMode READ effectiveTabletMode NOTIFY tabletModeChanged)
26
27public:
28 enum class ConfiguredMode {
29 Auto,
30 Off,
31 On
32 };
33
34 explicit TabletModeManager();
35 ~TabletModeManager() override = default;
36
37 void setTabletModeAvailable(bool detecting);
38 bool isTabletModeAvailable() const;
39
40 bool effectiveTabletMode() const;
41 bool isTablet() const;
42 void setIsTablet(bool tablet);
43
44 ConfiguredMode configuredMode() const;
45
46Q_SIGNALS:
47 void tabletModeAvailableChanged(bool available);
48 void tabletModeChanged(bool tabletMode);
49
50private:
51 void hasTabletModeInputChanged(bool set);
52 void refreshSettings();
53
54 KConfigWatcher::Ptr m_settingsWatcher;
55 bool m_isTabletMode = false;
56 bool m_detecting = false;
57 ConfiguredMode m_configuredMode = ConfiguredMode::Auto;
58};
59}
void tabletModeAvailableChanged(bool available)
~TabletModeManager() override=default
void tabletModeChanged(bool tabletMode)