mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
actiondrawer: Use layershell to avoid taking focus from current window
We can use layershell to avoid taking focus from the current window, which avoids any unnecessary behavior from an unfocus event.
This commit is contained in:
parent
6e7376990b
commit
f3dc108602
2 changed files with 19 additions and 11 deletions
|
|
@ -7,10 +7,11 @@
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window
|
||||||
|
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
||||||
|
import org.kde.layershell 1.0 as LayerShell
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Window with the ActionDrawer component embedded in it.
|
* Window with the ActionDrawer component embedded in it.
|
||||||
|
|
@ -18,17 +19,21 @@ import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
||||||
* Used for overlaying the ActionDrawer if the original window does not cover
|
* Used for overlaying the ActionDrawer if the original window does not cover
|
||||||
* the whole screen.
|
* the whole screen.
|
||||||
*/
|
*/
|
||||||
NanoShell.FullScreenOverlay {
|
Window {
|
||||||
id: window
|
id: window
|
||||||
|
|
||||||
|
LayerShell.Window.scope: "overlay"
|
||||||
|
LayerShell.Window.anchors: LayerShell.Window.AnchorTop | LayerShell.Window.AnchorLeft | LayerShell.Window.AnchorRight | LayerShell.Window.AnchorBottom
|
||||||
|
LayerShell.Window.layer: LayerShell.Window.LayerOverlay
|
||||||
|
LayerShell.Window.exclusionZone: -1
|
||||||
|
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityNone
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ActionDrawer component.
|
* The ActionDrawer component.
|
||||||
*/
|
*/
|
||||||
property alias actionDrawer: drawer
|
property alias actionDrawer: drawer
|
||||||
|
|
||||||
visible: drawer.intendedToBeVisible
|
visible: drawer.intendedToBeVisible
|
||||||
width: Screen.width
|
|
||||||
height: Screen.height
|
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
/**
|
/**
|
||||||
* Root element that contains all the ActionDrawer's contents, and is anchored to the screen.
|
* Root element that contains all the ActionDrawer's contents, and is anchored to the screen.
|
||||||
*/
|
*/
|
||||||
Rectangle {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var actionDrawer
|
required property var actionDrawer
|
||||||
|
|
@ -31,12 +31,15 @@ Rectangle {
|
||||||
Kirigami.Theme.inherit: false
|
Kirigami.Theme.inherit: false
|
||||||
|
|
||||||
// Background color
|
// Background color
|
||||||
color: Qt.rgba(Kirigami.Theme.backgroundColor.r,
|
Rectangle {
|
||||||
Kirigami.Theme.backgroundColor.g,
|
anchors.fill: parent
|
||||||
Kirigami.Theme.backgroundColor.b,
|
color: Qt.rgba(Kirigami.Theme.backgroundColor.r,
|
||||||
(root.actionDrawer.mode == ActionDrawer.Portrait || notificationWidget.hasNotifications) ? 0.95 : 0.9)
|
Kirigami.Theme.backgroundColor.g,
|
||||||
Behavior on color { ColorAnimation { duration: Kirigami.Units.longDuration } }
|
Kirigami.Theme.backgroundColor.b,
|
||||||
opacity: Math.max(0, Math.min(1, actionDrawer.offset / root.minimizedQuickSettingsOffset))
|
(root.actionDrawer.mode == ActionDrawer.Portrait || notificationWidget.hasNotifications) ? 0.95 : 0.9)
|
||||||
|
Behavior on color { ColorAnimation { duration: Kirigami.Units.longDuration } }
|
||||||
|
opacity: Math.max(0, Math.min(1, actionDrawer.offset / root.minimizedQuickSettingsOffset))
|
||||||
|
}
|
||||||
|
|
||||||
// Layout that switches between landscape and portrait mode
|
// Layout that switches between landscape and portrait mode
|
||||||
Loader {
|
Loader {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue