This allows to lock the current rotation or temporary inhibit auto
rotation behavior on mobile
Details
tested on mobile
Diff Detail
- Repository
- R104 KScreen
- Branch
- arcpatch-D28115
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 24069 Build 24087: arc lint + arc unit
Maybe it would be sensible idea to instead connect/disconnect orientation sensor, and replace method name with "inhibitAutoRotation"?
So I think of two things to consider:
- How is the overall interaction? Do we want something in line with other systems? Then we should have a lock/unlock rotation workflow where the current rotation orientation is made permanent until the icon is tapped again. Android and GNOME do it like this.
- To make this consistent with the KScreen KCM the values should be written to the control file. I.e. your KScreenDaemon::setAutoRotation method should call into ControlConfig::setAutoRotate. Then it would just change for example when you lock the rotation from auto to manual and the current rotation value is set anyway.
- rename method to lock rotation
- disconnect/connect orientation sensor when we want to lock/unlock rotation
This works as expected API wise and functionality wise, but internally control config is not written at all. :/
Please call the functions AutoRotate. I failed to name it consistently in the code until now but let's go with AutoRotate from now on (and I will try to rename it where I accidentally said AutoRotation in some form). Reasons are that it's shorter and when I googled it I found only one technical document. Was for Android and called the feature that way.
kded/config.cpp | ||
---|---|---|
104 | Do it like this: void Config::setAutoRotation(bool value) { for (KScreen::OutputPtr &output : m_data->outputs()) { if (output->type() != KScreen::Output::Type::Panel) { continue; } if(m_control->getAutoRotate(output) != value) { m_control->setAutoRotate(output, value); } } m_control->writeFile(); } |
- rename methods to AutoRotate
- write control file after change, thanks @romangg for suggestion
kded/config.cpp | ||
---|---|---|
103 | On push change to: if ( (whitespace) |
It could read it from the config control file (in case of multi-screen which output though?). But it would be better to add another dbus method for that.