You've already forked godot
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:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user