Having laid all the groundwork, we can now remove the global `cfg'
[u/mdw/putty] / window.c
index cea9d5c..fdef3e6 100644 (file)
--- a/window.c
+++ b/window.c
@@ -122,6 +122,8 @@ static void *backhandle;
 
 static int session_closed;
 
+Config cfg;                           /* exported to windlg.c */
+
 extern struct sesslist sesslist;       /* imported from windlg.c */
 
 #define FONT_NORMAL 0
@@ -507,7 +509,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
     hwnd = NULL;
 
     term = term_init(&cfg, NULL);
-    logctx = log_init(NULL);
+    logctx = log_init(NULL, &cfg);
     term_provide_logctx(term, logctx);
 
     cfgtopalette();
@@ -615,7 +617,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
        char msg[1024], *title;
        char *realhost;
 
-       error = back->init((void *)term, &backhandle,
+       error = back->init((void *)term, &backhandle, &cfg,
                           cfg.host, cfg.port, &realhost, cfg.tcp_nodelay);
        back->provide_logctx(backhandle, logctx);
        if (error) {
@@ -1207,7 +1209,7 @@ static void init_fonts(int pick_width, int pick_height)
     }
     fontflag[0] = fontflag[1] = fontflag[2] = 1;
 
-    init_ucs();
+    init_ucs(&cfg);
 }
 
 static void another_font(int fontno)
@@ -1760,11 +1762,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
                    }
                }
 
-               if (strcmp(prev_cfg.logfilename, cfg.logfilename) ||
-                   prev_cfg.logtype != cfg.logtype) {
-                   logfclose(logctx); /* reset logging */
-                   logfopen(logctx);
-               }
+               /* Pass new config data to the logging module */
+               log_reconfig(logctx, &cfg);
 
                sfree(logpal);
                /*
@@ -1779,8 +1778,11 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
                cfgtopalette();
                init_palette();
 
-               /* Give terminal a heads-up on miscellaneous stuff */
-               term_reconfig(term);
+               /* Pass new config data to the terminal */
+               term_reconfig(term, &cfg);
+
+               /* Pass new config data to the back end */
+               back->reconfig(back, &cfg);
 
                /* Screen size changed ? */
                if (cfg.height != prev_cfg.height ||