From 62724cda1f54367aa65eec4d994a3d802cdf5847 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 21:11:32 -0300 Subject: [PATCH] Make "Exit" the default button for fatal errors --- src/pc.c | 2 +- src/win/win_dialog.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pc.c b/src/pc.c index 8269685a8..574b81d58 100644 --- a/src/pc.c +++ b/src/pc.c @@ -283,7 +283,7 @@ fatal(const char *fmt, ...) to avoid things like threads getting stuck. */ do_stop(); - ui_msgbox_ex(MBX_ERROR | MBX_FATAL | MBX_ANSI, NULL, temp, (wchar_t *) IDS_2119, NULL, NULL); + ui_msgbox(MBX_ERROR | MBX_FATAL | MBX_ANSI, temp); fflush(stdlog); diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index a5ff73867..43ef4a779 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -64,7 +64,8 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi TASKDIALOG_BUTTON tdbuttons[3], tdb_yes = {IDYES, STRING_OR_RESOURCE(btn1)}, tdb_no = {IDNO, STRING_OR_RESOURCE(btn2)}, - tdb_cancel = {IDCANCEL, STRING_OR_RESOURCE(btn3)}; + tdb_cancel = {IDCANCEL, STRING_OR_RESOURCE(btn3)}, + tdb_exit = {IDCLOSE, MAKEINTRESOURCE(IDS_2119)}; int ret = 0; /* Configure the default OK button. */ @@ -84,6 +85,13 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi if (flags & MBX_FATAL) { tdconfig.pszMainIcon = TD_ERROR_ICON; tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2050); /* "Fatal error" */ + + /* replace default "OK" button with "Exit" button */ + if (btn1) + tdconfig.cButtons = 0; + else + tdconfig.dwCommonButtons = 0; + tdbuttons[tdconfig.cButtons++] = tdb_exit; } else { tdconfig.pszMainIcon = TD_WARNING_ICON; tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2049); /* "Error" */