minimap[osx]: try to avoid "updating" the minimap when a dialog is opened...
This commit is contained in:
@@ -34,6 +34,7 @@ extern sf::RenderWindow mainPtr;
|
||||
const short cDialog::BG_DARK = 5, cDialog::BG_LIGHT = 16;
|
||||
short cDialog::defaultBackground = cDialog::BG_DARK;
|
||||
cDialog* cDialog::topWindow = nullptr;
|
||||
bool cDialog::inDialog = false;
|
||||
|
||||
std::string cDialog::generateRandomString(){
|
||||
// Not bothering to seed, because it doesn't actually matter if it's truly random.
|
||||
@@ -493,6 +494,8 @@ bool cDialog::sendInput(cKey key) {
|
||||
|
||||
void cDialog::run(std::function<void(cDialog&)> onopen){
|
||||
cDialog* formerTop = topWindow;
|
||||
bool formerInDialog = inDialog;
|
||||
inDialog = true;
|
||||
// TODO: The introduction of the static topWindow means I may be able to use this instead of parent->win; do I still need parent?
|
||||
sf::RenderWindow* parentWin = &(parent ? parent->win : mainPtr);
|
||||
auto parentPos = parentWin->getPosition();
|
||||
@@ -554,6 +557,7 @@ void cDialog::run(std::function<void(cDialog&)> onopen){
|
||||
set_cursor(former_curs);
|
||||
topWindow = formerTop;
|
||||
makeFrontWindow(*parentWin);
|
||||
inDialog = formerInDialog;
|
||||
}
|
||||
|
||||
// This method is a main event event loop of the dialog.
|
||||
|
@@ -49,6 +49,7 @@ class cDialog {
|
||||
template<typename Iter> void handleTabOrder(std::string& itemHit, Iter begin, Iter end);
|
||||
std::vector<std::pair<std::string,cTextField*>> tabOrder;
|
||||
static cDialog* topWindow; // Tracks the frontmost dialog.
|
||||
static bool inDialog;
|
||||
public:
|
||||
/// Performs essential startup initialization. Generally should not be called directly.
|
||||
static void init();
|
||||
@@ -211,6 +212,10 @@ public:
|
||||
}
|
||||
return p;
|
||||
}
|
||||
/// checks if a dialog is actually running
|
||||
static bool checkIfDialogIsRunning() {
|
||||
return inDialog;
|
||||
}
|
||||
cDialog& operator=(cDialog& other) = delete;
|
||||
cDialog(cDialog& other) = delete;
|
||||
private:
|
||||
|
@@ -694,9 +694,7 @@ void cStringRecorder::operator()(cDialog& me) {
|
||||
break;
|
||||
case NOTE_TOWN:
|
||||
str1 = univ.town->get_special_string(label1);
|
||||
if (label2>=univ.town->spec_strs.size())
|
||||
add_string_to_buf("cStringRecorder()[town]: empty label 2.");
|
||||
else
|
||||
if (label2<univ.town->spec_strs.size())
|
||||
str2 = univ.town->spec_strs[label2];
|
||||
break;
|
||||
case NOTE_OUT:
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <SFML/System.hpp>
|
||||
|
||||
#include "cursors.hpp"
|
||||
#include "dialog.hpp"
|
||||
#include "gfxsheets.hpp"
|
||||
#include "pict.hpp"
|
||||
#include "prefs.hpp"
|
||||
@@ -108,6 +109,11 @@ void set_visible(bool vis)
|
||||
}
|
||||
|
||||
void draw(bool need_refresh) {
|
||||
#ifdef __APPLE__
|
||||
// can not be updated when a dialog is running
|
||||
if (cDialog::checkIfDialogIsRunning())
|
||||
return;
|
||||
#endif
|
||||
if (changed) {
|
||||
need_refresh=true;
|
||||
changed = false;
|
||||
|
Reference in New Issue
Block a user