1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

Forward mouse events to embedded no-focus windows.

This commit is contained in:
Pāvels Nadtočajevs
2025-07-29 12:10:24 +03:00
parent c81fd6c512
commit 3b12b3402f
2 changed files with 19 additions and 1 deletions

View File

@@ -4686,7 +4686,7 @@ void EditorHelpBitTooltip::popup_under_cursor() {
// When `FLAG_POPUP` is false, it prevents the editor from losing focus when displaying the tooltip. // When `FLAG_POPUP` is false, it prevents the editor from losing focus when displaying the tooltip.
// This way, clicks and double-clicks are still available outside the tooltip. // This way, clicks and double-clicks are still available outside the tooltip.
set_flag(Window::FLAG_POPUP, false); set_flag(Window::FLAG_POPUP, false);
set_flag(Window::FLAG_NO_FOCUS, !is_embedded()); set_flag(Window::FLAG_NO_FOCUS, true);
popup(r); popup(r);
} }

View File

@@ -3092,6 +3092,24 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) {
} }
if (!gui.subwindow_focused) { if (!gui.subwindow_focused) {
// No window focus, check for unfocusable windows under the cursor.
Ref<InputEventMouse> me = p_event;
if (me.is_valid()) {
for (int i = gui.sub_windows.size() - 1; i >= 0; i--) {
const SubWindow &sw = gui.sub_windows[i];
if (!sw.window->get_flag(Window::FLAG_NO_FOCUS) || sw.window->get_flag(Window::FLAG_MOUSE_PASSTHROUGH)) {
continue;
}
Rect2i r = Rect2i(sw.window->get_position(), sw.window->get_size());
if (r.has_point(me->get_position())) {
Transform2D window_ofs;
window_ofs.set_origin(-sw.window->get_position());
Ref<InputEvent> ev = p_event->xformed_by(window_ofs);
sw.window->_window_input(ev);
return true;
}
}
}
return false; return false;
} }