diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 1b43e9f89..9c3873241 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -64,7 +64,8 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font _tabID(0), _flags(Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG), _max_w(0), - _max_h(0) + _max_h(0), + _layer(0) { setTitle(title); setDirty(); @@ -97,7 +98,7 @@ void Dialog::open() // dialogs cause drawing to occur within loadConfig() if (_surface == nullptr) _surface = instance().frameBuffer().allocateSurface(_w, _h); - parent().addDialog(this); + _layer = parent().addDialog(this); center(); @@ -164,11 +165,12 @@ void Dialog::positionAt(uInt32 pos) { const Common::Size& screen = instance().frameBuffer().screenSize(); const Common::Rect& dst = _surface->dstRect(); - - int top = std::min(screen.h - dst.height(), screen.h >> 5); - int btm = std::min(screen.h - dst.height(), screen.h - dst.height() - (screen.h >> 5)); - int left = std::min(screen.w - dst.width(), screen.w >> 5); - int right = std::min(screen.w - dst.width(), screen.w - dst.width() - (screen.w >> 5)); + // shift stacked dialogs + uInt32 gap = (screen.w >> 6) * _layer; + int top = std::min(screen.h - dst.height(), gap); + int btm = std::min(screen.h - dst.height(), screen.h - dst.height() - gap); + int left = std::min(screen.w - dst.width(), gap); + int right = std::min(screen.w - dst.width(), screen.w - dst.width() - gap); switch (pos) { diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index e14124e0e..94f50a9b1 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -186,6 +186,7 @@ class Dialog : public GuiObject bool _processCancel; string _title; int _th; + int _layer; Common::FixedStack> mySurfaceStack; diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx index a3ba894a7..16bdf681b 100644 --- a/src/gui/DialogContainer.cxx +++ b/src/gui/DialogContainer.cxx @@ -126,7 +126,7 @@ bool DialogContainer::needsRedraw() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void DialogContainer::addDialog(Dialog* d) +int DialogContainer::addDialog(Dialog* d) { const Common::Rect& r = myOSystem.frameBuffer().imageRect(); if(uInt32(d->getWidth()) > r.width() || uInt32(d->getHeight()) > r.height()) @@ -137,6 +137,7 @@ void DialogContainer::addDialog(Dialog* d) d->setDirty(); myDialogStack.push(d); } + return myDialogStack.size(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/DialogContainer.hxx b/src/gui/DialogContainer.hxx index 84ad9235f..acb2aa8db 100644 --- a/src/gui/DialogContainer.hxx +++ b/src/gui/DialogContainer.hxx @@ -160,7 +160,7 @@ class DialogContainer /** Add a dialog box to the stack. */ - void addDialog(Dialog* d); + int addDialog(Dialog* d); /** Remove the topmost dialog box from the stack.