feat(kcm): add option for auto rotation
ClosedPublic

Authored by romangg on Dec 16 2019, 2:05 AM.

Details

Summary

This makes auto rotation configurable from the KScreen KCM. The auto rotation
feature is enabled when a rotation sensor is active and the output is internal,
otherwise the controls are disabled and we fall back to manual configuration.

An open question at this point is if there should be an additional option to
only rotate automatically when tablet mode is active or always. Currently it
always rotates automatically.

Test Plan

Tested on laptops with and without rotation sensor.

Diff Detail

Branch
auto-rotation-control
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 20385
Build 20403: arc lint + arc unit
romangg requested review of this revision.Dec 16 2019, 2:05 AM
romangg created this revision.
romangg edited the summary of this revision. (Show Details)
davidedmundson added inline comments.
kcm/config_handler.cpp
39

why here?

The point of your control config is that it's independent of the config.

romangg added inline comments.Dec 17 2019, 1:48 PM
kcm/config_handler.cpp
39

When the initial config is reset, the initial control should be reset as well at some point. Do you mean that question purely on a semantic level?

ngraham added inline comments.
kcm/package/contents/ui/Orientation.qml
48

There's enough horizontal space in the window to put this row next to the "Manual" label so it would be like so:

Orientation : (o) Automatic
              ( ) Manual: [0] [90] [180] [270]
romangg updated this revision to Diff 72353.Dec 29 2019, 11:49 PM
  • Get auto rotation being supported
  • Add tablet mode checkbox
sasch added a subscriber: sasch.Dec 30 2019, 11:04 AM

Does this need testing on hardware at this point or has that been done?

Does this need testing on hardware at this point or has that been done?

I tested it on my XPS 2-in-1. This laptop does have an orientation sensor. So this was tested. But it does not emit any signal when the display is snapped around (to hold it in "tablet-mode"). So I could test here only what happens when there is no signal but only the orientation sensor (in which case the checkbox for tablet mode only rotation must be unchecked to activate auto rotation --- i.e. an applet control would be nice for that).

So if you have a device which does have an orientation sensor and signals when tablet mode is activated (either by sending out the specific libinput event or deactivating the touchpad while having a touchscreen), this would be a very important test case. Thanks!

Note: For testing you need the patches in KWin applied and add in libkscreen in the KWayland backend the features flags for auto rotation and tablet mode detection.

sasch added a comment.Jan 8 2020, 9:05 PM

Never compiled anything, but I have a Lenovo Yoga 900s convertible that deactivates the keyboard in tent mode or when the lid is closed (unfortunately not the touchpad until the platform x86 guys offer an kernel update, https://bugzilla.kernel.org/show_bug.cgi?id=110011 ).

Nevertheless, if anyone can provide a wayland ISO including the fixes, I'd be happy to test it and provide some feedback ;)

apol added a subscriber: apol.Jan 9 2020, 1:16 AM

Never compiled anything, but I have a Lenovo Yoga 900s convertible that deactivates the keyboard in tent mode or when the lid is closed (unfortunately not the touchpad until the platform x86 guys offer an kernel update, https://bugzilla.kernel.org/show_bug.cgi?id=110011 ).

Nevertheless, if anyone can provide a wayland ISO including the fixes, I'd be happy to test it and provide some feedback ;)

I'd say as is it's too hard to set up a system to test these changes. I'd suggest reviewing these patches on code merits and do a good testing push before Plasma is released from Neon git unstable.

romangg updated this revision to Diff 73147.Jan 9 2020, 6:33 PM

Rebase on master.

romangg updated this revision to Diff 73149.Jan 9 2020, 6:57 PM

Rebase on series changes.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 15 2020, 2:38 PM
This revision was automatically updated to reflect the committed changes.
Restricted Application added a project: Plasma. · View Herald TranscriptJan 15 2020, 2:38 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
sasch added a comment.Jan 24 2020, 9:07 PM

Don't want to spam here, pretty cool. However, I don't see the orientation part within settings on the latest daily opensuse Kryption (Plasma 5.18.80) in a wayland session ( https://phabricator.kde.org/file/data/3sk75xlk4g762d3dvdep/PHID-FILE-uuwpwd636vbjefesyjb7/preview-Screenshot_20191216_025659.png ). Is there any tablet mode I need to enable first, or any advice how I could test it on my convertible?

sasch added a comment.May 5 2020, 6:32 PM

Just FYI, this works great ;)

Tested on Lenovo Yoga 900s Convertibele ( neon-developer-20200504-2356 ):

  • sensor is recognized & autorotation is available in settings
  • rotating changes to the correct mapped coordinates in every rotation for the touchscreen
  • it correctly uses some "slack", which means it doesn't rotate directly if the convertible is only moved some milimeters
  • it rotates directly from -180° to 0°, animations are quick & smooth, opened windows are always positioned correctly

Only thing I recognized is that you have to deselect "tablet mode" in settings to make the rotation work. If the convertible is folded up, it's not recognized as "tablet / tent mode" and I don't know how to switch to tablet mode in KDE (also this would have the issue that e.g. the onscreen keyboard in not working in GTK applications like FF, but that's a different story).

Overall these patches are absolutely awesome. Together with fractional scaling, this made KDE finally feature par with Gnome (from a non-technical user perspective) ;)

Abroas added a subscriber: Abroas.Jan 4 2021, 5:48 PM