A basic TabletModeManager
Summary:
depends from D9521
listens to switch events and updates the tablet mode status
which is exposed to dbus in the org.kde.KWin.TabletModeManager
interface
Test Plan:
as hardware support is limited, testing of clients
so far is done by the setter in the dbus property,
which should be removed from the final version.
It has been tested to successfully work on a Thinkpad.
Reviewers: #plasma, #kwin, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: graesslin, davidedmundson, plasma-devel, kwin, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9764
2018-01-11 12:09:43 +00:00
|
|
|
/*
|
2020-08-02 22:22:19 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
*/
|
A basic TabletModeManager
Summary:
depends from D9521
listens to switch events and updates the tablet mode status
which is exposed to dbus in the org.kde.KWin.TabletModeManager
interface
Test Plan:
as hardware support is limited, testing of clients
so far is done by the setter in the dbus property,
which should be removed from the final version.
It has been tested to successfully work on a Thinkpad.
Reviewers: #plasma, #kwin, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: graesslin, davidedmundson, plasma-devel, kwin, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9764
2018-01-11 12:09:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_TABLETMODEMANAGER_H
|
|
|
|
#define KWIN_TABLETMODEMANAGER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <kwinglobals.h>
|
|
|
|
|
|
|
|
namespace KWin {
|
|
|
|
|
|
|
|
class TabletModeManager : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.TabletModeManager")
|
Expose if the tablet mode switch is available
Summary:
expose in the libinput wrapper a property that tells whether
a tablet mode switch input device is present on the machine,
expose it trough dbus
Test Plan:
still not complete, I need a way to either access the connection
from TabletModeManager or setting to TabletModeManager from input.cpp
Reviewers: #kwin, #plasma, graesslin
Reviewed By: #kwin, #plasma, graesslin
Subscribers: graesslin, ngraham, davidedmundson, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9944
2018-01-24 10:36:56 +00:00
|
|
|
//assuming such a switch is not pluggable for now
|
|
|
|
Q_PROPERTY(bool tabletModeAvailable READ isTabletModeAvailable NOTIFY tabletModeAvailableChanged)
|
A basic TabletModeManager
Summary:
depends from D9521
listens to switch events and updates the tablet mode status
which is exposed to dbus in the org.kde.KWin.TabletModeManager
interface
Test Plan:
as hardware support is limited, testing of clients
so far is done by the setter in the dbus property,
which should be removed from the final version.
It has been tested to successfully work on a Thinkpad.
Reviewers: #plasma, #kwin, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: graesslin, davidedmundson, plasma-devel, kwin, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9764
2018-01-11 12:09:43 +00:00
|
|
|
Q_PROPERTY(bool tabletMode READ isTablet NOTIFY tabletModeChanged)
|
|
|
|
|
|
|
|
public:
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~TabletModeManager() override = default;
|
Expose if the tablet mode switch is available
Summary:
expose in the libinput wrapper a property that tells whether
a tablet mode switch input device is present on the machine,
expose it trough dbus
Test Plan:
still not complete, I need a way to either access the connection
from TabletModeManager or setting to TabletModeManager from input.cpp
Reviewers: #kwin, #plasma, graesslin
Reviewed By: #kwin, #plasma, graesslin
Subscribers: graesslin, ngraham, davidedmundson, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9944
2018-01-24 10:36:56 +00:00
|
|
|
|
2019-03-22 17:29:15 +00:00
|
|
|
void setTabletModeAvailable(bool detecting);
|
Expose if the tablet mode switch is available
Summary:
expose in the libinput wrapper a property that tells whether
a tablet mode switch input device is present on the machine,
expose it trough dbus
Test Plan:
still not complete, I need a way to either access the connection
from TabletModeManager or setting to TabletModeManager from input.cpp
Reviewers: #kwin, #plasma, graesslin
Reviewed By: #kwin, #plasma, graesslin
Subscribers: graesslin, ngraham, davidedmundson, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9944
2018-01-24 10:36:56 +00:00
|
|
|
bool isTabletModeAvailable() const;
|
|
|
|
|
A basic TabletModeManager
Summary:
depends from D9521
listens to switch events and updates the tablet mode status
which is exposed to dbus in the org.kde.KWin.TabletModeManager
interface
Test Plan:
as hardware support is limited, testing of clients
so far is done by the setter in the dbus property,
which should be removed from the final version.
It has been tested to successfully work on a Thinkpad.
Reviewers: #plasma, #kwin, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: graesslin, davidedmundson, plasma-devel, kwin, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9764
2018-01-11 12:09:43 +00:00
|
|
|
bool isTablet() const;
|
|
|
|
void setIsTablet(bool tablet);
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
Expose if the tablet mode switch is available
Summary:
expose in the libinput wrapper a property that tells whether
a tablet mode switch input device is present on the machine,
expose it trough dbus
Test Plan:
still not complete, I need a way to either access the connection
from TabletModeManager or setting to TabletModeManager from input.cpp
Reviewers: #kwin, #plasma, graesslin
Reviewed By: #kwin, #plasma, graesslin
Subscribers: graesslin, ngraham, davidedmundson, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9944
2018-01-24 10:36:56 +00:00
|
|
|
void tabletModeAvailableChanged(bool available);
|
A basic TabletModeManager
Summary:
depends from D9521
listens to switch events and updates the tablet mode status
which is exposed to dbus in the org.kde.KWin.TabletModeManager
interface
Test Plan:
as hardware support is limited, testing of clients
so far is done by the setter in the dbus property,
which should be removed from the final version.
It has been tested to successfully work on a Thinkpad.
Reviewers: #plasma, #kwin, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: graesslin, davidedmundson, plasma-devel, kwin, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9764
2018-01-11 12:09:43 +00:00
|
|
|
void tabletModeChanged(bool tabletMode);
|
|
|
|
|
|
|
|
private:
|
2019-03-22 17:29:15 +00:00
|
|
|
void hasTabletModeInputChanged(bool set);
|
|
|
|
|
Expose if the tablet mode switch is available
Summary:
expose in the libinput wrapper a property that tells whether
a tablet mode switch input device is present on the machine,
expose it trough dbus
Test Plan:
still not complete, I need a way to either access the connection
from TabletModeManager or setting to TabletModeManager from input.cpp
Reviewers: #kwin, #plasma, graesslin
Reviewed By: #kwin, #plasma, graesslin
Subscribers: graesslin, ngraham, davidedmundson, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9944
2018-01-24 10:36:56 +00:00
|
|
|
bool m_tabletModeAvailable = false;
|
A basic TabletModeManager
Summary:
depends from D9521
listens to switch events and updates the tablet mode status
which is exposed to dbus in the org.kde.KWin.TabletModeManager
interface
Test Plan:
as hardware support is limited, testing of clients
so far is done by the setter in the dbus property,
which should be removed from the final version.
It has been tested to successfully work on a Thinkpad.
Reviewers: #plasma, #kwin, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: graesslin, davidedmundson, plasma-devel, kwin, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9764
2018-01-11 12:09:43 +00:00
|
|
|
bool m_isTabletMode = false;
|
2019-03-22 17:29:15 +00:00
|
|
|
bool m_detecting = false;
|
A basic TabletModeManager
Summary:
depends from D9521
listens to switch events and updates the tablet mode status
which is exposed to dbus in the org.kde.KWin.TabletModeManager
interface
Test Plan:
as hardware support is limited, testing of clients
so far is done by the setter in the dbus property,
which should be removed from the final version.
It has been tested to successfully work on a Thinkpad.
Reviewers: #plasma, #kwin, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: graesslin, davidedmundson, plasma-devel, kwin, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9764
2018-01-11 12:09:43 +00:00
|
|
|
KWIN_SINGLETON_VARIABLE(TabletModeManager, s_manager)
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // KWIN_TABLETMODEMANAGER_H
|