From ecac522c7f5500145ca35c05ce76cd0140f04f0d Mon Sep 17 00:00:00 2001 From: ysj1173886760 <1173886760@qq.com> Date: Fri, 28 May 2021 19:42:37 +0800 Subject: [PATCH] GRAPHICS: MACGUI: make mactext can scrollable now --- graphics/macgui/mactext.cpp | 16 +++++++++------- graphics/macgui/macwindow.cpp | 6 ++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index 15f22063b52..83eea89128e 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -1028,21 +1028,23 @@ bool MacText::draw(bool forceRedraw) { return false; } - // TODO: Clear surface fully when background colour changes. - _contentIsDirty = false; - _cursorDirty = false; - // if we are drawing the selection, then we better clear the surface // let me explain here, sometimes, when we are render the text in _surface, we may not render the whole line // such as, a line only contains \n, thus, we may only render part of this line // when we are drawing the selection, it will reverse all the pixels in selected area. And when you only render part of a line in selected area // drawSelection will reverse that not rendered part again and again, and which will lead to blinking - Common::Point offset(calculateOffset()); - - if (_selectedText.endY != -1) + // we need to find out a way to judge whether we need to clear the surface + // currently, we just use the _contentIsDirty + if (_selectedText.endY != -1 || _contentIsDirty) _composeSurface->clear(_bgcolor); + // TODO: Clear surface fully when background colour changes. + _contentIsDirty = false; + _cursorDirty = false; + + Common::Point offset(calculateOffset()); + if (!_cursorState) _composeSurface->blitFrom(*_cursorSurface2, *_cursorRect, Common::Point(_cursorX, _cursorY + offset.y + 1)); diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp index 47b73ed54a4..8cbd9948579 100644 --- a/graphics/macgui/macwindow.cpp +++ b/graphics/macgui/macwindow.cpp @@ -493,6 +493,12 @@ bool MacWindow::processEvent(Common::Event &event) { return false; + case Common::EVENT_WHEELUP: + case Common::EVENT_WHEELDOWN: + if (_wm->getActiveWidget() && _wm->getActiveWidget()->processEvent(event)) + return true; + return false; + default: return false; }