Keep the bar on top: re-assert topmost if Windows drops it

This commit is contained in:
2026-11-08 17:19:02 +00:00
parent 4f05e6e411
commit 40370fce29
+12
View File
@@ -437,6 +437,17 @@ func setTaskbarState(owner uintptr, state uintptr) {
appBar(abmSetState, &abd) appBar(abmSetState, &abd)
} }
// keepOnTop puts the bar back in the topmost band if Windows or another program
// has knocked it out of it, which otherwise sinks it under every other window.
func keepOnTop(hwnd uintptr) {
ex, _, _ := pGetWindowLongPtr.Call(hwnd, neg(-20))
if ex&wsExTopmost != 0 {
return
}
const swpNoSize, swpNoMove = 0x0001, 0x0002
pSetWindowPos.Call(hwnd, hwndTopmost, 0, 0, 0, 0, swpNoSize|swpNoMove|swpNoActivate)
}
func hideTaskbar() { func hideTaskbar() {
tb := findTaskbar() tb := findTaskbar()
if tb == 0 { if tb == 0 {
@@ -983,6 +994,7 @@ func wndProc(hwnd, m, wparam, lparam uintptr) (result uintptr) {
return 0 return 0
} }
hideTaskbar() hideTaskbar()
keepOnTop(hwnd)
tick++ tick++
changed := refreshApps(tick%16 == 0) changed := refreshApps(tick%16 == 0)
if gmTick(tick) { if gmTick(tick) {