Changeset View
Changeset View
Standalone View
Standalone View
tabletmodemanager.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | |||||
75 | { | 75 | { | ||
76 | input()->installInputEventSpy(m_spy); | 76 | input()->installInputEventSpy(m_spy); | ||
77 | 77 | | |||
78 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/KWin"), | 78 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/KWin"), | ||
79 | QStringLiteral("org.kde.KWin.TabletModeManager"), | 79 | QStringLiteral("org.kde.KWin.TabletModeManager"), | ||
80 | this, | 80 | this, | ||
81 | QDBusConnection::ExportAllProperties | QDBusConnection::ExportAllSignals | 81 | QDBusConnection::ExportAllProperties | QDBusConnection::ExportAllSignals | ||
82 | ); | 82 | ); | ||
83 | | ||||
84 | connect(input(), &InputRedirection::hasTabletModeSwitchChanged, this, &TabletModeManager::tabletModeAvailableChanged); | ||||
85 | } | ||||
86 | | ||||
87 | bool TabletModeManager::isTabletModeAvailable() const | ||||
88 | { | ||||
89 | return input()->hasTabletModeSwitch(); | ||||
83 | } | 90 | } | ||
84 | 91 | | |||
85 | bool TabletModeManager::isTablet() const | 92 | bool TabletModeManager::isTablet() const | ||
86 | { | 93 | { | ||
87 | return m_isTabletMode; | 94 | return m_isTabletMode; | ||
graesslin: Impossible! That's violating the layering. KWin core does not depend or interact with libinput… | |||||
I tought as much, but would be possible then to expose the property in an abstract way from the core for this to read? mart: I tought as much, but would be possible then to expose the property in an abstract way from the… | |||||
which, would make sense api-wise even if something different than libinput was used underneath mart: which, would make sense api-wise even if something different than libinput was used underneath | |||||
makes sense. VirtualKeyboard also accesses the information through input graesslin: makes sense. VirtualKeyboard also accesses the information through input | |||||
mart: ok, i'll try to add an api for that in thir rr then | |||||
88 | } | 95 | } | ||
89 | 96 | | |||
graesslin: is this method still needed? | |||||
yes, the point is to expose it to applications (on plasma i wouldn't want a "show this only in tablet mode" option visible (or at least, enabled) if the hardware doesn't support tablet mode at all mart: yes, the point is to expose it to applications (on plasma i wouldn't want a "show this only in… | |||||
I meant the method setTabletModeAvailable, your reply seems to be for isTabletModeAvailable? graesslin: I meant the method setTabletModeAvailable, your reply seems to be for isTabletModeAvailable? | |||||
mart: sorry, i misunderstood, indeed that's not needed anymore, removing | |||||
90 | void TabletModeManager::setIsTablet(bool tablet) | 97 | void TabletModeManager::setIsTablet(bool tablet) | ||
91 | { | 98 | { | ||
92 | if (m_isTabletMode == tablet) { | 99 | if (m_isTabletMode == tablet) { | ||
93 | return; | 100 | return; | ||
94 | } | 101 | } | ||
95 | 102 | | |||
96 | m_isTabletMode = tablet; | 103 | m_isTabletMode = tablet; | ||
97 | emit tabletModeChanged(tablet); | 104 | emit tabletModeChanged(tablet); | ||
98 | } | 105 | } |
Impossible! That's violating the layering. KWin core does not depend or interact with libinput for our overall sanity.