From 5998326374275dac2ca33eaed57ecfd523bb68a7 Mon Sep 17 00:00:00 2001 From: Guenther Grau Date: Tue, 28 Jun 2022 18:48:03 +0200 Subject: [PATCH] Extract duplicate line in present in both if branches Use more concise code to assign workArea --- src/workspace.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/workspace.cpp b/src/workspace.cpp index 29b40cef6c..9a341801ba 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -2260,16 +2260,9 @@ QRect Workspace::clientArea(clientAreaOption opt, const Output *output, const Vi screenArea = effectiveOutput->geometry(); } - if (is_multihead) { - workArea = m_workAreas.value(desktop); - if (workArea.isNull()) { - workArea = effectiveOutput->geometry(); - } - } else { - workArea = m_workAreas.value(desktop); - if (workArea.isNull()) { - workArea = QRect(QPoint(0, 0), m_geometry.size()); - } + workArea = m_workAreas.value(desktop); + if (workArea.isNull()) { + workArea = is_multihead ? effectiveOutput->geometry() : QRect(QPoint(0, 0), m_geometry.size()); } switch (opt) { @@ -2282,11 +2275,7 @@ QRect Workspace::clientArea(clientAreaOption opt, const Output *output, const Vi case ScreenArea: return effectiveOutput->geometry(); case WorkArea: - if (is_multihead) { - return screenArea; - } else { - return workArea; - } + return is_multihead ? screenArea : workArea; case FullArea: return QRect(QPoint(0, 0), m_geometry.size());