diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-07-02 07:26:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-02 07:26:13 +0200 |
commit | 0636e2a877bd8ce5d932b38d504c0f6996111274 (patch) | |
tree | 725a2f1494d44ebf7d53047d6197303bf1e5841c /scene/gui | |
parent | 3fb5faaceb1dec66315c98a0b6649b6e58272db4 (diff) | |
parent | 058166fb6c07a29f1c18b96d24d66b3e16233310 (diff) |
Merge pull request #40020 from reduz/fix-tree-edit-focus
Fix doubleclick on tree item, restore input focus on previous windows.
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/tree.cpp | 8 | ||||
-rw-r--r-- | scene/gui/tree.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 34161a9e80..1ed5b9e598 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1786,7 +1786,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool case TreeItem::CELL_MODE_STRING: { //nothing in particular - if (select_mode == SELECT_MULTI && (get_tree()->get_event_count() == focus_in_id || !already_cursor)) { + if (select_mode == SELECT_MULTI && (get_viewport()->get_processed_events_count() == focus_in_id || !already_cursor)) { bring_up_editor = false; } @@ -1861,7 +1861,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool } else { editor_text = String::num(p_item->cells[col].val, Math::range_step_decimals(p_item->cells[col].step)); - if (select_mode == SELECT_MULTI && get_tree()->get_event_count() == focus_in_id) { + if (select_mode == SELECT_MULTI && get_viewport()->get_processed_events_count() == focus_in_id) { bring_up_editor = false; } } @@ -2787,7 +2787,7 @@ int Tree::_get_title_button_height() const { void Tree::_notification(int p_what) { if (p_what == NOTIFICATION_FOCUS_ENTER) { - focus_in_id = get_tree()->get_event_count(); + focus_in_id = get_viewport()->get_processed_events_count(); } if (p_what == NOTIFICATION_MOUSE_EXIT) { if (cache.hover_type != Cache::CLICK_NONE) { @@ -3839,7 +3839,7 @@ Tree::Tree() { add_child(popup_menu); // popup_menu->set_as_toplevel(true); - popup_editor = memnew(PopupPanel); + popup_editor = memnew(Popup); popup_editor->set_wrap_controls(true); add_child(popup_editor); popup_editor_vb = memnew(VBoxContainer); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 46842e78a0..511565619a 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -359,11 +359,11 @@ private: VBoxContainer *popup_editor_vb; - PopupPanel *popup_editor; + Popup *popup_editor; LineEdit *text_editor; HSlider *value_editor; bool updating_value_editor; - int64_t focus_in_id; + uint64_t focus_in_id; PopupMenu *popup_menu; Vector<ColumnInfo> columns; |