1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-30 00:12:50 -05:00

Fix excessive TopBar repaints, dont mask animating area

This commit is contained in:
bbedward
2025-09-22 00:48:15 -04:00
parent 897f48d151
commit 50f6dfa709

View File

@@ -138,22 +138,41 @@ PanelWindow {
exclusiveZone: (!SettingsData.topBarVisible || topBarCore.autoHide) ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing + SettingsData.topBarBottomGap - 2 exclusiveZone: (!SettingsData.topBarVisible || topBarCore.autoHide) ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing + SettingsData.topBarBottomGap - 2
mask: Region { Item {
item: topBarMouseArea id: inputMask
anchors {
top: parent.top
left: parent.left
right: parent.right
}
height: (topBarCore.autoHide && !topBarCore.reveal) ? 8 : (root.effectiveBarHeight + SettingsData.topBarSpacing)
} }
mask: Region {
item: inputMask
}
Item { Item {
id: topBarCore id: topBarCore
anchors.fill: parent anchors.fill: parent
property real backgroundTransparency: SettingsData.topBarTransparency property real backgroundTransparency: SettingsData.topBarTransparency
property bool autoHide: SettingsData.topBarAutoHide property bool autoHide: SettingsData.topBarAutoHide
property bool revealSticky: false
Timer {
id: revealHold
interval: 250
repeat: false
onTriggered: topBarCore.revealSticky = false
}
property bool reveal: { property bool reveal: {
if (CompositorService.isNiri && NiriService.inOverview) { if (CompositorService.isNiri && NiriService.inOverview) {
return SettingsData.topBarOpenOnOverview return SettingsData.topBarOpenOnOverview
} }
return SettingsData.topBarVisible && (!autoHide || topBarMouseArea.containsMouse || hasActivePopout) return SettingsData.topBarVisible && (!autoHide || topBarMouseArea.containsMouse || hasActivePopout || revealSticky)
} }
property var notepadInstance: null property var notepadInstance: null
@@ -208,10 +227,31 @@ PanelWindow {
target: SettingsData target: SettingsData
} }
Connections {
target: topBarMouseArea
function onContainsMouseChanged() {
if (topBarMouseArea.containsMouse) {
topBarCore.revealSticky = true
revealHold.stop()
} else {
if (topBarCore.autoHide && !topBarCore.hasActivePopout) {
revealHold.restart()
}
}
}
}
onHasActivePopoutChanged: {
if (!hasActivePopout && autoHide && !topBarMouseArea.containsMouse) {
revealSticky = true
revealHold.restart()
}
}
MouseArea { MouseArea {
id: topBarMouseArea id: topBarMouseArea
y: 0 y: 0
height: topBarCore.reveal ? (root.effectiveBarHeight + SettingsData.topBarSpacing) : 4 height: root.effectiveBarHeight + SettingsData.topBarSpacing
anchors { anchors {
top: parent.top top: parent.top
left: parent.left left: parent.left
@@ -219,13 +259,7 @@ PanelWindow {
} }
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
enabled: true
Behavior on height {
NumberAnimation {
duration: 200
easing.type: Easing.OutCubic
}
}
Item { Item {
id: topBarContainer id: topBarContainer
@@ -265,7 +299,6 @@ PanelWindow {
property real rb : SettingsData.topBarGothCornersEnabled ? root._wingR : 0 property real rb : SettingsData.topBarGothCornersEnabled ? root._wingR : 0
property real rt : SettingsData.topBarSquareCorners ? 0 : Theme.cornerRadius property real rt : SettingsData.topBarSquareCorners ? 0 : Theme.cornerRadius
onHChanged: requestPaint()
onRbChanged: requestPaint() onRbChanged: requestPaint()
onRtChanged: requestPaint() onRtChanged: requestPaint()
@@ -323,7 +356,6 @@ PanelWindow {
Connections { Connections {
target: barShape target: barShape
function onHChanged() { barTint.requestPaint() }
function onRbChanged() { barTint.requestPaint() } function onRbChanged() { barTint.requestPaint() }
function onRtChanged() { barTint.requestPaint() } function onRtChanged() { barTint.requestPaint() }
} }
@@ -1112,4 +1144,5 @@ PanelWindow {
} }
} }
} }