/* KWin - the KDE window manager This file is part of the KDE project. SPDX-FileCopyrightText: 2023 Xaver Hugl SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include "core/output.h" #include #include #include #include #include #include #include class QOrientationReading; namespace KWin { class OutputConfiguration; class OutputConfigurationStore { public: OutputConfigurationStore(); ~OutputConfigurationStore(); enum class ConfigType { Preexisting, Generated, }; std::optional, ConfigType>> queryConfig(const QList &outputs, bool isLidClosed, QOrientationReading *orientation, bool isTabletMode); void storeConfig(const QList &allOutputs, bool isLidClosed, const OutputConfiguration &config, const QList &outputOrder); bool isAutoRotateActive(const QList &outputs, bool isTabletMode) const; private: void applyOrientationReading(OutputConfiguration &config, const QList &outputs, QOrientationReading *orientation, bool isTabletMode); std::optional>> generateLidClosedConfig(const QList &outputs); std::pair> generateConfig(const QList &outputs, bool isLidClosed); std::shared_ptr chooseMode(Output *output) const; double chooseScale(Output *output, OutputMode *mode) const; double targetDpi(Output *output) const; void load(); void save(); struct ModeData { QSize size; uint32_t refreshRate; }; struct OutputState { // identification data std::optional edidIdentifier; std::optional connectorName; // empty if invalid QString edidHash; QString mstPath; // actual state std::optional mode; std::optional scale; std::optional transform; std::optional manualTransform; std::optional overscan; std::optional rgbRange; std::optional vrrPolicy; std::optional highDynamicRange; std::optional referenceLuminance; std::optional wideColorGamut; std::optional autoRotation; std::optional iccProfilePath; std::optional colorProfileSource; std::optional maxPeakBrightnessOverride; std::optional maxAverageBrightnessOverride; std::optional minBrightnessOverride; std::optional sdrGamutWideness; std::optional brightness; std::optional allowSdrSoftwareBrightness; }; struct SetupState { size_t outputIndex; QPoint position; bool enabled; int priority; }; struct Setup { bool lidClosed = false; QList outputs; }; std::pair> setupToConfig(Setup *setup, const std::unordered_map &outputMap) const; std::optional>> findSetup(const QList &outputs, bool lidClosed); std::optional findOutput(Output *output, const QList &allOutputs) const; QList m_outputs; QList m_setups; }; }