mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
[Accessibility] Process non-focusable windows (popups, menus) as part of the parent window tree.
This commit is contained in:
@@ -246,10 +246,10 @@ void SceneTree::_process_accessibility_changes(DisplayServer::WindowID p_window_
|
||||
Vector<ObjectID> processed;
|
||||
for (const ObjectID &id : accessibility_change_queue) {
|
||||
Node *node = Object::cast_to<Node>(ObjectDB::get_instance(id));
|
||||
if (!node || !node->get_window()) {
|
||||
if (!node || !node->get_non_popup_window() || !node->get_window()->is_visible()) {
|
||||
processed.push_back(id);
|
||||
continue; // Invalid node, remove from list and skip.
|
||||
} else if (node->get_window()->get_window_id() != p_window_id) {
|
||||
} else if (node->get_non_popup_window()->get_window_id() != p_window_id) {
|
||||
continue; // Another window, skip.
|
||||
}
|
||||
node->notification(Node::NOTIFICATION_ACCESSIBILITY_UPDATE);
|
||||
@@ -267,6 +267,15 @@ void SceneTree::_process_accessibility_changes(DisplayServer::WindowID p_window_
|
||||
w_this = w_focus;
|
||||
}
|
||||
|
||||
// Popups have no native window focus, but have focused element.
|
||||
DisplayServer::WindowID popup_id = DisplayServer::get_singleton()->window_get_active_popup();
|
||||
if (popup_id != DisplayServer::INVALID_WINDOW_ID) {
|
||||
Window *popup_w = Window::get_from_id(popup_id);
|
||||
if (popup_w && w_this->is_ancestor_of(popup_w)) {
|
||||
w_this = popup_w;
|
||||
}
|
||||
}
|
||||
|
||||
RID new_focus_element;
|
||||
Control *n_focus = w_this->gui_get_focus_owner();
|
||||
if (n_focus && !n_focus->is_part_of_edited_scene()) {
|
||||
|
||||
Reference in New Issue
Block a user