зеркало из https://github.com/github/putty.git
Don't defer displaying the prompt label in gtkask.
The previous sequence of events was that I would display the window synchronously (via gtk_widget_show_now), so that I knew it was actually on the screen and realised as an X window, and then I'd grab the keyboard, and once the keyboard was grabbed, connect up the keyboard event handlers and display the prompt. I have to assume that deferring the display of the 'enter the passphrase' prompt until the keyboard handlers were set up was intended as some sort of 'not misleading the user' measure - don't tell them to start typing until we're actually ready to start typing. But unfortunately it has the side effect that the window is displayed at a much smaller size before the prompt label appears, and centred on the screen according to _that_ size - and then we display the prompt label and the window resizes and is now off-centre. So I think it's better not to try to be clever, and just make the window come up at the right size initially. (Actually, it looks as if nothing in the window is actually drawn until that whole init function is finished anyway, so the prompt label _already_ doesn't get physically displayed too early. So the whole idea was pointless in the first place!)
This commit is contained in:
Родитель
777f38e491
Коммит
9458377275
|
@ -304,6 +304,7 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx,
|
|||
gtk_window_set_position(GTK_WINDOW(ctx->dialog), GTK_WIN_POS_CENTER);
|
||||
ctx->promptlabel = gtk_label_new(prompt_text);
|
||||
align_label_left(GTK_LABEL(ctx->promptlabel));
|
||||
gtk_widget_show(ctx->promptlabel);
|
||||
gtk_label_set_line_wrap(GTK_LABEL(ctx->promptlabel), TRUE);
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
gtk_label_set_width_chars(GTK_LABEL(ctx->promptlabel), 48);
|
||||
|
@ -388,7 +389,7 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx,
|
|||
|
||||
/*
|
||||
* And now that we've got the keyboard grab, connect up our
|
||||
* keyboard handlers, and display the prompt.
|
||||
* keyboard handlers.
|
||||
*/
|
||||
#if GTK_CHECK_VERSION(2,0,0)
|
||||
g_signal_connect(G_OBJECT(ctx->imc), "commit",
|
||||
|
@ -402,7 +403,6 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx,
|
|||
gtk_im_context_set_client_window(ctx->imc,
|
||||
gtk_widget_get_window(ctx->dialog));
|
||||
#endif
|
||||
gtk_widget_show(ctx->promptlabel);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче