From 685e28f858bc73ed06513889da6a2b08c92b9d91 Mon Sep 17 00:00:00 2001 From: Archana Date: Wed, 8 Jan 2014 09:57:00 -0500 Subject: [PATCH] Bug 414071 - Let escape key close crash reporter dialog. r=ted --- .../client/crashreporter_gtk_common.cpp | 16 ++++++++++++++-- .../client/crashreporter_gtk_common.h | 1 + .../crashreporter/client/crashreporter_linux.cpp | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/toolkit/crashreporter/client/crashreporter_gtk_common.cpp b/toolkit/crashreporter/client/crashreporter_gtk_common.cpp index 4ab3f212e925..58d0f6d0c9f1 100644 --- a/toolkit/crashreporter/client/crashreporter_gtk_common.cpp +++ b/toolkit/crashreporter/client/crashreporter_gtk_common.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -215,14 +216,25 @@ gpointer SendThread(gpointer args) } gboolean WindowDeleted(GtkWidget* window, - GdkEvent* event, - gpointer userData) + GdkEvent* event, + gpointer userData) { SaveSettings(); gtk_main_quit(); return TRUE; } +gboolean check_escape(GtkWidget* window, + GdkEventKey* event, + gpointer userData) +{ + if (event->keyval == GDK_KEY_Escape) { + gtk_main_quit(); + return TRUE; + } + return FALSE; +} + static void MaybeSubmitReport() { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gSubmitReportCheck))) { diff --git a/toolkit/crashreporter/client/crashreporter_gtk_common.h b/toolkit/crashreporter/client/crashreporter_gtk_common.h index 15bc471e6abf..b2952a79012a 100644 --- a/toolkit/crashreporter/client/crashreporter_gtk_common.h +++ b/toolkit/crashreporter/client/crashreporter_gtk_common.h @@ -39,6 +39,7 @@ gpointer SendThread(gpointer args); gboolean WindowDeleted(GtkWidget* window, GdkEvent* event, gpointer userData); +gboolean check_escape(GtkWidget* window, GdkEventKey* event, gpointer data); void SubmitReportChecked(GtkButton* sender, gpointer userData); void IncludeURLClicked(GtkButton* sender, gpointer userData); void CloseClicked(GtkButton* button, diff --git a/toolkit/crashreporter/client/crashreporter_linux.cpp b/toolkit/crashreporter/client/crashreporter_linux.cpp index 9110ace269c1..82883f513b64 100644 --- a/toolkit/crashreporter/client/crashreporter_linux.cpp +++ b/toolkit/crashreporter/client/crashreporter_linux.cpp @@ -396,6 +396,7 @@ bool UIShowCrashUI(const string& dumpfile, gtk_window_set_position(GTK_WINDOW(gWindow), GTK_WIN_POS_CENTER); gtk_container_set_border_width(GTK_CONTAINER(gWindow), 12); g_signal_connect(gWindow, "delete-event", G_CALLBACK(WindowDeleted), 0); + g_signal_connect(gWindow, "key_press_event", G_CALLBACK(check_escape), nullptr); GtkWidget* vbox = gtk_vbox_new(FALSE, 6); gtk_container_add(GTK_CONTAINER(gWindow), vbox);