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.
This commit is contained in:
Devin Lin 2024-03-08 21:00:23 -05:00
parent e51537574c
commit a66d07f3ff
3 changed files with 7 additions and 8 deletions

View file

@ -13,7 +13,7 @@ pragma Singleton
QtObject { QtObject {
readonly property real topPanelHeight: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing 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 { function navigationPanelOnSide(screenWidth: real, screenHeight: real): bool {
return screenWidth > screenHeight && screenHeight < 500; return screenWidth > screenHeight && screenHeight < 500;

View file

@ -38,7 +38,7 @@ ContainmentItem {
readonly property bool inLandscape: MobileShell.Constants.navigationPanelOnSide(Screen.width, Screen.height) 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 intendedWindowThickness: navigationPanelHeight
readonly property real intendedWindowLength: inLandscape ? Screen.height : Screen.width readonly property real intendedWindowLength: inLandscape ? Screen.height : Screen.width

View file

@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: 2015 Marco Martin <notmart@gmail.com> // SPDX-FileCopyrightText: 2015 Marco Martin <notmart@gmail.com>
// SPDX-FileCopyrightText: 2021-2023 Devin Lin <devin@kde.org> // SPDX-FileCopyrightText: 2021-2024 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick import QtQuick
@ -26,13 +26,10 @@ FocusScope {
readonly property QtObject effect: KWinComponents.SceneView.effect readonly property QtObject effect: KWinComponents.SceneView.effect
readonly property QtObject targetScreen: KWinComponents.SceneView.screen 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 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 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 { property var taskSwitcherState: TaskSwitcherState {
taskSwitcher: root taskSwitcher: root
@ -226,6 +223,7 @@ FocusScope {
right: root.right right: root.right
top: root.top top: root.top
bottom: root.bottom bottom: root.bottom
left: undefined
} }
} }
PropertyChanges { PropertyChanges {
@ -240,6 +238,7 @@ FocusScope {
AnchorChanges { AnchorChanges {
target: navigationPanel target: navigationPanel
anchors { anchors {
top: undefined
right: root.right right: root.right
left: root.left left: root.left
bottom: root.bottom bottom: root.bottom