mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Windows Pageant: add --keylist option.
This causes the main key list window to open when Pageant starts up, instead of waiting until you select 'View Keys' from the systray menu. My main motivation for adding this option is for development: if I'm _working_ on some detail of the key list window, it cuts down keystrokes in my edit-compile-retry cycle if I can have it automatically pop up in every new test run of Pageant. Normally I'd solve that by hacking an extra couple of lines temporarily into the code while I was doing that piece of development. But it suddenly struck me that there's no reason _not_ to add an option like this permanently (the space of word-length command-line flags is huge, and that particular one is unlikely to be needed for a different meaning), and who knows, it _might_ come in useful to someone in normal use. And at the very least it'll save me doing another temporary hack the next time I'm doing development work on the Pageant GUI. So I'll leave it in.
This commit is contained in:
parent
c1334f3b08
commit
44c084f33f
@ -1055,6 +1055,15 @@ static char *answer_filemapping_message(const char *mapname)
|
||||
return err;
|
||||
}
|
||||
|
||||
static void create_keylist_window(void)
|
||||
{
|
||||
if (keylist)
|
||||
return;
|
||||
|
||||
keylist = CreateDialog(hinst, MAKEINTRESOURCE(211), NULL, KeyListProc);
|
||||
ShowWindow(keylist, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
@ -1122,11 +1131,7 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
|
||||
SendMessage(hwnd, WM_CLOSE, 0, 0);
|
||||
break;
|
||||
case IDM_VIEWKEYS:
|
||||
if (!keylist) {
|
||||
keylist = CreateDialog(hinst, MAKEINTRESOURCE(211),
|
||||
NULL, KeyListProc);
|
||||
ShowWindow(keylist, SW_SHOWNORMAL);
|
||||
}
|
||||
create_keylist_window();
|
||||
/*
|
||||
* Sometimes the window comes up minimised / hidden for
|
||||
* no obvious reason. Prevent this. This also brings it
|
||||
@ -1303,6 +1308,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
MSG msg;
|
||||
const char *command = NULL;
|
||||
bool added_keys = false;
|
||||
bool show_keylist_on_startup = false;
|
||||
int argc, i;
|
||||
char **argv, **argstart;
|
||||
|
||||
@ -1404,6 +1410,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
!strcmp(p, "--encrypted") ||
|
||||
!strcmp(p, "-encrypted")) {
|
||||
add_keys_encrypted = true;
|
||||
} else if (!strcmp(p, "-keylist") || !strcmp(p, "--keylist")) {
|
||||
show_keylist_on_startup = true;
|
||||
} else if (!strcmp(p, "-c")) {
|
||||
/*
|
||||
* If we see `-c', then the rest of the
|
||||
@ -1564,6 +1572,9 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
&inst, 0, &wm_copydata_threadid);
|
||||
handle_add_foreign_event(wmct.ev_msg_ready, wm_copydata_got_msg, NULL);
|
||||
|
||||
if (show_keylist_on_startup)
|
||||
create_keylist_window();
|
||||
|
||||
/*
|
||||
* Main message loop.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user