summaryrefslogtreecommitdiff
path: root/library/modules/Gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'library/modules/Gui.cpp')
-rw-r--r--library/modules/Gui.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp
index cd44401f..91a17e99 100644
--- a/library/modules/Gui.cpp
+++ b/library/modules/Gui.cpp
@@ -42,6 +42,7 @@ using namespace std;
using namespace DFHack;
#include "modules/Job.h"
+#include "modules/Screen.h"
#include "DataDefs.h"
#include "df/world.h"
@@ -466,6 +467,11 @@ std::string Gui::getFocusString(df::viewscreen *top)
return name;
}
+ else if (dfhack_viewscreen::is_instance(top))
+ {
+ auto name = static_cast<dfhack_viewscreen*>(top)->getFocusString();
+ return name.empty() ? "dfhack" : "dfhack/"+name;
+ }
else
{
Core &core = Core::getInstance();
@@ -977,17 +983,19 @@ void Gui::showPopupAnnouncement(std::string message, int color, bool bright)
world->status.popups.push_back(popup);
}
-df::viewscreen * Gui::GetCurrentScreen()
+df::viewscreen *Gui::getCurViewscreen(bool skip_dismissed)
{
df::viewscreen * ws = &gview->view;
- while(ws)
+ while (ws && ws->child)
+ ws = ws->child;
+
+ if (skip_dismissed)
{
- if(ws->child)
- ws = ws->child;
- else
- return ws;
+ while (ws && Screen::isDismissed(ws) && ws->parent)
+ ws = ws->parent;
}
- return 0;
+
+ return ws;
}
bool Gui::getViewCoords (int32_t &x, int32_t &y, int32_t &z)