app_server: store the brightness with the current screen config if absent

when no screen configuration is found, the preferred mode is then selected,
and we now use this as current screen configuration. Otherwise, the user
would adjust the brightness, but it would never be stored for the next boot.

Change-Id: Ia855f8a29eb5e429747f3e0bc89a46587fa42f59
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5624
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Jérôme Duval
2022-09-10 16:39:13 +00:00
committed by waddlesplash
parent 61299599e0
commit 124ae7cc2f
2 changed files with 13 additions and 0 deletions
+7
View File
@@ -899,6 +899,13 @@ Desktop::SetBrightness(int32 id, float brightness)
status_t result = HWInterface()->SetBrightness(brightness);
if (result == B_OK) {
if (fWorkspaces[0].StoredScreenConfiguration().CurrentByID(id) == NULL) {
// store the current configuration if empty
screen_configuration* current
= fWorkspaces[0].CurrentScreenConfiguration().CurrentByID(id);
fWorkspaces[0].StoredScreenConfiguration().Set(id,
current->has_info ? &current->info : NULL, current->frame, current->mode);
}
fWorkspaces[0].StoredScreenConfiguration().SetBrightness(id,
brightness);
// Save brightness for next boot
+6
View File
@@ -129,6 +129,12 @@ VirtualScreen::AddScreen(Screen* screen, ScreenConfigurations& configurations)
// We found no configuration or it wasn't valid, try to fallback to
// sane values
status = screen->SetPreferredMode();
if (status == B_OK) {
monitor_info info;
bool hasInfo = screen->GetMonitorInfo(info) == B_OK;
screen->GetMode(mode);
configurations.Set(screen->ID(), hasInfo ? &info : NULL, screen->Frame(), mode);
}
if (status != B_OK)
status = screen->SetBestMode(1024, 768, B_RGB32, 60.f);
if (status != B_OK)