Make it possible to autodetect the tablet mode
ClosedPublic

Authored by apol on Mar 8 2019, 2:10 AM.

Details

Summary

At the moment it's broken for many of the laptops I've seen, this opens the possibility to start toying with them. The right fix would be to get the kernel to emit the right signals but I'm afraid for some hardware it will be close to impossible.
This includes a kconfig variable variable that will detect it as follows: if there's a touchscreen, when the touchpad gets removed we are on tablet mode (i.e. the pointing will be done using the finger), when it's connected back tablet mode will be restored.

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.
apol created this revision.Mar 8 2019, 2:10 AM
Restricted Application added a project: KWin. · View Herald TranscriptMar 8 2019, 2:10 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
apol requested review of this revision.Mar 8 2019, 2:10 AM
apol updated this revision to Diff 53427.Mar 8 2019, 11:37 AM

Fix comment

Concept seems sensible.

tabletmodemanager.cpp
112

I'd prefer using kwin.kcfg

116

If you do have tabletModeSwitch we're still detecting a tablet mode regardless of this setting.
We need something a bit more explicit.

"SetTabletModeOnTouchPadRemoval" ?

146

I don't really how this is meant to be used but should this be only true when there's a touch screen?

apol updated this revision to Diff 53461.Mar 8 2019, 4:39 PM

Tested and working

apol retitled this revision from RFC: Make it possible to autodetect the tablet mode to Make it possible to autodetect the tablet mode.Mar 11 2019, 5:00 PM
apol updated this revision to Diff 53682.Mar 11 2019, 5:18 PM

Use the settings file david prefers

apol updated this revision to Diff 53683.Mar 11 2019, 5:21 PM

Update comment

apol planned changes to this revision.Mar 11 2019, 5:22 PM
apol marked 2 inline comments as done.
apol added inline comments.
tabletmodemanager.cpp
146

We could be a bit more specific, yes. But at this point, if it has requested through a config check to do the detection, I'd say it's fine to announce it as such. If you really want to, I can check that there's a touchscreen before initialising the Spy.

apol requested review of this revision.Mar 11 2019, 5:22 PM
davidedmundson accepted this revision.Mar 18 2019, 1:54 PM
This revision is now accepted and ready to land.Mar 18 2019, 1:54 PM
mart added a subscriber: mart.Mar 19 2019, 3:46 PM

lgtm, maybe add a check more

tabletmodemanager.cpp
114

maybe checking touchpad and mouse? ie maybe i detached the keyboard from my transformable laptop but iattached usb mouse and keyboard, i would expect in this case to go in desktop mode

apol updated this revision to Diff 54342.Mar 19 2019, 5:26 PM

Rework the initalisation code, adapt to marco's comment

apol updated this revision to Diff 54371.Mar 19 2019, 9:32 PM

Iterate, don't hide it behind a weird config value

apol updated this revision to Diff 54376.Mar 19 2019, 9:58 PM

Forgot to save the file

This revision was automatically updated to reflect the committed changes.