File: tabletmodemanager.h

package info (click to toggle)
kwin 4%3A5.27.5-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 55,968 kB
  • sloc: cpp: 219,194; javascript: 2,299; xml: 1,540; ansic: 831; python: 140; sh: 114; perl: 16; makefile: 14
file content (60 lines) | stat: -rw-r--r-- 1,495 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
    SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org>

    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL

*/

#pragma once

#include <KConfigWatcher>
#include <QObject>
#include <config-kwin.h>
#include <kwin_export.h>
#include <kwinglobals.h>

namespace KWin
{

class KWIN_EXPORT TabletModeManager : public QObject
{
    Q_OBJECT
    Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.TabletModeManager")
    // assuming such a switch is not pluggable for now
    Q_PROPERTY(bool tabletModeAvailable READ isTabletModeAvailable NOTIFY tabletModeAvailableChanged)
    Q_PROPERTY(bool tabletMode READ effectiveTabletMode NOTIFY tabletModeChanged)

public:
    enum class ConfiguredMode {
        Auto,
        Off,
        On
    };

    explicit TabletModeManager();
    ~TabletModeManager() override = default;

    void setTabletModeAvailable(bool detecting);
    bool isTabletModeAvailable() const;

    bool effectiveTabletMode() const;
    bool isTablet() const;
    void setIsTablet(bool tablet);

    ConfiguredMode configuredMode() const;

Q_SIGNALS:
    void tabletModeAvailableChanged(bool available);
    void tabletModeChanged(bool tabletMode);

private:
    void hasTabletModeInputChanged(bool set);
    void refreshSettings();

    KConfigWatcher::Ptr m_settingsWatcher;
    bool m_tabletModeAvailable = false;
    bool m_isTabletMode = false;
    bool m_detecting = false;
    ConfiguredMode m_configuredMode = ConfiguredMode::Auto;
};
}