aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/macgui/mactextwindow.cpp15
-rw-r--r--graphics/macgui/mactextwindow.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 0d801ab286..6d25701ad7 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -47,9 +47,11 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
_fontRef = wm->_fontMan->getFont(*font);
- _inputTextHeight = 1;
+ _inputTextHeight = 0;
_maxWidth = maxWidth;
+ _inputIsDirty = true;
+
_scrollPos = 0;
_cursorX = 0;
@@ -113,7 +115,7 @@ const MacFont *MacTextWindow::getTextWindowFont() {
}
bool MacTextWindow::draw(ManagedSurface *g, bool forceRedraw) {
- if (!_borderIsDirty && !_contentIsDirty && !_cursorDirty && !forceRedraw)
+ if (!_borderIsDirty && !_contentIsDirty && !_cursorDirty && !_inputIsDirty && !forceRedraw)
return false;
if (_borderIsDirty || forceRedraw) {
@@ -122,6 +124,11 @@ bool MacTextWindow::draw(ManagedSurface *g, bool forceRedraw) {
_composeSurface.clear(kColorWhite);
}
+ if (_inputIsDirty || forceRedraw) {
+ drawInput();
+ _inputIsDirty = false;
+ }
+
_contentIsDirty = false;
// Compose
@@ -147,7 +154,7 @@ bool MacTextWindow::processEvent(Common::Event &event) {
case Common::KEYCODE_BACKSPACE:
if (!_inputText.empty()) {
_inputText.deleteLastChar();
- drawInput();
+ _inputIsDirty = true;
}
break;
@@ -160,7 +167,7 @@ bool MacTextWindow::processEvent(Common::Event &event) {
if (event.kbd.ascii >= 0x20 && event.kbd.ascii <= 0x7f) {
_inputText += (char)event.kbd.ascii;
- drawInput();
+ _inputIsDirty = true;
return true;
}
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index db9b5a1cf9..5ed507b07b 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -100,6 +100,7 @@ private:
int _maxWidth;
Common::String _inputText;
uint _inputTextHeight;
+ bool _inputIsDirty;
};