Fix Script Editor drawing over Dialogs.

Resets the z-index when focus is lost and the completion is shown.

Fixes #6769

(cherry picked from commit f73b501d6f)
This commit is contained in:
Andreas Haas 2016-10-10 13:21:37 +02:00 committed by Rémi Verschelde
parent 220bcbf7c0
commit ed2c369785
2 changed files with 14 additions and 2 deletions

View file

@ -1231,15 +1231,19 @@ void TextEdit::_notification(int p_what) {
}
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->show_virtual_keyboard(get_text(),get_global_rect());
if (raised_from_completion) {
VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 1);
}
} break;
case NOTIFICATION_FOCUS_EXIT: {
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->hide_virtual_keyboard();
if (raised_from_completion) {
VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 0);
}
} break;
}
}
@ -4105,6 +4109,7 @@ void TextEdit::_confirm_completion() {
void TextEdit::_cancel_code_hint() {
VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 0);
raised_from_completion = false;
completion_hint="";
update();
}
@ -4112,6 +4117,7 @@ void TextEdit::_cancel_code_hint() {
void TextEdit::_cancel_completion() {
VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 0);
raised_from_completion = false;
if (!completion_active)
return;
@ -4292,6 +4298,7 @@ void TextEdit::query_code_comple() {
void TextEdit::set_code_hint(const String& p_hint) {
VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 1);
raised_from_completion = true;
completion_hint=p_hint;
completion_hint_offset=-0xFFFF;
update();
@ -4300,6 +4307,7 @@ void TextEdit::set_code_hint(const String& p_hint) {
void TextEdit::code_complete(const Vector<String> &p_strings) {
VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 1);
raised_from_completion = true;
completion_strings=p_strings;
completion_active=true;
completion_current="";
@ -4653,6 +4661,8 @@ TextEdit::TextEdit() {
insert_mode = false;
window_has_focus=true;
raised_from_completion = false;
menu = memnew( PopupMenu );
add_child(menu);
menu->add_item(TTR("Cut"),MENU_CUT,KEY_MASK_CMD|KEY_X);

View file

@ -243,6 +243,8 @@ class TextEdit : public Control {
bool cut_copy_line;
bool insert_mode;
bool raised_from_completion;
uint64_t last_dblclk;
Timer *idle_detect;