From 4b16eedde4886f7277fba7bf5de865d20d61272f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Tue, 7 Jan 2025 03:26:29 -0500
Subject: [PATCH] Add new WIN_ATEXIT to disable UIFC_XF_QUIT effect

---
 src/uifc/uifc.h   | 1 +
 src/uifc/uifc32.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/uifc/uifc.h b/src/uifc/uifc.h
index e95139c053..8dec742702 100644
--- a/src/uifc/uifc.h
+++ b/src/uifc/uifc.h
@@ -165,6 +165,7 @@
 #define WIN_LEFTKEY		(1LL<<32)	/* Display left-arrow-key support indicator */
 #define WIN_RIGHTKEY	(1LL<<33)	/* Display right-arrow-key support indicator */
 #define WIN_BLANKOPTS	(1LL<<34)	/* Blank options are allowed (terminate list on NULL only) */
+#define WIN_ATEXIT      (1LL<<35)	/* Do not exit this because UIFC_XF_QUIT is set - for non-exiting menus */
 
 #define WIN_MID WIN_L2R|WIN_T2B  /* Place window in middle of screen */
 #define WIN_GET	WIN_COPY
diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c
index c1c7058e9c..d969e1b2b5 100644
--- a/src/uifc/uifc32.c
+++ b/src/uifc/uifc32.c
@@ -1145,8 +1145,8 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar
 		gotkey=0;
 		textattr(((api->lbclr)&0x0f)|((api->lbclr >> 4)&0x0f));
 		gotoxy(s_left+lbrdrwidth+2+left, s_top+y);
-		if((api->exit_flags & UIFC_XF_QUIT) || dyn_kbwait(mode) || (mode&(WIN_POP|WIN_SEL))) {
-			if(api->exit_flags & UIFC_XF_QUIT)
+		if(((api->exit_flags & UIFC_XF_QUIT) && !(mode & WIN_ATEXIT)) || dyn_kbwait(mode) || (mode&(WIN_POP|WIN_SEL))) {
+			if((api->exit_flags & UIFC_XF_QUIT) && !(mode & WIN_ATEXIT))
 				gotkey = CIO_KEY_QUIT;
 			else if(mode&WIN_POP)
 				gotkey=ESC;
-- 
GitLab