aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorEugene Sandulenko2017-08-02 17:27:47 +0200
committerEugene Sandulenko2017-08-04 21:54:19 +0200
commitbc8d059f38f4904af588522ebbc284ad1749f5cf (patch)
treeb437723a14f3e12b9724935d55fe8440edc60bbf /graphics
parent61eb58186c64364f39688ceb7c6122192ef5c36b (diff)
downloadscummvm-rg350-bc8d059f38f4904af588522ebbc284ad1749f5cf.tar.gz
scummvm-rg350-bc8d059f38f4904af588522ebbc284ad1749f5cf.tar.bz2
scummvm-rg350-bc8d059f38f4904af588522ebbc284ad1749f5cf.zip
GRAPHICS: MACGUI: Draw input on MacTextWindow redraw
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;
};