Skip to content

Commit

Permalink
Focus all windows only on mouse clicks
Browse files Browse the repository at this point in the history
This makes OptionButtons usable again, as their window would otherwise get instantly focused by any input event, closing their popup.
  • Loading branch information
Riteo Siuga committed Feb 21, 2021
1 parent dc1ae06 commit 065181a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,15 +890,18 @@ void Window::_window_input(const Ref<InputEvent> &p_ev) {
}

if (exclusive_child != nullptr) {
Window *focus_target = exclusive_child;
focus_target->grab_focus();
while (focus_target->exclusive_child != nullptr) {
focus_target = focus_target->exclusive_child;
Ref<InputEventMouseButton> b = p_ev;
if (b.is_valid() && b->is_pressed() && b->get_button_index() == 0) {
Window *focus_target = exclusive_child;
focus_target->grab_focus();
}
while (focus_target->exclusive_child != nullptr) {
focus_target = focus_target->exclusive_child;
focus_target->grab_focus();
}

if (!is_embedding_subwindows()) { //not embedding, no need for event
return;
if (!is_embedding_subwindows()) { //not embedding, no need for event
return;
}
}
}

Expand Down

0 comments on commit 065181a

Please sign in to comment.