tabletmodemanager: move global to Application

This commit is contained in:
Xaver Hugl 2022-08-03 11:27:35 +02:00
parent 49d80162c5
commit fde7d44941
6 changed files with 13 additions and 7 deletions

View file

@ -25,6 +25,7 @@
#endif
#include "session.h"
#include "sm.h"
#include "tabletmodemanager.h"
#include "utils/xcbutils.h"
#include "wayland/surface_interface.h"
#include "workspace.h"
@ -278,6 +279,11 @@ void Application::createInputMethod()
m_inputMethod = std::make_unique<InputMethod>();
}
void Application::createTabletModeManager()
{
m_tabletModeManager = std::make_unique<TabletModeManager>();
}
void Application::installNativeX11EventFilter()
{
installNativeEventFilter(m_eventFilter.get());

View file

@ -34,6 +34,7 @@ class PluginManager;
class InputMethod;
class ColorManager;
class ScreenLockerWatcher;
class TabletModeManager;
class XcbEventFilter : public QAbstractNativeEventFilter
{
@ -261,6 +262,7 @@ protected:
void createPlugins();
void createColorManager();
void createInputMethod();
void createTabletModeManager();
void destroyInput();
void destroyWorkspace();
void destroyCompositor();
@ -299,6 +301,7 @@ private:
std::unique_ptr<PluginManager> m_pluginManager;
std::unique_ptr<InputMethod> m_inputMethod;
std::unique_ptr<ColorManager> m_colorManager;
std::unique_ptr<TabletModeManager> m_tabletModeManager;
#if KWIN_BUILD_SCREENLOCKER
std::unique_ptr<ScreenLockerWatcher> m_screenLockerWatcher;
#endif

View file

@ -151,7 +151,7 @@ void ApplicationWayland::performStartup()
createInput();
createInputMethod();
TabletModeManager::create(this);
createTabletModeManager();
WaylandCompositor::create();

View file

@ -259,7 +259,7 @@ void ApplicationX11::performStartup()
createAtoms();
TabletModeManager::create(this);
createTabletModeManager();
}
bool ApplicationX11::notify(QObject *o, QEvent *e)

View file

@ -21,8 +21,6 @@
namespace KWin
{
KWIN_SINGLETON_FACTORY_VARIABLE(TabletModeManager, s_manager)
static bool shouldIgnoreDevice(InputDevice *device)
{
if (qobject_cast<FakeInputDevice*>(device)) {
@ -111,8 +109,7 @@ private:
TabletModeManager *const m_parent;
};
TabletModeManager::TabletModeManager(QObject *parent)
: QObject(parent)
TabletModeManager::TabletModeManager()
{
if (waylandServer()) {
if (input()->hasTabletModeSwitch()) {

View file

@ -32,6 +32,7 @@ public:
On
};
explicit TabletModeManager();
~TabletModeManager() override = default;
void setTabletModeAvailable(bool detecting);
@ -56,7 +57,6 @@ private:
bool m_isTabletMode = false;
bool m_detecting = false;
ConfiguredMode m_configuredMode = ConfiguredMode::Auto;
KWIN_SINGLETON_VARIABLE(TabletModeManager, s_manager)
};
}