diff options
Diffstat (limited to 'engines/glk/frotz/windows.cpp')
-rw-r--r-- | engines/glk/frotz/windows.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp index 8ebc263151..0619030567 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" @@ -143,6 +144,11 @@ void Window::setPosition(const Point &newPos) { void Window::setCursor(const Point &newPos) { int x = newPos.x, y = newPos.y; + if (!(_currStyle & FIXED_WIDTH_STYLE)) { + _currStyle |= FIXED_WIDTH_STYLE; + ensureGlkWindow(); + } + if (y < 0) { // Cursor on/off if (y == -2) @@ -226,10 +232,10 @@ uint Window::setFont(uint font) { return result; } -void Window::setStyle(int style) { +void Window::setStyle(uint style) { if (style == 0) _currStyle = 0; - else if (style != -1) + else if (style != 0xf000) // not tickle time _currStyle |= style; @@ -247,8 +253,7 @@ void Window::setStyle(int style) { void Window::updateStyle() { uint style = _currStyle; - if (!_win) - createGlkWindow(); + ensureGlkWindow(); if (style & REVERSE_STYLE) setReverseVideo(true); @@ -289,9 +294,14 @@ void Window::setReverseVideo(bool reverse) { _win->_stream->setReverseVideo(reverse); } -void Window::createGlkWindow() { +void Window::ensureGlkWindow() { // Create a new window - if (_index == 1) { + if (_win && (dynamic_cast<TextGridWindow *>(_win) != nullptr) != ((_currStyle & FIXED_WIDTH_STYLE) != 0)) { + g_vm->glk_window_close(_win); + _win = nullptr; + } + + if (_currStyle & FIXED_WIDTH_STYLE) { // Text grid window _win = g_vm->glk_window_open(g_vm->glk_window_get_root(), winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextGrid, 0); |