[PATCH 1/6] conhost: Move console registry key path into 'struct console'

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


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/conhost/conhost.h |  1 +
 programs/conhost/window.c  | 15 +++++++--------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/programs/conhost/conhost.h b/programs/conhost/conhost.h
index 8ca09bb80d0..2cb9515037a 100644
--- a/programs/conhost/conhost.h
+++ b/programs/conhost/conhost.h
@@ -77,6 +77,7 @@ struct console
     HANDLE                 server;              /* console server handle */
     unsigned int           mode;                /* input mode */
     struct screen_buffer  *active;              /* active screen buffer */
+    WCHAR                 *config_key;          /* registry key name for app-specific settings */
     int                    is_unix;             /* UNIX terminal mode */
     int                    use_relative_cursor; /* use relative cursor positionning */
     INPUT_RECORD          *records;             /* input records */
diff --git a/programs/conhost/window.c b/programs/conhost/window.c
index fb02ef9fd94..77e17313f9b 100644
--- a/programs/conhost/window.c
+++ b/programs/conhost/window.c
@@ -49,7 +49,6 @@ struct console_window
     COORD             selection_start; /* selection coordinates */
     COORD             selection_end;
     unsigned int      ui_charset;      /* default UI charset */
-    WCHAR            *config_key;      /* config registry key name */
     LONG              ext_leading;     /* external leading for font */
 
     BOOL              quick_edit;      /* whether mouse ops are sent to app or used for content selection */
@@ -820,7 +819,7 @@ static int WINAPI get_first_font_sub_enum( const LOGFONTW *lf, const TEXTMETRICW
             /* since we've modified the current config with new font information,
              * set this information as the new default.
              */
-            load_config( fc->console->window->config_key, &config );
+            load_config( fc->console->config_key, &config );
             config.cell_width  = fc->console->active->font.width;
             config.cell_height = fc->console->active->font.height;
             memcpy( config.face_name, fc->console->active->font.face_name,
@@ -830,7 +829,7 @@ static int WINAPI get_first_font_sub_enum( const LOGFONTW *lf, const TEXTMETRICW
             /* Force also its writing back to the registry so that we can get it
              * the next time.
              */
-            save_config( fc->console->window->config_key, &config );
+            save_config( fc->console->config_key, &config );
             return 0;
         }
     }
@@ -1955,7 +1954,7 @@ static BOOL config_dialog( struct console *console, BOOL current )
         update_window( di.console );
     }
     if (save)
-        save_config( current ? console->window->config_key : NULL, &di.config );
+        save_config( current ? console->config_key : NULL, &di.config );
     return TRUE;
 }
 
@@ -2405,14 +2404,14 @@ BOOL init_window( struct console *console )
     if (si.lpTitle)
     {
         size_t i, title_len = wcslen( si.lpTitle );
-        if (!(console->window->config_key = malloc( (title_len + 1) * sizeof(WCHAR) )))
+        if (!(console->config_key = malloc( (title_len + 1) * sizeof(WCHAR) )))
             return FALSE;
         for (i = 0; i < title_len; i++)
-            console->window->config_key[i] = si.lpTitle[i] == '\\' ? '_' : si.lpTitle[i];
-        console->window->config_key[title_len] = 0;
+            console->config_key[i] = si.lpTitle[i] == '\\' ? '_' : si.lpTitle[i];
+        console->config_key[title_len] = 0;
     }
 
-    load_config( console->window->config_key, &config );
+    load_config( console->config_key, &config );
     if (si.dwFlags & STARTF_USECOUNTCHARS)
     {
         config.sb_width  = si.dwXCountChars;
-- 
2.35.1




More information about the wine-devel mailing list