diff options
-rw-r--r-- | engines/glk/frotz/processor_screen.cpp | 2 | ||||
-rw-r--r-- | engines/glk/frotz/windows.cpp | 13 | ||||
-rw-r--r-- | engines/glk/frotz/windows.h | 5 |
3 files changed, 20 insertions, 0 deletions
diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp index f6eb16ac20..78c884de3a 100644 --- a/engines/glk/frotz/processor_screen.cpp +++ b/engines/glk/frotz/processor_screen.cpp @@ -104,6 +104,8 @@ uint32 Processor::zchar_to_unicode_rune(zchar c) { void Processor::screen_char(zchar c) { Window &w = _wp.currWin(); + w.ensureTextWindow(); + if (gos_linepending && (w == gos_linewin)) { gos_cancel_pending_line(); if (_wp.currWin() == _wp._upper) { diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp index 6e279193bd..7e647ea06c 100644 --- a/engines/glk/frotz/windows.cpp +++ b/engines/glk/frotz/windows.cpp @@ -23,6 +23,7 @@ #include "glk/frotz/windows.h" #include "glk/frotz/frotz.h" #include "glk/window_pair.h" +#include "glk/window_text_grid.h" #include "glk/window_text_buffer.h" #include "glk/conf.h" @@ -123,6 +124,18 @@ Window &Window::operator=(winid_t win) { return *this; } +void Window::ensureTextWindow() { + if (_win) { + // There's a window present, so make sure it's a text grid or text buffer window + if (dynamic_cast<TextBufferWindow *>(_win) || dynamic_cast<TextGridWindow *>(_win)) + return; + + g_vm->glk_window_close(_win); + _win = nullptr; + } + + createGlkWindow(); +} void Window::setSize(const Point &newSize) { checkRepositionLower(); diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h index 8043a103ba..785fb10d8f 100644 --- a/engines/glk/frotz/windows.h +++ b/engines/glk/frotz/windows.h @@ -154,6 +154,11 @@ public: PropertyAccessor operator[](WindowProperty propType) { return PropertyAccessor(this, propType); } /** + * Ensures that the underlying window is a Glk text window + */ + void ensureTextWindow(); + + /** * Set the window size */ void setSize(const Point &newSize); |