diff --git a/src/gui/widget/keyboard_input.cpp b/src/gui/widget/keyboard_input.cpp index 72cd73dfc..a7f574cfe 100644 --- a/src/gui/widget/keyboard_input.cpp +++ b/src/gui/widget/keyboard_input.cpp @@ -199,6 +199,8 @@ CKeyboardInput::CKeyboardInput(const neutrino_locale_t Name, std::string* Value, caps = 0; srow = scol = 0; focus = FOCUS_STRING; + force_saveScreen = false; + pixBuf = NULL; } CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int Size, CChangeObserver* Observ, const char * const Icon, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2) @@ -221,6 +223,8 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int caps = 0; srow = scol = 0; focus = FOCUS_STRING; + force_saveScreen = false; + pixBuf = NULL; } CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int Size, CChangeObserver* Observ, const char * const Icon, std::string HintText_1, std::string HintText_2) @@ -243,6 +247,8 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int caps = 0; srow = scol = 0; focus = FOCUS_STRING; + force_saveScreen = false; + pixBuf = NULL; } CKeyboardInput::~CKeyboardInput() @@ -515,6 +521,15 @@ std::string &CKeyboardInput::getValue(void) return *valueString; } +void CKeyboardInput::forceSaveScreen(bool enable) +{ + force_saveScreen = enable; + if (!enable && pixBuf) { + delete[] pixBuf; + pixBuf = NULL; + } +} + int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) { neutrino_msg_t msg; @@ -528,11 +543,12 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) std::string oldval = *valueString; - fb_pixel_t * pixbuf = NULL; - if (!parent) { - pixbuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)]; - if (pixbuf) - frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf); + if (pixBuf) + delete[] pixBuf; + if (!parent || force_saveScreen) { + pixBuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)]; + if (pixBuf) + frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf); } paint(); @@ -624,10 +640,12 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) } } - if (pixbuf) + if (pixBuf) { - frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf); - delete[] pixbuf; + frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf); + delete[] pixBuf; + pixBuf = NULL; + frameBuffer->blit(); } else hide(); diff --git a/src/gui/widget/keyboard_input.h b/src/gui/widget/keyboard_input.h index 009934b4a..1003e7f39 100644 --- a/src/gui/widget/keyboard_input.h +++ b/src/gui/widget/keyboard_input.h @@ -101,6 +101,8 @@ class CKeyboardInput : public CMenuTarget int selected; bool changed; CChangeObserver * observ; + bool force_saveScreen; + fb_pixel_t *pixBuf; virtual void init(); @@ -133,6 +135,8 @@ class CKeyboardInput : public CMenuTarget void hide(); int exec( CMenuTarget* parent, const std::string & actionKey ); virtual std::string &getValue(void); + + void forceSaveScreen(bool enable); }; #endif