--- putty-0.58/WINDOWS/WINDOW.C	2005-04-05 15:37:38.000000000 -0400
+++ putty-src/WINDOWS/WINDOW.C	2006-02-08 16:57:56.000000000 -0500
@@ -297,7 +297,7 @@
 {
     WNDCLASS wndclass;
     MSG msg;
-    int guess_width, guess_height;
+    int guess_width, guess_height,use_left,use_top;
 
     hinst = inst;
     hwnd = NULL;
@@ -658,8 +658,18 @@
 	    exwinmode |= WS_EX_TOPMOST;
 	if (cfg.sunken_edge)
 	    exwinmode |= WS_EX_CLIENTEDGE;
+
+
+	if (cfg.save_windowpos) {
+			use_left = cfg.windowpos_left;
+			use_top = cfg.windowpos_top;
+	} else {
+			use_left = CW_USEDEFAULT;
+			use_top = CW_USEDEFAULT;
+	}
+
 	hwnd = CreateWindowEx(exwinmode, appname, appname,
-			      winmode, CW_USEDEFAULT, CW_USEDEFAULT,
+			      winmode, use_left, use_top,
 			      guess_width, guess_height,
 			      NULL, NULL, inst, NULL);
     }
@@ -804,6 +814,15 @@
     ShowWindow(hwnd, show);
     SetForegroundWindow(hwnd);
 
+	/* BKG */
+	if (!filename_is_null(cfg.iconfile)) {
+		char *fn = filename_to_str(&cfg.iconfile);
+		HICON icon;
+		icon = ExtractIcon(hwnd,fn,0);
+		if ((icon != NULL) && (icon != (HICON) 1))
+			SendMessage(hwnd, WM_SETICON, (WPARAM) ICON_SMALL,
+					(LPARAM) icon);
+	}
     /*
      * Set the palette up.
      */
--- putty-0.58/MAC/MACSTUFF.H	2005-04-05 15:37:40.000000000 -0400
+++ putty-src/MAC/MACSTUFF.H	2006-02-08 16:53:28.000000000 -0500
@@ -63,7 +63,9 @@
 
 #define HELPCTX(foo) I(0)
 
+/*BKG*/
 #define FILTER_KEY_FILES "pAgt.PPK"
+#define FILTER_ICON_FILES "pAgt.ICO"
 
 #define CP_UTF8 CS_UTF8		       /* from libcharset */
 
--- putty-0.58/SETTINGS.C	2005-04-05 15:37:51.000000000 -0400
+++ putty-src/SETTINGS.C	2006-02-08 16:25:06.000000000 -0500
@@ -247,6 +247,7 @@
     write_setting_i(sesskey, "SshProt", cfg->sshprot);
     write_setting_i(sesskey, "SSH2DES", cfg->ssh2_des_cbc);
     write_setting_filename(sesskey, "PublicKeyFile", cfg->keyfile);
+    write_setting_filename(sesskey, "IconFile", cfg->iconfile); /* BKG */
     write_setting_s(sesskey, "RemoteCommand", cfg->remote_cmd);
     write_setting_i(sesskey, "RFCEnviron", cfg->rfc_environ);
     write_setting_i(sesskey, "PassiveTelnet", cfg->passive_telnet);
@@ -278,6 +279,9 @@
     write_setting_i(sesskey, "AlwaysOnTop", cfg->alwaysontop);
     write_setting_i(sesskey, "FullScreenOnAltEnter", cfg->fullscreenonaltenter);
     write_setting_i(sesskey, "HideMousePtr", cfg->hide_mouseptr);
+    write_setting_i(sesskey, "SaveWindowPos", cfg->save_windowpos); /* BKG */
+    write_setting_i(sesskey, "SaveWindowTop", cfg->windowpos_top); /* BKG */
+    write_setting_i(sesskey, "SaveWindowLeft", cfg->windowpos_left); /* BKG */
     write_setting_i(sesskey, "SunkenEdge", cfg->sunken_edge);
     write_setting_i(sesskey, "WindowBorder", cfg->window_border);
     write_setting_i(sesskey, "CurType", cfg->cursor_type);
@@ -540,6 +544,7 @@
     gppi(sesskey, "AuthKI", 1, &cfg->try_ki_auth);
     gppi(sesskey, "SshNoShell", 0, &cfg->ssh_no_shell);
     gppfile(sesskey, "PublicKeyFile", &cfg->keyfile);
