fix: black screen resume / pause (#2400)

This commit is contained in:
NickVs2015
2026-03-24 17:13:31 +03:00
committed by GitHub
parent 4103c5bbcf
commit 36b1a863bf
7 changed files with 58 additions and 7 deletions
+14 -6
View File
@@ -23,17 +23,25 @@ Window {
if (Qt.application.state === Qt.ApplicationActive) {
root.visible = true
refreshTimer.restart()
} else if (Qt.application.state === Qt.ApplicationSuspended) {
// Hide window to stop the Qt render loop and prevent
// eglSwapBuffers from being called on a lost EGL context.
// NOTE: Do NOT hide on ApplicationInactive — that fires on any
// focus change (IME, notifications) and would blank the screen.
root.visible = false
}
}
}
}
// Hide the window immediately when Android Activity.onPause() fires so that
// Qt's render loop stops before the EGL surface is disconnected. This
// prevents "QRhiGles2: Failed to make context current" and the resulting
// black screen that appears after swiping home and returning.
Connections {
target: SettingsController
function onActivityPaused() {
if (Qt.platform.os === "android") root.visible = false
}
function onActivityResumed() {
if (Qt.platform.os === "android") root.visible = true
}
}
Timer {
id: refreshTimer
interval: 150