Better handling of some qt and gtk applications. Used Audacious for testing.
This commit is contained in:
1 parent
300f4a7504
commit
bbe931335f
15 files changed
+507
-16
No files matched your search
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// Authors: Storm Dragon, Angus Kola
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package atspi
|
||||
|
||||
/*
|
||||
#include "adapter_native.h"
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// A hiding submenu can return focus only from its most recently focused
|
||||
// direct item. Queries and the returned reference belong to the GLib owner;
|
||||
// the callback releases the reference after the ordinary foreground gates.
|
||||
func (adapter *Adapter) returned_menu_item(event *C.AtspiEvent, eventType string, origin ObjectID) *C.AtspiAccessible {
|
||||
if eventType != ShowingStateEvent || event.detail1 != 0 || len(adapter.nativeFocus) == 0 {
|
||||
return nil
|
||||
}
|
||||
role := C.atspi_accessible_get_role(event.source, nil)
|
||||
if role != C.ATSPI_ROLE_MENU && role != C.ATSPI_ROLE_POPUP_MENU {
|
||||
return nil
|
||||
}
|
||||
current := adapter.nativeFocus[len(adapter.nativeFocus)-1].source
|
||||
switch C.atspi_accessible_get_role(current, nil) {
|
||||
case C.ATSPI_ROLE_MENU_ITEM, C.ATSPI_ROLE_CHECK_MENU_ITEM, C.ATSPI_ROLE_RADIO_MENU_ITEM:
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
parent := C.atspi_accessible_get_parent(current, nil)
|
||||
if parent == nil {
|
||||
return nil
|
||||
}
|
||||
match := nativeObjectID(parent) == origin
|
||||
C.g_object_unref(C.gpointer(parent))
|
||||
if !match {
|
||||
return nil
|
||||
}
|
||||
return C.cthulhu_returned_menu_item(event.source)
|
||||
}
|
||||
Reference in new issue
Block a user