You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Color picker was getting too much focus, made it get not as much focus.
This abuse of focus was the original culprit of #5354
This commit is contained in:
@@ -72,13 +72,16 @@ void ColorPicker::_notification(int p_what) {
|
|||||||
_update_color();
|
_update_color();
|
||||||
}
|
}
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
|
||||||
c_text->call_deferred("grab_focus");
|
|
||||||
c_text->call_deferred("select");
|
|
||||||
} break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColorPicker::set_focus_on_line_edit() {
|
||||||
|
|
||||||
|
c_text->grab_focus();
|
||||||
|
c_text->select();
|
||||||
|
}
|
||||||
|
|
||||||
void ColorPicker::_update_controls() {
|
void ColorPicker::_update_controls() {
|
||||||
|
|
||||||
if (edit_alpha) {
|
if (edit_alpha) {
|
||||||
@@ -628,6 +631,7 @@ void ColorPickerButton::pressed() {
|
|||||||
popup->set_pos(get_global_pos()-Size2(0,ms.height));
|
popup->set_pos(get_global_pos()-Size2(0,ms.height));
|
||||||
popup->set_size(ms);
|
popup->set_size(ms);
|
||||||
popup->popup();
|
popup->popup();
|
||||||
|
picker->set_focus_on_line_edit();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ public:
|
|||||||
void set_raw_mode(bool p_enabled);
|
void set_raw_mode(bool p_enabled);
|
||||||
bool is_raw_mode() const;
|
bool is_raw_mode() const;
|
||||||
|
|
||||||
|
void set_focus_on_line_edit();
|
||||||
|
|
||||||
ColorPicker();
|
ColorPicker();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2058,7 +2058,15 @@ void Viewport::_gui_input_event(InputEvent p_event) {
|
|||||||
case InputEvent::JOYSTICK_BUTTON:
|
case InputEvent::JOYSTICK_BUTTON:
|
||||||
case InputEvent::KEY: {
|
case InputEvent::KEY: {
|
||||||
|
|
||||||
|
|
||||||
if (gui.key_focus && !gui.key_focus->is_visible()) {
|
if (gui.key_focus && !gui.key_focus->is_visible()) {
|
||||||
|
Node *c=gui.key_focus;
|
||||||
|
String p;
|
||||||
|
while(c) {
|
||||||
|
p=c->get_type()+"/"+p;
|
||||||
|
c=c->get_parent();
|
||||||
|
}
|
||||||
|
print_line(p);
|
||||||
//key focus must always be visible
|
//key focus must always be visible
|
||||||
gui.key_focus->release_focus();
|
gui.key_focus->release_focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -612,6 +612,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
|
|||||||
color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA);
|
color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA);
|
||||||
color_picker->set_color(v);
|
color_picker->set_color(v);
|
||||||
set_size( Size2(300*EDSCALE, color_picker->get_combined_minimum_size().height+10*EDSCALE));
|
set_size( Size2(300*EDSCALE, color_picker->get_combined_minimum_size().height+10*EDSCALE));
|
||||||
|
color_picker->set_focus_on_line_edit();
|
||||||
/*
|
/*
|
||||||
int ofs=80;
|
int ofs=80;
|
||||||
int m=10;
|
int m=10;
|
||||||
|
|||||||
Reference in New Issue
Block a user