Make a little system to replace the InputBox message queue with something more generic

This commit is contained in:
Henrik Rydgård committed 2023-03-22 11:35:57 +01:00
1 parent 94debfbf36
commit 3852d4f698
6 files changed
+143

No files matched your search

+20
View File
@@ -513,6 +513,26 @@ void System_InputBoxGetString(const std::string &title, const std::string &defau
});
}
bool System_PerformRequest(SystemRequestType type, int requestId, const char *param1, const char *param2) {
switch (type) {
case SystemRequestType::INPUT_TEXT_MODAL:
if (inputBoxRunning) {
inputBoxThread.join();
}
inputBoxRunning = true;
inputBoxThread = std::thread([=] {
std::string out;
if (InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), ConvertUTF8ToWString(title).c_str(), defaultValue, out)) {
NativeInputBoxReceived(cb, true, out);
} else {
NativeInputBoxReceived(cb, false, "");
}
});
}
}
void System_Toast(const char *text) {
// Not-very-good implementation. Will normally not be used on Windows anyway.
std::wstring str = ConvertUTF8ToWString(text);