diff --git a/src/guiengine/screen_keyboard.cpp b/src/guiengine/screen_keyboard.cpp index 22619ef7b..1e094dabf 100644 --- a/src/guiengine/screen_keyboard.cpp +++ b/src/guiengine/screen_keyboard.cpp @@ -83,6 +83,7 @@ ScreenKeyboard::ScreenKeyboard(float percent_width, float percent_height, m_edit_box = edit_box; m_back_button = NULL; m_repeat_time = 0; + m_back_button_pressed = false; init(); } // ScreenKeyboard @@ -264,7 +265,7 @@ void ScreenKeyboard::assignButtons(ButtonsType buttons_type) void ScreenKeyboard::onUpdate(float dt) { - if (m_back_button->isPressed()) + if (m_back_button->isPressed() || m_back_button_pressed) { const unsigned int repeat_rate = 40; const unsigned int repeat_delay = 400; @@ -290,8 +291,10 @@ void ScreenKeyboard::onUpdate(float dt) m_repeat_time += (unsigned int)(dt * 1000); } - else + + if (!m_back_button->isPressed()) { + m_back_button_pressed = false; m_repeat_time = 0; } } @@ -348,6 +351,7 @@ EventPropagation ScreenKeyboard::processEvent(const std::string& eventSource) else if (eventSource == "Back") { send_event = false; + m_back_button_pressed = true; } else if (eventSource == "Space") { diff --git a/src/guiengine/screen_keyboard.hpp b/src/guiengine/screen_keyboard.hpp index bbb12fd5c..a1236ecf1 100644 --- a/src/guiengine/screen_keyboard.hpp +++ b/src/guiengine/screen_keyboard.hpp @@ -71,6 +71,9 @@ namespace GUIEngine /** A time for repeat key feature */ unsigned int m_repeat_time; + /** True if backspace button was pressed */ + bool m_back_button_pressed; + /** The edit box that is assigned to the keyboard */ CGUIEditBox* m_edit_box;