Bug 488764 - Auto-rotate settings don't appear in KCM until leaving KCM and returning to it once
Summary: Auto-rotate settings don't appear in KCM until leaving KCM and returning to i...
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_kscreen (show other bugs)
Version: 5.93.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-06-19 23:30 UTC by Nate Graham
Modified: 2024-08-09 21:55 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1.4
Sentry Crash Report:


Attachments
Blind patch (4.17 KB, patch)
2024-06-28 11:26 UTC, David Redondo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2024-06-19 23:30:17 UTC
Git master everything, Qt 6.7.1, Kernel 6.8.9.


When I open the KCM for the first time after a reboot, the auto-rotate controls are all missing. When I flip my laptop's screen around to enter tablet mode, the controls appear.

This is governed by the following visibility condition in https://invent.kde.org/plasma/kscreen/-/blob/master/kcm/ui/Orientation.qml?ref_type=heads#L23:

visible: kcm.autoRotationSupported && kcm.orientationSensorAvailable

I did a bit of testing, and what happens is that the value of kcm.orientationSensorAvailable doesn't become true until I flip around my laptop's lid to enter Tablet Mode.

Maybe entering tablet mode for the first time initializes the orientation sensor or something?
Comment 1 Fushan Wen 2024-06-20 01:07:11 UTC
Can reproduce. No wonder I don't see the option.
Comment 2 Harald Sitter 2024-06-21 14:35:42 UTC
what I'm seeing in busctl on the first run is that we `Get` the `AccelerometerOrientation` property. that returns `undefined`. after it returns, the service issues a `PropertiesChanged`  on that property with `normal` (we probably fail to act on that correctly).

on subsequent runs the property is already in the service-side cache and the `Get` returns `normal` instead of `undefined` 

i.e. the reason it works on subsequent runs is because the service already has the property cached and returns its value immediately instead of via a changed signal
Comment 3 David Redondo 2024-06-28 11:26:06 UTC
Created attachment 171126 [details]
Blind patch

Attached a blind patch, as I dont have the hardware to test this.
Comment 4 Marco Martin 2024-06-28 11:59:25 UTC
(In reply to David Redondo from comment #3)
> Created attachment 171126 [details]
> Blind patch
> 
> Attached a blind patch, as I dont have the hardware to test this.

Can you do a MR? I can test it
Comment 5 Bug Janitor Service 2024-08-05 14:42:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kscreen/-/merge_requests/320
Comment 6 Marco Martin 2024-08-05 14:48:43 UTC
Git commit 7723a604662c83f10e3db90c4130b2fd3b461c82 by Marco Martin.
Committed on 05/08/2024 at 14:48.
Pushed by mart into branch 'master'.

Emit OrientationSensor::availableChanged() when needed

when we get the signal from QtSensors that the rotation sensor
became available, forward the signal so that the QML part can show the
autorotation checkbox

M  +1    -0    common/orientation_sensor.cpp

https://invent.kde.org/plasma/kscreen/-/commit/7723a604662c83f10e3db90c4130b2fd3b461c82
Comment 7 Marco Martin 2024-08-05 14:51:26 UTC
Git commit 779c1f56d363f5f8afe7d71def5cd2d5699f8347 by Marco Martin.
Committed on 05/08/2024 at 14:49.
Pushed by mart into branch 'Plasma/6.1'.

Emit OrientationSensor::availableChanged() when needed

when we get the signal from QtSensors that the rotation sensor
became available, forward the signal so that the QML part can show the
autorotation checkbox


(cherry picked from commit 7723a604662c83f10e3db90c4130b2fd3b461c82)

bddbbfc6 Emit availableChanged() when needed

Co-authored-by: Marco Martin <notmart@gmail.com>

M  +1    -0    common/orientation_sensor.cpp

https://invent.kde.org/plasma/kscreen/-/commit/779c1f56d363f5f8afe7d71def5cd2d5699f8347