diff options
author | Arisotura <thetotalworm@gmail.com> | 2019-05-25 20:58:32 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2019-05-25 20:58:32 +0200 |
commit | eb6fe823f8196373906916b47fbeecf5d7a63e8a (patch) | |
tree | 09ee4d75839e3b0acf1c1c11f18f604192635df8 | |
parent | af581513fb98e37b6c8b3d856ad7f63d4d905040 (diff) |
close any opened dialogs when closing the main window
-rw-r--r-- | src/libui_sdl/DlgAudioSettings.cpp | 7 | ||||
-rw-r--r-- | src/libui_sdl/DlgAudioSettings.h | 1 | ||||
-rw-r--r-- | src/libui_sdl/DlgEmuSettings.cpp | 7 | ||||
-rw-r--r-- | src/libui_sdl/DlgEmuSettings.h | 1 | ||||
-rw-r--r-- | src/libui_sdl/DlgInputConfig.cpp | 8 | ||||
-rw-r--r-- | src/libui_sdl/DlgInputConfig.h | 1 | ||||
-rw-r--r-- | src/libui_sdl/DlgVideoSettings.cpp | 7 | ||||
-rw-r--r-- | src/libui_sdl/DlgVideoSettings.h | 1 | ||||
-rw-r--r-- | src/libui_sdl/DlgWifiSettings.cpp | 7 | ||||
-rw-r--r-- | src/libui_sdl/DlgWifiSettings.h | 1 | ||||
-rw-r--r-- | src/libui_sdl/main.cpp | 13 |
11 files changed, 54 insertions, 0 deletions
diff --git a/src/libui_sdl/DlgAudioSettings.cpp b/src/libui_sdl/DlgAudioSettings.cpp index 66bdf61..385128c 100644 --- a/src/libui_sdl/DlgAudioSettings.cpp +++ b/src/libui_sdl/DlgAudioSettings.cpp @@ -180,4 +180,11 @@ void Open() uiControlShow(uiControl(win)); } +void Close() +{ + if (!opened) return; + uiControlDestroy(uiControl(win)); + opened = false; +} + } diff --git a/src/libui_sdl/DlgAudioSettings.h b/src/libui_sdl/DlgAudioSettings.h index 30a5d53..f058c25 100644 --- a/src/libui_sdl/DlgAudioSettings.h +++ b/src/libui_sdl/DlgAudioSettings.h @@ -23,6 +23,7 @@ namespace DlgAudioSettings { void Open(); +void Close(); } diff --git a/src/libui_sdl/DlgEmuSettings.cpp b/src/libui_sdl/DlgEmuSettings.cpp index ad8c047..768560d 100644 --- a/src/libui_sdl/DlgEmuSettings.cpp +++ b/src/libui_sdl/DlgEmuSettings.cpp @@ -107,4 +107,11 @@ void Open() uiControlShow(uiControl(win)); } +void Close() +{ + if (!opened) return; + uiControlDestroy(uiControl(win)); + opened = false; +} + } diff --git a/src/libui_sdl/DlgEmuSettings.h b/src/libui_sdl/DlgEmuSettings.h index 126497a..baff7ce 100644 --- a/src/libui_sdl/DlgEmuSettings.h +++ b/src/libui_sdl/DlgEmuSettings.h @@ -23,6 +23,7 @@ namespace DlgEmuSettings { void Open(); +void Close(); } diff --git a/src/libui_sdl/DlgInputConfig.cpp b/src/libui_sdl/DlgInputConfig.cpp index 513bd90..98cdf8c 100644 --- a/src/libui_sdl/DlgInputConfig.cpp +++ b/src/libui_sdl/DlgInputConfig.cpp @@ -450,5 +450,13 @@ void Open(int type) uiControlShow(uiControl(dlg->win)); } +void Close(int type) +{ + if (openedmask & (1<<type)) + uiControlDestroy(uiControl(inputdlg[type].win)); + + openedmask &= ~(1<<type); +} + } diff --git a/src/libui_sdl/DlgInputConfig.h b/src/libui_sdl/DlgInputConfig.h index 9a73f37..94c7325 100644 --- a/src/libui_sdl/DlgInputConfig.h +++ b/src/libui_sdl/DlgInputConfig.h @@ -23,6 +23,7 @@ namespace DlgInputConfig { void Open(int type); +void Close(int type); } diff --git a/src/libui_sdl/DlgVideoSettings.cpp b/src/libui_sdl/DlgVideoSettings.cpp index 69e5ac5..8749dc5 100644 --- a/src/libui_sdl/DlgVideoSettings.cpp +++ b/src/libui_sdl/DlgVideoSettings.cpp @@ -306,4 +306,11 @@ void Open() uiControlShow(uiControl(win)); } +void Close() +{ + if (!opened) return; + uiControlDestroy(uiControl(win)); + opened = false; +} + } diff --git a/src/libui_sdl/DlgVideoSettings.h b/src/libui_sdl/DlgVideoSettings.h index cd3d1b1..25a938f 100644 --- a/src/libui_sdl/DlgVideoSettings.h +++ b/src/libui_sdl/DlgVideoSettings.h @@ -23,6 +23,7 @@ namespace DlgVideoSettings { void Open(); +void Close(); } diff --git a/src/libui_sdl/DlgWifiSettings.cpp b/src/libui_sdl/DlgWifiSettings.cpp index e16ce50..09080a0 100644 --- a/src/libui_sdl/DlgWifiSettings.cpp +++ b/src/libui_sdl/DlgWifiSettings.cpp @@ -261,4 +261,11 @@ void Open() uiControlShow(uiControl(win)); } +void Close() +{ + if (!opened) return; + uiControlDestroy(uiControl(win)); + opened = false; +} + } diff --git a/src/libui_sdl/DlgWifiSettings.h b/src/libui_sdl/DlgWifiSettings.h index f7b7398..466ce10 100644 --- a/src/libui_sdl/DlgWifiSettings.h +++ b/src/libui_sdl/DlgWifiSettings.h @@ -23,6 +23,7 @@ namespace DlgWifiSettings { void Open(); +void Close(); } diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index c086bbf..0c7aacd 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -1637,11 +1637,23 @@ void UndoStateLoad() } +void CloseAllDialogs() +{ + DlgAudioSettings::Close(); + DlgEmuSettings::Close(); + DlgInputConfig::Close(0); + DlgInputConfig::Close(1); + DlgVideoSettings::Close(); + DlgWifiSettings::Close(); +} + + int OnCloseWindow(uiWindow* window, void* blarg) { EmuRunning = 3; while (EmuStatus != 3); + CloseAllDialogs(); uiQuit(); return 1; } @@ -1678,6 +1690,7 @@ void OnCloseByMenu(uiMenuItem* item, uiWindow* window, void* blarg) EmuRunning = 3; while (EmuStatus != 3); + CloseAllDialogs(); DestroyMainWindow(); uiQuit(); } |