mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Hide Control focus when given via mouse input
This commit is contained in:
parent
2753d333f6
commit
aeb3a45c97
53 changed files with 229 additions and 105 deletions
|
|
@ -599,10 +599,10 @@ void FindReplaceBar::_show_search(bool p_with_replace, bool p_show_only) {
|
|||
|
||||
if (focus_replace) {
|
||||
search_text->deselect();
|
||||
callable_mp((Control *)replace_text, &Control::grab_focus).call_deferred();
|
||||
callable_mp((Control *)replace_text, &Control::grab_focus).call_deferred(false);
|
||||
} else {
|
||||
replace_text->deselect();
|
||||
callable_mp((Control *)search_text, &Control::grab_focus).call_deferred();
|
||||
callable_mp((Control *)search_text, &Control::grab_focus).call_deferred(false);
|
||||
}
|
||||
|
||||
if (on_one_line) {
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ void CreateDialog::_notification(int p_what) {
|
|||
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (is_visible()) {
|
||||
callable_mp((Control *)search_box, &Control::grab_focus).call_deferred(); // Still not visible.
|
||||
callable_mp((Control *)search_box, &Control::grab_focus).call_deferred(false); // Still not visible.
|
||||
search_box->select_all();
|
||||
} else {
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size()));
|
||||
|
|
|
|||
|
|
@ -482,9 +482,9 @@ void EditorFileDialog::_post_popup() {
|
|||
set_current_dir(current);
|
||||
|
||||
if (mode == FILE_MODE_SAVE_FILE) {
|
||||
file->grab_focus();
|
||||
file->grab_focus(true);
|
||||
} else {
|
||||
item_list->grab_focus();
|
||||
item_list->grab_focus(true);
|
||||
}
|
||||
|
||||
bool is_open_directory_mode = mode == FILE_MODE_OPEN_DIR;
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ void EditorSpinSlider::_grab_end() {
|
|||
grabbing_spinner = false;
|
||||
emit_signal("ungrabbed");
|
||||
} else {
|
||||
_focus_entered();
|
||||
_focus_entered(true);
|
||||
}
|
||||
|
||||
grabbing_spinner_attempt = false;
|
||||
|
|
@ -204,7 +204,7 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) {
|
|||
grabbing_ratio = get_as_ratio();
|
||||
grabbing_from = grabber->get_transform().xform(mb->get_position()).x;
|
||||
}
|
||||
grab_focus();
|
||||
grab_focus(true);
|
||||
emit_signal("grabbed");
|
||||
} else {
|
||||
grabbing_grabber = false;
|
||||
|
|
@ -340,7 +340,7 @@ void EditorSpinSlider::_draw_spin_slider() {
|
|||
}
|
||||
}
|
||||
|
||||
if (has_focus()) {
|
||||
if (has_focus(true)) {
|
||||
Ref<StyleBox> focus = get_theme_stylebox(SNAME("focus"), SNAME("LineEdit"));
|
||||
draw_style_box(focus, Rect2(Vector2(), size));
|
||||
}
|
||||
|
|
@ -672,7 +672,7 @@ bool EditorSpinSlider::is_grabbing() const {
|
|||
return grabbing_grabber || grabbing_spinner;
|
||||
}
|
||||
|
||||
void EditorSpinSlider::_focus_entered() {
|
||||
void EditorSpinSlider::_focus_entered(bool p_hide_focus) {
|
||||
if (read_only) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -683,7 +683,7 @@ void EditorSpinSlider::_focus_entered() {
|
|||
value_input->set_focus_next(find_next_valid_focus()->get_path());
|
||||
value_input->set_focus_previous(find_prev_valid_focus()->get_path());
|
||||
callable_mp((CanvasItem *)value_input_popup, &CanvasItem::show).call_deferred();
|
||||
callable_mp((Control *)value_input, &Control::grab_focus).call_deferred();
|
||||
callable_mp((Control *)value_input, &Control::grab_focus).call_deferred(p_hide_focus);
|
||||
callable_mp(value_input, &LineEdit ::select_all).call_deferred();
|
||||
emit_signal("value_focus_entered");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ protected:
|
|||
static void _bind_methods();
|
||||
void _grabber_mouse_entered();
|
||||
void _grabber_mouse_exited();
|
||||
void _focus_entered();
|
||||
void _focus_entered(bool p_hide_focus = false);
|
||||
|
||||
public:
|
||||
String get_tooltip(const Point2 &p_pos) const override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue