Line edit caret no longer draws on focus loss
This commit is contained in:
parent
c85f27c973
commit
e09e036565
2 changed files with 20 additions and 0 deletions
|
@ -550,8 +550,22 @@ void LineEdit::_notification(int p_what) {
|
|||
set_cursor_pos( get_cursor_pos() );
|
||||
|
||||
} break;
|
||||
case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
|
||||
window_has_focus = true;
|
||||
draw_caret = true;
|
||||
update();
|
||||
} break;
|
||||
case MainLoop::NOTIFICATION_WM_FOCUS_OUT: {
|
||||
window_has_focus = false;
|
||||
draw_caret = false;
|
||||
update();
|
||||
} break;
|
||||
case NOTIFICATION_DRAW: {
|
||||
|
||||
if ((!has_focus() && !menu->has_focus()) || !window_has_focus) {
|
||||
draw_caret = false;
|
||||
}
|
||||
|
||||
int width,height;
|
||||
|
||||
Size2 size=get_size();
|
||||
|
@ -644,6 +658,10 @@ void LineEdit::_notification(int p_what) {
|
|||
} break;
|
||||
case NOTIFICATION_FOCUS_ENTER: {
|
||||
|
||||
if (!caret_blink_enabled) {
|
||||
draw_caret = true;
|
||||
}
|
||||
|
||||
if (OS::get_singleton()->has_virtual_keyboard())
|
||||
OS::get_singleton()->show_virtual_keyboard(get_text(),get_global_rect());
|
||||
|
||||
|
@ -1228,6 +1246,7 @@ LineEdit::LineEdit() {
|
|||
cached_width = 0;
|
||||
cursor_pos=0;
|
||||
window_pos=0;
|
||||
window_has_focus=true;
|
||||
max_length = 0;
|
||||
pass=false;
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ private:
|
|||
Timer *caret_blink_timer;
|
||||
bool caret_blink_enabled;
|
||||
bool draw_caret;
|
||||
bool window_has_focus;
|
||||
|
||||
void shift_selection_check_pre(bool);
|
||||
void shift_selection_check_post(bool);
|
||||
|
|
Loading…
Reference in a new issue