+    gppfile(sesskey, "IconFile", &cfg->iconfile); /* BKG */
     gpps(sesskey, "RemoteCommand", "", cfg->remote_cmd,
 	 sizeof(cfg->remote_cmd));
     gppi(sesskey, "RFCEnviron", 0, &cfg->rfc_environ);
@@ -573,6 +578,9 @@
     gppi(sesskey, "AlwaysOnTop", 0, &cfg->alwaysontop);
     gppi(sesskey, "FullScreenOnAltEnter", 0, &cfg->fullscreenonaltenter);
     gppi(sesskey, "HideMousePtr", 0, &cfg->hide_mouseptr);
+    gppi(sesskey, "SaveWindowPos", 0, &cfg->save_windowpos); /* BKG */
+    gppi(sesskey, "SaveWindowTop", 0, &cfg->windowpos_top);  /* BKG */
+    gppi(sesskey, "SaveWindowLeft", 0, &cfg->windowpos_left); /* BKG */
     gppi(sesskey, "SunkenEdge", 0, &cfg->sunken_edge);
     gppi(sesskey, "WindowBorder", 1, &cfg->window_border);
     gppi(sesskey, "CurType", 0, &cfg->cursor_type);
--- putty-0.58/WINDOWS/WINSTUFF.H	2005-04-05 15:37:38.000000000 -0400
+++ putty-src/WINDOWS/WINSTUFF.H	2006-02-08 16:51:30.000000000 -0500
@@ -135,6 +135,8 @@
  */
 #define FILTER_KEY_FILES ("PuTTY Private Key Files (*.ppk)\0*.ppk\0" \
 			      "All Files (*.*)\0*\0\0\0")
+#define FILTER_ICON_FILES ("Windows Icon files(*.ico)\0*.ico\0" \
+			      "All Files (*.*)\0*\0\0\0")
 #define FILTER_WAVE_FILES ("Wave Files (*.wav)\0*.WAV\0" \
 			       "All Files (*.*)\0*\0\0\0")
 
--- putty-0.58/CONFIG.C	2005-04-05 15:37:51.000000000 -0400
+++ putty-src/CONFIG.C	2006-02-08 16:52:22.000000000 -0500
@@ -1246,7 +1246,31 @@
 		 HELPCTX(appearance_border),
 		 dlg_stdeditbox_handler,
 		 I(offsetof(Config,window_border)), I(-1));
+	/*
+     * Brad's The Window/Position & Icon panel.
+     */
+	/* BKG */
+    s = ctrl_getset(b, "Window/Position & Icon", "position",
+		    "Remember Window Position");
+    ctrl_checkbox(s, "Remeber Window Positions", 'p',
+		  HELPCTX(appearance_hidemouse),
+		  dlg_stdcheckbox_handler, I(offsetof(Config,save_windowpos)));
+
+    ctrl_editbox(s, "Top:", NO_SHORTCUT, 20,
+		 HELPCTX(appearance_border),
+		 dlg_stdeditbox_handler,
+		 I(offsetof(Config,windowpos_top)), I(-1));
 
+    ctrl_editbox(s, "Left:", NO_SHORTCUT, 20,
+		 HELPCTX(appearance_border),
+		 dlg_stdeditbox_handler,
+		 I(offsetof(Config,windowpos_left)), I(-1));
+
+	/* BKG */
+	ctrl_filesel(s, "Icon file for window:", 'k',
+			 FILTER_ICON_FILES, FALSE, "Select icon file",
+			 HELPCTX(ssh_auth_privkey),
+			 dlg_stdfilesel_handler, I(offsetof(Config, iconfile)));
     /*
      * The Window/Behaviour panel.
      */
--- putty-0.58/UNIX/UNIX.H	2005-04-05 15:37:47.000000000 -0400
+++ putty-src/UNIX/UNIX.H	2006-02-08 16:52:54.000000000 -0500
@@ -31,6 +31,7 @@
  */
 #define HELPCTX(x) P(NULL)
 #define FILTER_KEY_FILES NULL          /* FIXME */
+#define FILTER_ICON_FILES NULL          /* FIXME */
 
 /*
  * Under X, selection data must not be NUL-terminated.
--- putty-0.58/PUTTY.H	2005-04-05 15:37:51.000000000 -0400
+++ putty-src/PUTTY.H	2006-02-08 16:36:18.000000000 -0500
@@ -560,6 +560,10 @@
     FontSpec widefont;
     FontSpec wideboldfont;
     int shadowboldoffset;
+	int save_windowpos;
+	int windowpos_top;
+	int windowpos_left;
+	Filename iconfile;
 };
 
 /*
