Fix for repeating in some instances, e.g. pidgin.

This commit is contained in:
Storm Dragon committed 2026-10-27 19:40:17 -04:00
1 parent 4d29f2bb23
commit b232c1eebb
20 files changed
+921 -7

No files matched your search

+24 -1
View File
@@ -71,7 +71,7 @@ func (adapter *Adapter) matchForeground(window *C.AtspiAccessible, id ObjectID,
if !state.Known {
return true
}
if state.Window == 0 || window == nil {
if window == nil {
if check != nil {
check.Reason = "no X11 foreground window or accessible window"
}
@@ -82,6 +82,18 @@ func (adapter *Adapter) matchForeground(window *C.AtspiAccessible, id ObjectID,
check.AccessiblePID = pid
}
pid = adapter.foregroundProcessID(pid)
// Desktop panel menus can grab the keyboard while X11 still names the
// previous application. Orca accepts their active, showing menu window.
// Keep the correlated X11 owner so dismissal can return to that client.
if adapter.is_panel_menu(window) {
return true
}
if state.Window == 0 {
if check != nil {
check.Reason = "no X11 foreground window or accessible window"
}
return false
}
if adapter.foregroundWindow.Valid() {
if adapter.foregroundWindow == id {
return true
@@ -165,6 +177,17 @@ func (adapter *Adapter) matchForeground(window *C.AtspiAccessible, id ObjectID,
return true
}
// The exception is for a native menu from the panel process, never an
// arbitrary panel control or a provider claiming the panel's accessible name.
// Query fresh window state on the GLib owner; no popup state is retained.
func (adapter *Adapter) is_panel_menu(window *C.AtspiAccessible) bool {
if adapter.applicationProcess(window) != "mate-panel" {
return false
}
C.atspi_accessible_clear_cache_single(window)
return C.cthulhu_active_menu_window(window) != 0
}
func (adapter *Adapter) replacesForegroundWindow(window *C.AtspiAccessible, id ObjectID, foregroundPID, pid int) bool {
if foregroundPID <= 0 || pid != foregroundPID || id.BusName != adapter.foregroundWindow.BusName {
return false