File indexing completed on 2024-09-22 05:00:54

0001 /*
0002     SPDX-FileCopyrightText: 2011 Sebastian Kügler <sebas@kde.org>
0003     SPDX-FileCopyrightText: 2012 Viranch Mehta <viranch.mehta@gmail.com>
0004     SPDX-FileCopyrightText: 2014-2016 Kai Uwe Broulik <kde@privat.broulik.de>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 function updateBrightness(rootItem, source) {
0010     if (rootItem.updateScreenBrightnessJob || rootItem.updateKeyboardBrightnessJob)
0011         return;
0012 
0013     if (!source.data["PowerDevil"]) {
0014         return;
0015     }
0016 
0017     // we don't want passive brightness change send setBrightness call
0018     rootItem.disableBrightnessUpdate = true;
0019 
0020     if (typeof source.data["PowerDevil"]["Screen Brightness"] === 'number') {
0021         rootItem.screenBrightness = source.data["PowerDevil"]["Screen Brightness"];
0022     }
0023     if (typeof source.data["PowerDevil"]["Keyboard Brightness"] === 'number') {
0024         rootItem.keyboardBrightness = source.data["PowerDevil"]["Keyboard Brightness"];
0025     }
0026     rootItem.disableBrightnessUpdate = false;
0027 }