aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/frotz
diff options
context:
space:
mode:
authorPaul Gilbert2019-01-02 18:18:11 -0800
committerPaul Gilbert2019-01-02 18:18:11 -0800
commitf1d9722f3bd58f7883f3e76c19d4a0133da73489 (patch)
tree26986b085d83e597b10c3851fde9b49574c10586 /engines/glk/frotz
parent3ed48e3de223259dd58f0c613c2d68d69848e5a2 (diff)
downloadscummvm-rg350-f1d9722f3bd58f7883f3e76c19d4a0133da73489.tar.gz
scummvm-rg350-f1d9722f3bd58f7883f3e76c19d4a0133da73489.tar.bz2
scummvm-rg350-f1d9722f3bd58f7883f3e76c19d4a0133da73489.zip
GLK: FROTZ: Add support for pair windows to have more than 2 children
This is primarily for the V6 games, which have up to 8 windows on-screen at the same time in arbitray positions ext
Diffstat (limited to 'engines/glk/frotz')
-rw-r--r--engines/glk/frotz/windows.cpp18
-rw-r--r--engines/glk/frotz/windows.h5
2 files changed, 22 insertions, 1 deletions
diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp
index 1863e68032..ffee6392c7 100644
--- a/engines/glk/frotz/windows.cpp
+++ b/engines/glk/frotz/windows.cpp
@@ -22,6 +22,7 @@
#include "glk/frotz/windows.h"
#include "glk/frotz/frotz.h"
+#include "glk/window_pair.h"
namespace Glk {
namespace Frotz {
@@ -51,7 +52,8 @@ winid_t Window::getWindow() {
// TODO: For now I'm assuming all the extra created windows will be graphics, since Glk requires
// us to specify it at creation time. Not sure if it's true or not for all V6 games
winid_t parent = _windows->_lower;
- _win = g_vm->glk_window_open(parent, winmethod_OnTop | winmethod_Fixed, 0, wintype_Graphics, 0);
+ _win = g_vm->glk_window_open(g_vm->glk_window_get_root(), winmethod_Arbitrary | winmethod_Fixed,
+ 0, wintype_Graphics, 0);
}
return _win;
@@ -59,6 +61,7 @@ winid_t Window::getWindow() {
void Window::setSize(const Point &newSize) {
winid_t win = getWindow();
+ checkRepositionLower();
win->setSize(newSize);
/* TODO
@@ -73,6 +76,7 @@ void Window::setSize(const Point &newSize) {
void Window::setPosition(const Point &newPos) {
winid_t win = getWindow();
+ checkRepositionLower();
win->setPosition(newPos);
}
@@ -113,5 +117,17 @@ void Window::setProperty(WindowProperty propType, uint16 value) {
// TODO
}
+void Window::checkRepositionLower() {
+ if (&_windows->_lower == this) {
+ PairWindow *parent = dynamic_cast<PairWindow *>(_win->_parent);
+ if (!parent)
+ error("Parent was not a pair window");
+
+ // Ensure the parent pair window is flagged as having children at arbitrary positions,
+ // just in case it isn't already
+ parent->_dir = winmethod_Arbitrary;
+ }
+}
+
} // End of namespace Frotz
} // End of namespace Glk
diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h
index ba277d57dc..43358665b2 100644
--- a/engines/glk/frotz/windows.h
+++ b/engines/glk/frotz/windows.h
@@ -64,6 +64,11 @@ private:
* Set a property value
*/
void setProperty(WindowProperty propType, uint16 value);
+
+ /**
+ * Called when trying to reposition or resize windows. Does special handling for the lower window
+ */
+ void checkRepositionLower();
public:
/**
* Constructor