UI: Avoid pushing a screen on top of itself.

In case someone doesn't realize they're on settings, or etc.
This commit is contained in:
Unknown W. Brackets 2017-12-02 11:45:59 -08:00
parent f1bd54148b
commit 5c81c67410
5 changed files with 8 additions and 4 deletions

View File

@ -33,6 +33,8 @@ class ControlMappingScreen : public UIDialogScreenWithBackground {
public:
ControlMappingScreen() {}
void KeyMapped(int pspkey); // Notification to let us refocus the same one after recreating views.
std::string tag() const override { return "control mapping"; }
protected:
virtual void CreateViews() override;
private:

View File

@ -31,6 +31,7 @@ public:
virtual bool touch(const TouchInput &touch) override;
virtual void dialogFinished(const Screen *dialog, DialogResult result) override;
virtual void onFinish(DialogResult reason) override;
std::string tag() const override { return "display layout screen"; }
protected:
virtual UI::EventReturn OnCenter(UI::EventParams &e);

View File

@ -35,7 +35,7 @@ public:
virtual void update();
virtual std::string tag() const { return "game"; }
std::string tag() const override { return "game"; }
protected:
virtual void CreateViews();

View File

@ -30,6 +30,7 @@ public:
virtual void update();
virtual void onFinish(DialogResult result);
std::string tag() const override { return "settings"; }
UI::Event OnRecentChanged;

View File

@ -165,13 +165,13 @@ void HandleCommonMessages(const char *message, const char *value, ScreenManager
if (PSP_IsInited()) {
currentMIPS->UpdateCore((CPUCore)g_Config.iCpuCore);
}
} else if (!strcmp(message, "control mapping") && isActiveScreen) {
} else if (!strcmp(message, "control mapping") && isActiveScreen && activeScreen->tag() != "control mapping") {
UpdateUIState(UISTATE_MENU);
manager->push(new ControlMappingScreen());
} else if (!strcmp(message, "display layout editor") && isActiveScreen) {
} else if (!strcmp(message, "display layout editor") && isActiveScreen && activeScreen->tag() != "display layout screen") {
UpdateUIState(UISTATE_MENU);
manager->push(new DisplayLayoutScreen());
} else if (!strcmp(message, "settings") && isActiveScreen) {
} else if (!strcmp(message, "settings") && isActiveScreen && activeScreen->tag() != "settings") {
UpdateUIState(UISTATE_MENU);
manager->push(new GameSettingsScreen(""));
} else if (!strcmp(message, "language screen") && isActiveScreen) {