wayland: Use brightness range 1..max for internal displays

This avoids regressing compared to PowerDevil in 6.1 which also
protected against setting internal display brightness to 0.

CCBUG: 430439
CCBUG: 483490
This commit is contained in:
Jakob Petsovits 2024-07-17 12:29:20 +02:00
parent 998be47ac1
commit 6ca6308ccd

View file

@ -60,7 +60,8 @@ ExternalBrightnessDeviceV1::~ExternalBrightnessDeviceV1()
void ExternalBrightnessDeviceV1::setBrightness(double brightness)
{
const uint32_t val = std::clamp<int64_t>(std::round(brightness * m_maxBrightness), 0, m_maxBrightness);
const uint32_t minBrightness = m_internal ? 1 : 0; // some laptop screens turn off at brightness 0
const uint32_t val = std::round(std::lerp(minBrightness, m_maxBrightness, std::clamp(brightness, 0.0, 1.0)));
send_requested_brightness(val);
}