Make sure nact->is_quit breaks event loops

This commit is contained in:
kichikuou
2022-06-26 17:25:43 +09:00
parent 9706f516f9
commit f56ec88cda
3 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ static void ntmain(struct _scoadr inadr) {
struct _scoadr curadr;
while (!nact->is_quit) {
for (int cnt = 0; !nact->wait_vsync && cnt < 10000; cnt++) {
for (int cnt = 0; !nact->is_quit && !nact->wait_vsync && cnt < 10000; cnt++) {
//SACT_DEBUG("%d:%x\n", sl_getPage(), sl_getIndex());
if (!nact->popupmenu_opened) {
exec_command();
+7 -6
View File
@@ -92,7 +92,8 @@ int sys_keywait(int msec, unsigned flags) {
int key=0, n;
int end = msec == INT_MAX ? INT_MAX : sdl_getTicks() + msec;
while (!((flags & KEYWAIT_SKIPPABLE) && msgskip_isSkipping()) &&
while (!nact->is_quit &&
!((flags & KEYWAIT_SKIPPABLE) && msgskip_isSkipping()) &&
(n = end - sdl_getTicks()) > 0) {
if (n <= 16)
sdl_sleep(n);
@@ -122,19 +123,19 @@ void sys_hit_any_key() {
if (nact->messagewait_cancelled) {
nact->messagewait_cancelled = FALSE;
/* consume the input that cancelled message wait */
while(0 == (key & hak_ignore_mask)) {
while (!nact->is_quit && !(key & hak_ignore_mask)) {
key = sys_keywait(INT_MAX, KEYWAIT_CANCELABLE);
}
while(key & hak_releasewait_mask) {
while (!nact->is_quit && key & hak_releasewait_mask) {
key = sys_keywait(100, KEYWAIT_CANCELABLE);
}
}
while (!msgskip_isSkipping() && 0 == (key & hak_ignore_mask)) {
while (!nact->is_quit && !msgskip_isSkipping() && 0 == (key & hak_ignore_mask)) {
key = sys_keywait(100, KEYWAIT_CANCELABLE | KEYWAIT_SKIPPABLE);
}
while (!msgskip_isSkipping() && (key & hak_releasewait_mask)) {
while (!nact->is_quit && !msgskip_isSkipping() && (key & hak_releasewait_mask)) {
key = sys_keywait(100, KEYWAIT_CANCELABLE | KEYWAIT_SKIPPABLE);
}
}
@@ -148,7 +149,7 @@ void sys_key_releasewait(int key, boolean zi_mask_enabled) {
mask = 0xffffffff;
}
while(key & mask) {
while (!nact->is_quit && key & mask) {
key = sys_keywait(50, KEYWAIT_NONCANCELABLE);
}
}
+1 -1
View File
@@ -457,7 +457,7 @@ void sel_select() {
}
sys_key_releasewait(SYS35KEY_RET, FALSE);
while (1) {
while (!nact->is_quit) {
key = sys_keywait(25, KEYWAIT_CANCELABLE);
if (!key && prevkey == SYS35KEY_SPC) break;