mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[XAM] Send UI close notification on a separate thread
This commit is contained in:
parent
23242f21ce
commit
d00dd5a83d
|
|
@ -212,14 +212,18 @@ X_RESULT xeXamDispatchDialogAsync(T* dialog,
|
||||||
// Important to pass captured vars by value here since we return from this
|
// Important to pass captured vars by value here since we return from this
|
||||||
// without waiting for the dialog to close so the original local vars will be
|
// without waiting for the dialog to close so the original local vars will be
|
||||||
// destroyed.
|
// destroyed.
|
||||||
// FIXME: Probably not the best idea to call Sleep in UI thread.
|
|
||||||
dialog->set_close_callback([dialog, close_callback]() {
|
dialog->set_close_callback([dialog, close_callback]() {
|
||||||
close_callback(dialog);
|
close_callback(dialog);
|
||||||
|
|
||||||
--xam_dialogs_shown_;
|
--xam_dialogs_shown_;
|
||||||
|
|
||||||
|
auto run = []() -> void {
|
||||||
xe::threading::Sleep(std::chrono::milliseconds(100));
|
xe::threading::Sleep(std::chrono::milliseconds(100));
|
||||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
std::thread thread(run);
|
||||||
|
thread.detach();
|
||||||
});
|
});
|
||||||
|
|
||||||
return X_ERROR_SUCCESS;
|
return X_ERROR_SUCCESS;
|
||||||
|
|
@ -235,8 +239,13 @@ X_RESULT xeXamDispatchHeadlessAsync(std::function<void()> run_callback) {
|
||||||
|
|
||||||
--xam_dialogs_shown_;
|
--xam_dialogs_shown_;
|
||||||
|
|
||||||
|
auto run = []() -> void {
|
||||||
xe::threading::Sleep(std::chrono::milliseconds(100));
|
xe::threading::Sleep(std::chrono::milliseconds(100));
|
||||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
std::thread thread(run);
|
||||||
|
thread.detach();
|
||||||
});
|
});
|
||||||
|
|
||||||
return X_ERROR_SUCCESS;
|
return X_ERROR_SUCCESS;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue