1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

modals: more focus fixes

This commit is contained in:
bbedward
2025-11-10 09:40:28 -05:00
parent 7b3d2ab85a
commit af95631a1d
3 changed files with 34 additions and 41 deletions

View File

@@ -52,11 +52,15 @@ PanelWindow {
closeTimer.stop()
shouldBeVisible = true
visible = true
focusScope.forceActiveFocus()
shouldHaveFocus = false
Qt.callLater(() => {
shouldHaveFocus = Qt.binding(() => shouldBeVisible)
})
}
function close() {
shouldBeVisible = false
shouldHaveFocus = false
closeTimer.restart()
}
@@ -76,11 +80,6 @@ PanelWindow {
onVisibleChanged: {
if (root.visible) {
opened()
Qt.callLater(() => {
if (shouldHaveFocus) {
focusScope.forceActiveFocus()
}
})
} else {
if (Qt.inputMethod) {
Qt.inputMethod.hide()
@@ -90,12 +89,6 @@ PanelWindow {
}
}
onShouldHaveFocusChanged: {
if (shouldHaveFocus && shouldBeVisible && visible) {
Qt.callLater(() => focusScope.forceActiveFocus())
}
}
Connections {
function onCloseAllModalsExcept(excludedModal) {
if (excludedModal !== root && !allowStacking && shouldBeVisible) {
@@ -315,20 +308,5 @@ PanelWindow {
event.accepted = true
}
}
onVisibleChanged: {
if (visible && shouldHaveFocus) {
Qt.callLater(() => focusScope.forceActiveFocus())
}
}
Connections {
function onShouldHaveFocusChanged() {
if (shouldHaveFocus && shouldBeVisible) {
Qt.callLater(() => focusScope.forceActiveFocus())
}
}
target: root
}
}
}