mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-12 07:19:41 -04:00
quickshell: drop support for 0.2, require 0.3+
- Remove all compat code - Rewire LegacyNetworkService to use Quickshell.Networking - Add parentWindow to settings child windows
This commit is contained in:
@@ -71,8 +71,13 @@ Item {
|
||||
PathCubic {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: pathMoveComp
|
||||
PathMove {}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
shapePath.pathElements.push(Qt.createQmlObject('import QtQuick; import QtQuick.Shapes; PathMove {}', shapePath));
|
||||
shapePath.pathElements.push(pathMoveComp.createObject(shapePath));
|
||||
|
||||
for (let i = 0; i < segments; i++) {
|
||||
const seg = cubicSegment.createObject(shapePath);
|
||||
|
||||
@@ -182,14 +182,19 @@ Item {
|
||||
setBarContext(pos, bottomGap);
|
||||
}
|
||||
|
||||
// Briefly forces backgroundWindow.updatesEnabled true while the surface
|
||||
// body changes, so the contentHoleRect mask carve-out commits to the
|
||||
// compositor — otherwise the input region stays stuck at the popup's
|
||||
// initial size and clicks in any newly-grown area dismiss the popup.
|
||||
// Cleared by the frameSwapped Connections below as soon as the dirty
|
||||
// frame ships, so the bg window goes back to skipping buffer updates.
|
||||
// Holds backgroundWindow.updatesEnabled true while the surface body is
|
||||
// changing so the contentHoleRect mask carve-out tracks the popup body —
|
||||
// otherwise clicks in newly-grown areas hit the bg window and dismiss.
|
||||
// Debounced off ~250ms after the last change so a stable popup doesn't
|
||||
// keep the bg window in active-update mode.
|
||||
property bool _bgCommitWindow: false
|
||||
|
||||
Timer {
|
||||
id: bgCommitSettleTimer
|
||||
interval: 250
|
||||
onTriggered: root._bgCommitWindow = false
|
||||
}
|
||||
|
||||
function _setSurfaceGeometry(bodyX, bodyY, bodyW, bodyH) {
|
||||
const newX = Theme.snap(bodyX, dpr);
|
||||
const newY = Theme.snap(bodyY, dpr);
|
||||
@@ -206,15 +211,7 @@ Item {
|
||||
_surfaceH = _surfaceBodyH + shadowBuffer * 2;
|
||||
if (changed && backgroundWindow.visible) {
|
||||
_bgCommitWindow = true;
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: backgroundWindow
|
||||
ignoreUnknownSignals: true
|
||||
function onFrameSwapped() {
|
||||
if (root._bgCommitWindow)
|
||||
root._bgCommitWindow = false;
|
||||
bgCommitSettleTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,31 +5,28 @@ Item {
|
||||
|
||||
readonly property real edgeSize: 8
|
||||
required property var targetWindow
|
||||
property bool supported: typeof targetWindow.startSystemMove === "function"
|
||||
readonly property bool canMaximize: targetWindow.minimumSize.width !== targetWindow.maximumSize.width || targetWindow.minimumSize.height !== targetWindow.maximumSize.height
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
function tryStartMove() {
|
||||
if (!supported)
|
||||
return;
|
||||
targetWindow.startSystemMove();
|
||||
}
|
||||
|
||||
function tryStartResize(edges) {
|
||||
if (!supported || !canMaximize)
|
||||
if (!canMaximize)
|
||||
return;
|
||||
targetWindow.startSystemResize(edges);
|
||||
}
|
||||
|
||||
function tryToggleMaximize() {
|
||||
if (!supported || !canMaximize)
|
||||
if (!canMaximize)
|
||||
return;
|
||||
targetWindow.maximized = !targetWindow.maximized;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
visible: root.supported && root.canMaximize
|
||||
visible: root.canMaximize
|
||||
height: root.edgeSize
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
@@ -41,7 +38,7 @@ Item {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
visible: root.supported && root.canMaximize
|
||||
visible: root.canMaximize
|
||||
width: root.edgeSize
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
@@ -53,7 +50,7 @@ Item {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
visible: root.supported && root.canMaximize
|
||||
visible: root.canMaximize
|
||||
width: root.edgeSize
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
@@ -65,7 +62,7 @@ Item {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
visible: root.supported && root.canMaximize
|
||||
visible: root.canMaximize
|
||||
width: root.edgeSize
|
||||
height: root.edgeSize
|
||||
anchors.left: parent.left
|
||||
@@ -75,7 +72,7 @@ Item {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
visible: root.supported && root.canMaximize
|
||||
visible: root.canMaximize
|
||||
width: root.edgeSize
|
||||
height: root.edgeSize
|
||||
anchors.right: parent.right
|
||||
@@ -85,7 +82,7 @@ Item {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
visible: root.supported && root.canMaximize
|
||||
visible: root.canMaximize
|
||||
height: root.edgeSize
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
@@ -97,7 +94,7 @@ Item {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
visible: root.supported && root.canMaximize
|
||||
visible: root.canMaximize
|
||||
width: root.edgeSize
|
||||
height: root.edgeSize
|
||||
anchors.left: parent.left
|
||||
@@ -107,7 +104,7 @@ Item {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
visible: root.supported && root.canMaximize
|
||||
visible: root.canMaximize
|
||||
width: root.edgeSize
|
||||
height: root.edgeSize
|
||||
anchors.right: parent.right
|
||||
|
||||
@@ -41,17 +41,8 @@ Item {
|
||||
property string _actionType: ""
|
||||
property bool addingNewKey: false
|
||||
property bool useCustomCompositor: false
|
||||
property var _shortcutInhibitor: null
|
||||
property bool _altShiftGhost: false
|
||||
|
||||
readonly property bool _shortcutInhibitorAvailable: {
|
||||
try {
|
||||
return typeof ShortcutInhibitor !== "undefined";
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var keys: bindData.keys || []
|
||||
readonly property bool hasOverride: {
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
@@ -251,41 +242,17 @@ Item {
|
||||
addingNewKey = false;
|
||||
}
|
||||
|
||||
function _createShortcutInhibitor() {
|
||||
if (!_shortcutInhibitorAvailable || _shortcutInhibitor)
|
||||
return;
|
||||
const qmlString = `
|
||||
import QtQuick
|
||||
import Quickshell.Wayland
|
||||
|
||||
ShortcutInhibitor {
|
||||
enabled: false
|
||||
window: null
|
||||
}
|
||||
`;
|
||||
|
||||
_shortcutInhibitor = Qt.createQmlObject(qmlString, root, "KeybindItem.ShortcutInhibitor");
|
||||
_shortcutInhibitor.enabled = Qt.binding(() => root.recording);
|
||||
_shortcutInhibitor.window = Qt.binding(() => root.panelWindow);
|
||||
}
|
||||
|
||||
function _destroyShortcutInhibitor() {
|
||||
if (_shortcutInhibitor) {
|
||||
_shortcutInhibitor.enabled = false;
|
||||
_shortcutInhibitor.destroy();
|
||||
_shortcutInhibitor = null;
|
||||
}
|
||||
ShortcutInhibitor {
|
||||
window: root.panelWindow
|
||||
enabled: root.recording
|
||||
}
|
||||
|
||||
function startRecording() {
|
||||
_destroyShortcutInhibitor();
|
||||
_createShortcutInhibitor();
|
||||
recording = true;
|
||||
}
|
||||
|
||||
function stopRecording() {
|
||||
recording = false;
|
||||
_destroyShortcutInhibitor();
|
||||
}
|
||||
|
||||
Column {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
@@ -8,7 +10,6 @@ Item {
|
||||
visible: false
|
||||
|
||||
required property var targetWindow
|
||||
property var blurItem: null
|
||||
property bool blurEnabled: Theme.connectedSurfaceBlurEnabled
|
||||
property real blurX: 0
|
||||
property real blurY: 0
|
||||
@@ -16,54 +17,38 @@ Item {
|
||||
property real blurHeight: 0
|
||||
property real blurRadius: 0
|
||||
|
||||
property var _region: null
|
||||
readonly property bool _active: blurEnabled && BlurService.enabled && !!targetWindow
|
||||
|
||||
Region {
|
||||
id: blurRegion
|
||||
x: root.blurX
|
||||
y: root.blurY
|
||||
width: root.blurWidth
|
||||
height: root.blurHeight
|
||||
radius: root.blurRadius
|
||||
}
|
||||
|
||||
function _apply() {
|
||||
if (!blurEnabled || !BlurService.enabled || !targetWindow) {
|
||||
_cleanup();
|
||||
if (!targetWindow)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_region)
|
||||
_region = BlurService.createBlurRegion(targetWindow);
|
||||
|
||||
if (!_region)
|
||||
return;
|
||||
|
||||
_region.item = Qt.binding(() => root.blurItem);
|
||||
_region.x = Qt.binding(() => root.blurX);
|
||||
_region.y = Qt.binding(() => root.blurY);
|
||||
_region.width = Qt.binding(() => root.blurWidth);
|
||||
_region.height = Qt.binding(() => root.blurHeight);
|
||||
_region.radius = Qt.binding(() => root.blurRadius);
|
||||
targetWindow.BackgroundEffect.blurRegion = _active ? blurRegion : null;
|
||||
}
|
||||
|
||||
function _cleanup() {
|
||||
if (!_region)
|
||||
return;
|
||||
BlurService.destroyBlurRegion(targetWindow, _region);
|
||||
_region = null;
|
||||
}
|
||||
|
||||
onBlurEnabledChanged: _apply()
|
||||
|
||||
Connections {
|
||||
target: BlurService
|
||||
function onEnabledChanged() {
|
||||
root._apply();
|
||||
}
|
||||
}
|
||||
on_ActiveChanged: _apply()
|
||||
onTargetWindowChanged: _apply()
|
||||
|
||||
Connections {
|
||||
target: root.targetWindow ?? null
|
||||
ignoreUnknownSignals: true
|
||||
function onVisibleChanged() {
|
||||
if (root.targetWindow && root.targetWindow.visible) {
|
||||
root._region = null;
|
||||
if (root.targetWindow && root.targetWindow.visible)
|
||||
root._apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: _apply()
|
||||
Component.onDestruction: _cleanup()
|
||||
Component.onDestruction: {
|
||||
if (targetWindow)
|
||||
targetWindow.BackgroundEffect.blurRegion = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user