From a66d07f3ffa266cf49046feedcd46c301ba5744a Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Fri, 8 Mar 2024 21:00:23 -0500 Subject: [PATCH] taskswitcher: Fix navigation panel position when in landscape mode It used to get confused when in landscape mode, but the navigation panel is on the bottom of the screen. --- components/mobileshell/qml/components/Constants.qml | 2 +- containments/taskpanel/package/contents/ui/main.qml | 2 +- kwin/mobiletaskswitcher/qml/TaskSwitcher.qml | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/components/mobileshell/qml/components/Constants.qml b/components/mobileshell/qml/components/Constants.qml index fdd7e76f..89f2d8e9 100644 --- a/components/mobileshell/qml/components/Constants.qml +++ b/components/mobileshell/qml/components/Constants.qml @@ -13,7 +13,7 @@ pragma Singleton QtObject { readonly property real topPanelHeight: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing - readonly property real bottomPanelHeight: ShellSettings.Settings.navigationPanelEnabled ? Kirigami.Units.gridUnit * 2 : 0 + readonly property real navigationPanelThickness: ShellSettings.Settings.navigationPanelEnabled ? Kirigami.Units.gridUnit * 2 : 0 function navigationPanelOnSide(screenWidth: real, screenHeight: real): bool { return screenWidth > screenHeight && screenHeight < 500; diff --git a/containments/taskpanel/package/contents/ui/main.qml b/containments/taskpanel/package/contents/ui/main.qml index b4fdda81..6e7d6e6b 100644 --- a/containments/taskpanel/package/contents/ui/main.qml +++ b/containments/taskpanel/package/contents/ui/main.qml @@ -38,7 +38,7 @@ ContainmentItem { readonly property bool inLandscape: MobileShell.Constants.navigationPanelOnSide(Screen.width, Screen.height) - readonly property real navigationPanelHeight: Kirigami.Units.gridUnit * 2 + readonly property real navigationPanelHeight: MobileShell.Constants.navigationPanelThickness readonly property real intendedWindowThickness: navigationPanelHeight readonly property real intendedWindowLength: inLandscape ? Screen.height : Screen.width diff --git a/kwin/mobiletaskswitcher/qml/TaskSwitcher.qml b/kwin/mobiletaskswitcher/qml/TaskSwitcher.qml index d45ac76d..ca9550e6 100644 --- a/kwin/mobiletaskswitcher/qml/TaskSwitcher.qml +++ b/kwin/mobiletaskswitcher/qml/TaskSwitcher.qml @@ -1,5 +1,5 @@ // SPDX-FileCopyrightText: 2015 Marco Martin -// SPDX-FileCopyrightText: 2021-2023 Devin Lin +// SPDX-FileCopyrightText: 2021-2024 Devin Lin // SPDX-License-Identifier: GPL-2.0-or-later import QtQuick @@ -26,13 +26,10 @@ FocusScope { readonly property QtObject effect: KWinComponents.SceneView.effect readonly property QtObject targetScreen: KWinComponents.SceneView.screen - readonly property bool inLandscape: width > height; - readonly property bool isInLandscapeNavPanelMode: inLandscape && ShellSettings.Settings.navigationPanelEnabled - readonly property real topMargin: MobileShell.Constants.topPanelHeight - readonly property real bottomMargin: isInLandscapeNavPanelMode ? 0 : MobileShell.Constants.bottomPanelHeight + readonly property real bottomMargin: MobileShell.Constants.navigationPanelOnSide(width, height) ? 0 : MobileShell.Constants.navigationPanelThickness readonly property real leftMargin: 0 - readonly property real rightMargin: isInLandscapeNavPanelMode ? MobileShell.Constants.bottomPanelHeight : 0 + readonly property real rightMargin: MobileShell.Constants.navigationPanelOnSide(width, height) ? MobileShell.Constants.navigationPanelThickness : 0 property var taskSwitcherState: TaskSwitcherState { taskSwitcher: root @@ -226,6 +223,7 @@ FocusScope { right: root.right top: root.top bottom: root.bottom + left: undefined } } PropertyChanges { @@ -240,6 +238,7 @@ FocusScope { AnchorChanges { target: navigationPanel anchors { + top: undefined right: root.right left: root.left bottom: root.bottom