From d2554a73fb586166c774b7197f8e05d4c85387a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 3 Nov 2018 22:13:42 -0700 Subject: GLK: Fix refreshing grid windows when text is changed --- engines/gargoyle/detection.cpp | 3 +-- engines/gargoyle/events.cpp | 22 ++++++++-------------- engines/gargoyle/events.h | 8 +++++++- engines/gargoyle/glk.cpp | 23 ++++++++++++++--------- engines/gargoyle/windows.cpp | 2 +- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/engines/gargoyle/detection.cpp b/engines/gargoyle/detection.cpp index 8c0580a878..04218b10e0 100644 --- a/engines/gargoyle/detection.cpp +++ b/engines/gargoyle/detection.cpp @@ -128,8 +128,7 @@ bool GargoyleMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || - (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail); + (f == kSavesSupportMetaInfo); } bool Gargoyle::GargoyleEngine::hasFeature(EngineFeature f) const { diff --git a/engines/gargoyle/events.cpp b/engines/gargoyle/events.cpp index d5eccfeba1..40888b13ec 100644 --- a/engines/gargoyle/events.cpp +++ b/engines/gargoyle/events.cpp @@ -32,17 +32,19 @@ Events::Events() : _forceClick(false), _currentEvent(nullptr), _timeouts(false), _priorFrameTime(0), _frameCounter(0) { } -bool Events::checkForNextFrameCounter() { +void Events::checkForNextFrameCounter() { // Check for next game frame uint32 milli = g_system->getMillis(); if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { ++_frameCounter; _priorFrameTime = milli; - return true; + if (_redraw) + g_vm->_windows->redraw(); + _redraw = false; + g_vm->_screen->update(); + return; } - - return false; } void Events::getEvent(event_t *event, bool polled) { @@ -106,11 +108,7 @@ void Events::dispatchEvent(Event &ev, bool polled) { void Events::pollEvents() { Common::Event event; - - if (checkForNextFrameCounter()) { - // Update the screen - g_vm->_screen->update(); - } + checkForNextFrameCounter(); do { g_system->getEventManager()->pollEvent(event); @@ -232,11 +230,7 @@ void Events::waitForPress() { do { g_system->getEventManager()->pollEvent(e); g_system->delayMillis(10); - - if (checkForNextFrameCounter()) { - // Update the screen - g_vm->_screen->update(); - } + checkForNextFrameCounter(); } while (!g_vm->shouldQuit() && e.type != Common::EVENT_KEYDOWN && e.type != Common::EVENT_LBUTTONDOWN && e.type != Common::EVENT_RBUTTONDOWN && e.type != Common::EVENT_MBUTTONDOWN); diff --git a/engines/gargoyle/events.h b/engines/gargoyle/events.h index 70e7af4cdf..1347200d4a 100644 --- a/engines/gargoyle/events.h +++ b/engines/gargoyle/events.h @@ -153,11 +153,12 @@ private: bool _timeouts; ///< Timer timeouts flag uint32 _priorFrameTime; ///< Time of prior game frame uint32 _frameCounter; ///< Frame counter + bool _redraw; ///< Screen needed redrawing private: /** * Checks for whether it's time for the next game frame */ - bool checkForNextFrameCounter(); + void checkForNextFrameCounter(); /** * Dispatches an event @@ -225,6 +226,11 @@ public: * Set the total number of frames played */ void Events::setTotalPlayTicks(uint frames) { _frameCounter = frames; } + + /** + * Flags the screen for redrawing + */ + void redraw() { _redraw = true; } }; } // End of namespace Gargoyle diff --git a/engines/gargoyle/glk.cpp b/engines/gargoyle/glk.cpp index 2f0f0b4a46..53c9093fdf 100644 --- a/engines/gargoyle/glk.cpp +++ b/engines/gargoyle/glk.cpp @@ -279,16 +279,21 @@ winid_t Glk::glk_window_get_sibling(winid_t win) { void Glk::glk_window_clear(winid_t win) { if (!win) { warning("window_clear: invalid ref"); - } else if (win->_lineRequest || win->_lineRequestUni) { - if (g_conf->_safeClicks && _events->_forceClick) { - glk_cancel_line_event(win, nullptr); - _events->_forceClick = false; - - win->clear(); - } else { - warning("window_clear: window has pending line request"); - return; + } else { + if (win->_lineRequest || win->_lineRequestUni) { + if (g_conf->_safeClicks && _events->_forceClick) { + glk_cancel_line_event(win, nullptr); + _events->_forceClick = false; + + win->clear(); + } else { + warning("window_clear: window has pending line request"); + return; + } } + + // Clear the window + win->clear(); } } diff --git a/engines/gargoyle/windows.cpp b/engines/gargoyle/windows.cpp index b0f1cd7562..5bf2b3eac9 100644 --- a/engines/gargoyle/windows.cpp +++ b/engines/gargoyle/windows.cpp @@ -420,7 +420,7 @@ void Windows::redrawRect(const Rect &r) { } void Windows::repaint(const Rect &box) { - // No implementation + g_vm->_events->redraw(); } byte *Windows::rgbShift(byte *rgb) { -- cgit v1.2.3