Changeset View
Changeset View
Standalone View
Standalone View
daemon/actions/bundled/dimdisplay.cpp
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 87 | trigger({ | |||
---|---|---|---|---|---|
88 | {QStringLiteral("_ScreenBrightness"), QVariant::fromValue(screen)}, | 88 | {QStringLiteral("_ScreenBrightness"), QVariant::fromValue(screen)}, | ||
89 | {QStringLiteral("_KeyboardBrightness"), QVariant::fromValue(keyboard)}, | 89 | {QStringLiteral("_KeyboardBrightness"), QVariant::fromValue(keyboard)}, | ||
90 | {QStringLiteral("Explicit"), QVariant::fromValue(force)} | 90 | {QStringLiteral("Explicit"), QVariant::fromValue(force)} | ||
91 | }); | 91 | }); | ||
92 | } | 92 | } | ||
93 | 93 | | |||
94 | void DimDisplay::triggerImpl(const QVariantMap &args) | 94 | void DimDisplay::triggerImpl(const QVariantMap &args) | ||
95 | { | 95 | { | ||
96 | // don't manipulate brightness at all when they are already zero to prevent races with DPMS action | ||||
97 | | ||||
98 | if (m_oldScreenBrightness > 0) { | ||||
96 | backend()->setBrightness(args.value(QStringLiteral("_ScreenBrightness")).toInt(), BackendInterface::Screen); | 99 | backend()->setBrightness(args.value(QStringLiteral("_ScreenBrightness")).toInt(), BackendInterface::Screen); | ||
100 | } | ||||
97 | 101 | | |||
98 | // don't manipulate keyboard brightness if it's already zero to prevent races with DPMS action | | |||
99 | if (m_oldKeyboardBrightness > 0) { | 102 | if (m_oldKeyboardBrightness > 0) { | ||
100 | backend()->setBrightness(args.value(QStringLiteral("_KeyboardBrightness")).toInt(), BackendInterface::Keyboard); | 103 | backend()->setBrightness(args.value(QStringLiteral("_KeyboardBrightness")).toInt(), BackendInterface::Keyboard); | ||
101 | } | 104 | } | ||
102 | } | 105 | } | ||
103 | 106 | | |||
104 | bool DimDisplay::isSupported() | 107 | bool DimDisplay::isSupported() | ||
105 | { | 108 | { | ||
106 | BackendInterface::BrightnessControlsList controls = backend()->brightnessControlsAvailable(); | 109 | BackendInterface::BrightnessControlsList controls = backend()->brightnessControlsAvailable(); | ||
Show All 23 Lines |