mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-20 20:45:02 -05:00
Make sure Escape terminates the About box.
I think it only did so in GTK2 by virtue of the About box being a GtkDialog. But in GTK3 I've abandoned GtkDialog for not being flexible enough, so I have to process the Escape key myself.
This commit is contained in:
parent
612534a4b4
commit
10d3b73d33
@ -3585,6 +3585,15 @@ static void about_close_clicked(GtkButton *button, gpointer data)
|
|||||||
aboutbox = NULL;
|
aboutbox = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void about_key_press(GtkWidget *widget, GdkEventKey *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
if (event->keyval == GDK_KEY_Escape && aboutbox) {
|
||||||
|
gtk_widget_destroy(aboutbox);
|
||||||
|
aboutbox = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void licence_clicked(GtkButton *button, gpointer data)
|
static void licence_clicked(GtkButton *button, gpointer data)
|
||||||
{
|
{
|
||||||
char *title;
|
char *title;
|
||||||
@ -3673,6 +3682,9 @@ void about_box(void *window)
|
|||||||
our_dialog_add_to_content_area(GTK_WINDOW(aboutbox), w, FALSE, FALSE, 5);
|
our_dialog_add_to_content_area(GTK_WINDOW(aboutbox), w, FALSE, FALSE, 5);
|
||||||
gtk_widget_show(w);
|
gtk_widget_show(w);
|
||||||
|
|
||||||
|
g_signal_connect(G_OBJECT(aboutbox), "key_press_event",
|
||||||
|
G_CALLBACK(about_key_press), NULL);
|
||||||
|
|
||||||
set_transient_window_pos(GTK_WIDGET(window), aboutbox);
|
set_transient_window_pos(GTK_WIDGET(window), aboutbox);
|
||||||
gtk_window_set_transient_for(GTK_WINDOW(aboutbox),
|
gtk_window_set_transient_for(GTK_WINDOW(aboutbox),
|
||||||
GTK_WINDOW(window));
|
GTK_WINDOW(window));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user