[PATCH 6/6] conhost: Don't prompt the user to save their app-specific console settings

Hugh McMaster hugh.mcmaster at outlook.com
Mon Apr 11 07:35:55 CDT 2022


On Windows, app-specific console settings are always saved unless the user
cancels the dialog.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/conhost/conhost.h  |  4 ---
 programs/conhost/conhost.rc | 12 -------
 programs/conhost/window.c   | 69 +++++--------------------------------
 3 files changed, 9 insertions(+), 76 deletions(-)

diff --git a/programs/conhost/conhost.h b/programs/conhost/conhost.h
index 2cb9515037a..242d0ae7769 100644
--- a/programs/conhost/conhost.h
+++ b/programs/conhost/conhost.h
@@ -186,7 +186,6 @@ static inline unsigned int get_bounded_cursor_x( struct screen_buffer *screen_bu
 #define IDD_OPTION              0x0100
 #define IDD_FONT                0x0200
 #define IDD_CONFIG              0x0300
-#define IDD_SAVE_SETTINGS       0x0400
 
 /* dialog boxes controls */
 #define IDC_OPT_CURSOR_SMALL    0x0101
@@ -217,6 +216,3 @@ static inline unsigned int get_bounded_cursor_x( struct screen_buffer *screen_bu
 #define IDC_CNF_WIN_HEIGHT_UD   0x0308
 #define IDC_CNF_CLOSE_EXIT      0x0309
 #define IDC_CNF_EDITION_MODE    0x030a
-
-#define IDC_SAV_SAVE            0x0401
-#define IDC_SAV_SESSION         0x0402
diff --git a/programs/conhost/conhost.rc b/programs/conhost/conhost.rc
index e7c4416b634..820220b9d60 100644
--- a/programs/conhost/conhost.rc
+++ b/programs/conhost/conhost.rc
@@ -114,18 +114,6 @@ FONT 8, "MS Shell Dlg"
 	COMBOBOX IDC_CNF_EDITION_MODE, 119, 69, 75, 60, CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP
 }
 
-IDD_SAVE_SETTINGS DIALOG 20, 20, 210, 60
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
-CAPTION "Console parameters"
-FONT 8, "MS Shell Dlg"
-{
-	AUTORADIOBUTTON "Retain these settings for later sessions", IDC_SAV_SAVE, 10, 8, 200, 10, WS_TABSTOP
-	AUTORADIOBUTTON "Modify only current session", IDC_SAV_SESSION, 10, 22, 200, 10, WS_TABSTOP
-
-        DEFPUSHBUTTON "OK", IDOK, 100, 43, 50, 14
-	PUSHBUTTON "Cancel", IDCANCEL, 155, 43, 50, 14
-}
-
 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 
 #define WINE_FILEDESCRIPTION_STR "Wine conhost"
diff --git a/programs/conhost/window.c b/programs/conhost/window.c
index d713a7f573b..db407f6d0a7 100644
--- a/programs/conhost/window.c
+++ b/programs/conhost/window.c
@@ -1700,34 +1700,6 @@ static INT_PTR WINAPI config_dialog_proc( HWND dialog, UINT msg, WPARAM wparam,
     return TRUE;
 }
 
-/* dialog proc for choosing how to handle modification to the console settings */
-static INT_PTR WINAPI save_dialog_proc( HWND dialog, UINT msg, WPARAM wparam, LPARAM lparam )
-{
-    switch (msg)
-    {
-    case WM_INITDIALOG:
-        SendMessageW( dialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem( dialog, IDC_SAV_SESSION ), TRUE );
-        SendDlgItemMessageW( dialog, IDC_SAV_SESSION, BM_SETCHECK, BST_CHECKED, 0 );
-        return FALSE;
-
-    case WM_COMMAND:
-        switch (LOWORD(wparam))
-        {
-        case IDOK:
-            EndDialog( dialog,
-                       (IsDlgButtonChecked(dialog, IDC_SAV_SAVE) == BST_CHECKED) ?
-                       IDC_SAV_SAVE : IDC_SAV_SESSION );
-            break;
-        case IDCANCEL:
-            EndDialog( dialog, IDCANCEL ); break;
-        }
-        break;
-    default:
-        return FALSE;
-    }
-    return TRUE;
-}
-
 static void apply_config( struct console *console, const struct console_config *config )
 {
     if (console->active->width != config->sb_width || console->active->height != config->sb_height)
@@ -1845,19 +1817,17 @@ static BOOL config_dialog( struct console *console, BOOL current )
     PROPSHEETPAGEW psp;
     WNDCLASSW wndclass;
     WCHAR buff[256];
-    BOOL modify_session = FALSE;
-    BOOL save = FALSE;
 
     InitCommonControls();
 
     memset( &di, 0, sizeof(di) );
     di.console = console;
-    if (!current)
-    {
+
+    if (current)
+        current_config( console, &di.config );
+    else
         load_config( NULL, &di.config );
-        save = TRUE;
-    }
-    else current_config( console, &di.config );
+
     prev_config = di.config;
 
     wndclass.style         = 0;
@@ -1923,35 +1893,14 @@ static BOOL config_dialog( struct console *console, BOOL current )
 
     TRACE( "%s\n", debugstr_config(&di.config) );
 
-    if (!save)
-    {
-        switch (DialogBoxW( GetModuleHandleW( NULL ), MAKEINTRESOURCEW(IDD_SAVE_SETTINGS),
-                            console->win, save_dialog_proc ))
-        {
-        case IDC_SAV_SAVE:
-            save = TRUE;
-            modify_session = TRUE;
-            break;
-        case IDC_SAV_SESSION:
-            modify_session = TRUE;
-            break;
-        default:
-            ERR( "dialog failed\n" );
-            /* fall through */
-        case IDCANCEL:
-            modify_session = FALSE;
-            save = FALSE;
-            break;
-        }
-    }
-
-    if (modify_session)
+    if (current)
     {
         apply_config( console, &di.config );
         update_window( di.console );
     }
-    if (save)
-        save_config( current ? console->config_key : NULL, &di.config );
+
+    save_config( current ? console->config_key : NULL, &di.config );
+
     return TRUE;
 }
 
-- 
2.35.1




More information about the wine-devel mailing list