workspace: don't use an empty list as "don't update"
It's confusing and caused the xwayland scale to not be updated in all situations where it should be updated
This commit is contained in:
parent
e16069ae77
commit
c761571a43
3 changed files with 11 additions and 10 deletions
|
@ -400,7 +400,7 @@ void OutputConfigurationV2Interface::kde_output_configuration_v2_apply(Resource
|
|||
return;
|
||||
}
|
||||
|
||||
QList<Output *> sortedOrder;
|
||||
std::optional<QList<Output *>> sortedOrder;
|
||||
if (!outputOrder.empty()) {
|
||||
const int desktopOutputs = std::count_if(allOutputs.begin(), allOutputs.end(), [](Output *output) {
|
||||
return !output->isNonDesktop();
|
||||
|
@ -431,8 +431,9 @@ void OutputConfigurationV2Interface::kde_output_configuration_v2_apply(Resource
|
|||
}
|
||||
i++;
|
||||
}
|
||||
sortedOrder.reserve(outputOrder.size());
|
||||
std::transform(outputOrder.begin(), outputOrder.end(), std::back_inserter(sortedOrder), [](const auto &pair) {
|
||||
sortedOrder = QList<Output *>();
|
||||
sortedOrder->reserve(outputOrder.size());
|
||||
std::transform(outputOrder.begin(), outputOrder.end(), std::back_inserter(*sortedOrder), [](const auto &pair) {
|
||||
return pair.second->handle();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -488,7 +488,7 @@ Workspace::~Workspace()
|
|||
_self = nullptr;
|
||||
}
|
||||
|
||||
bool Workspace::applyOutputConfiguration(const OutputConfiguration &config, const QList<Output *> &outputOrder)
|
||||
bool Workspace::applyOutputConfiguration(const OutputConfiguration &config, const std::optional<QList<Output *>> &outputOrder)
|
||||
{
|
||||
if (!kwinApp()->outputBackend()->applyOutputChanges(config)) {
|
||||
return false;
|
||||
|
@ -500,7 +500,7 @@ bool Workspace::applyOutputConfiguration(const OutputConfiguration &config, cons
|
|||
const bool xwaylandClientsScale = kscreenGroup.readEntry("XwaylandClientsScale", true);
|
||||
if (xwaylandClientsScale && !m_outputOrder.isEmpty()) {
|
||||
double maxScale = 0;
|
||||
for (Output *output : outputOrder) {
|
||||
for (Output *output : m_outputOrder) {
|
||||
const auto changeset = config.constChangeSet(output);
|
||||
maxScale = std::max(maxScale, changeset ? changeset->scale.value_or(output->scale()) : output->scale());
|
||||
}
|
||||
|
@ -1215,7 +1215,7 @@ void Workspace::slotOutputBackendOutputsQueried()
|
|||
updateOutputs();
|
||||
}
|
||||
|
||||
void Workspace::updateOutputs(const QList<Output *> &outputOrder)
|
||||
void Workspace::updateOutputs(const std::optional<QList<Output *>> &outputOrder)
|
||||
{
|
||||
const auto availableOutputs = kwinApp()->outputBackend()->outputs();
|
||||
const auto oldOutputs = m_outputs;
|
||||
|
@ -1247,8 +1247,8 @@ void Workspace::updateOutputs(const QList<Output *> &outputOrder)
|
|||
setActiveOutput(m_outputs[0]);
|
||||
}
|
||||
|
||||
if (!outputOrder.empty()) {
|
||||
setOutputOrder(outputOrder);
|
||||
if (outputOrder) {
|
||||
setOutputOrder(*outputOrder);
|
||||
} else {
|
||||
// ensure all enabled but no disabled outputs are in the output order
|
||||
for (Output *output : std::as_const(m_outputs)) {
|
||||
|
|
|
@ -468,7 +468,7 @@ public:
|
|||
* Apply the requested output configuration. Note that you must use this function
|
||||
* instead of Platform::applyOutputChanges().
|
||||
*/
|
||||
bool applyOutputConfiguration(const OutputConfiguration &config, const QList<Output *> &outputOrder = {});
|
||||
bool applyOutputConfiguration(const OutputConfiguration &config, const std::optional<QList<Output *>> &outputOrder = std::nullopt);
|
||||
|
||||
public Q_SLOTS:
|
||||
void performWindowOperation(KWin::Window *window, Options::WindowOperation op);
|
||||
|
@ -640,7 +640,7 @@ private:
|
|||
QString getPlacementTrackerHash();
|
||||
|
||||
void updateOutputConfiguration();
|
||||
void updateOutputs(const QList<Output *> &outputOrder = {});
|
||||
void updateOutputs(const std::optional<QList<Output *>> &outputOrder = std::nullopt);
|
||||
void createDpmsFilter();
|
||||
void maybeDestroyDpmsFilter();
|
||||
|
||||
|
|
Loading…
Reference in a new issue