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