A basic TabletModeManager
ClosedPublic

Authored by mart on Jan 9 2018, 1:53 PM.

Details

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.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mart created this revision.Jan 9 2018, 1:53 PM
Restricted Application added a project: KWin. · View Herald TranscriptJan 9 2018, 1:53 PM
Restricted Application added subscribers: KWin, kwin. · View Herald Transcript
mart requested review of this revision.Jan 9 2018, 1:53 PM
mart updated this revision to Diff 25022.

copyright

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 9 2018, 1:54 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript

DBus code is all good.

It would be nice if you can run qdbuscpp2xml on the TabletModeManager and install that .xml file in /usr/share/dbus-1/services it will allow other programs to generate the client side interface programatically.

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 9 2018, 2:12 PM
mart added a comment.Jan 9 2018, 2:15 PM

one thing i'm wondering, is how to manage dependencies, as ideally we want most of our apps to make use of this, but can't ask for sure to depend from kwin..., which finding the xml would make it an hard dependency (maybe one could still work around by connecting blindly to that by hand)

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 9 2018, 2:15 PM
mart edited the test plan for this revision. (Show Details)Jan 9 2018, 3:37 PM
Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 9 2018, 3:37 PM
In D9764#188268, @mart wrote:

one thing i'm wondering, is how to manage dependencies, as ideally we want most of our apps to make use of this, but can't ask for sure to depend from kwin..., which finding the xml would make it an hard dependency (maybe one could still work around by connecting blindly to that by hand)

maybe a new framework which provides the XML and a small client side wrapper? Could probably be tier1.

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 9 2018, 6:34 PM
graesslin added inline comments.Jan 9 2018, 6:43 PM
tabletmodemanager.cpp
76

please put into initializer.

Also the spy leaks.

87–88
= default
107

is that needed?

workspace.cpp
183 ↗(On Diff #25022)

I would create it in main_wayland.cpp in ApplicationWayland::performStartup just before creating the virtualkeyboard.

Reason: this is currently Wayland only code and we might not want to expose the dbus service on X11. Reason for just before creating virt keyboard: I want to use that to automatically enable the virtual keyboard if we are in tablet mode.

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 9 2018, 6:43 PM
mart added a comment.Jan 10 2018, 4:10 PM
In D9764#188268, @mart wrote:

one thing i'm wondering, is how to manage dependencies, as ideally we want most of our apps to make use of this, but can't ask for sure to depend from kwin..., which finding the xml would make it an hard dependency (maybe one could still work around by connecting blindly to that by hand)

maybe a new framework which provides the XML and a small client side wrapper? Could probably be tier1.

do you think it should be in a new standalone framework or is there anything already existing which could have it?

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 10 2018, 4:10 PM
In D9764#188862, @mart wrote:
In D9764#188268, @mart wrote:

one thing i'm wondering, is how to manage dependencies, as ideally we want most of our apps to make use of this, but can't ask for sure to depend from kwin..., which finding the xml would make it an hard dependency (maybe one could still work around by connecting blindly to that by hand)

maybe a new framework which provides the XML and a small client side wrapper? Could probably be tier1.

do you think it should be in a new standalone framework or is there anything already existing which could have it?

maybe KGuiAddons?

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 10 2018, 4:41 PM
mart added a comment.Jan 10 2018, 4:58 PM
In D9764#188862, @mart wrote:
In D9764#188268, @mart wrote:

one thing i'm wondering, is how to manage dependencies, as ideally we want most of our apps to make use of this, but can't ask for sure to depend from kwin..., which finding the xml would make it an hard dependency (maybe one could still work around by connecting blindly to that by hand)

maybe a new framework which provides the XML and a small client side wrapper? Could probably be tier1.

do you think it should be in a new standalone framework or is there anything already existing which could have it?

maybe KGuiAddons?

yeah, sounds good

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 10 2018, 4:58 PM
mart updated this revision to Diff 25099.Jan 10 2018, 5:10 PM

adress comments

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 10 2018, 5:10 PM
mart marked 2 inline comments as done.Jan 10 2018, 5:11 PM
Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 10 2018, 5:11 PM

maybe one could still work around by connecting blindly to that by hand

There's nothing inherently wrong with doing that. Assuming the DBus API is stable is as valid and as easy as assuming the a library is valid and stable.

If you're going to expose it in Kirigami, then I wouldn't bother doing anything else.

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 10 2018, 5:12 PM
graesslin accepted this revision.Jan 10 2018, 8:55 PM
This revision is now accepted and ready to land.Jan 10 2018, 8:55 PM
Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 10 2018, 8:55 PM
mart added a comment.Jan 11 2018, 10:10 AM

maybe one could still work around by connecting blindly to that by hand

There's nothing inherently wrong with doing that. Assuming the DBus API is stable is as valid and as easy as assuming the a library is valid and stable.

If you're going to expose it in Kirigami, then I wouldn't bother doing anything else.

yeah, we have to promiseapi stability for all kf5 like on that kwin interface, that's for sure.
ok, so kirigami already has a public library as well, so if done here, this could be used directly in qml (there is already a singleton which exposes an ismobile variable, which not would change dinamically at runtime), but also from any c++ program, which would be nice.

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 11 2018, 10:10 AM
mart retitled this revision from [WIP] a basic TabletModeManager to A basic TabletModeManager.Jan 11 2018, 11:52 AM
Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 11 2018, 11:52 AM
This revision was automatically updated to reflect the committed changes.
Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 11 2018, 12:11 PM