From 69d6bf85972c1d0a19f13490d93961a4e3a72d6a Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Sun, 1 May 2005 09:44:41 +0000 Subject: [PATCH] Bug 288729 gtk2 native keybindings prevent default enter event r+sr=bryner a=asa --- widget/src/gtk2/nsNativeKeyBindings.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/widget/src/gtk2/nsNativeKeyBindings.cpp b/widget/src/gtk2/nsNativeKeyBindings.cpp index 91f75a67cef..8de4e0c7a54 100644 --- a/widget/src/gtk2/nsNativeKeyBindings.cpp +++ b/widget/src/gtk2/nsNativeKeyBindings.cpp @@ -49,6 +49,7 @@ static nsINativeKeyBindings::DoCommandCallback gCurrentCallback; static void *gCurrentCallbackData; +static PRBool gHandled; // Common GtkEntry and GtkTextView signals static void @@ -56,6 +57,7 @@ copy_clipboard_cb(GtkWidget *w, gpointer user_data) { gCurrentCallback("cmd_copy", gCurrentCallbackData); g_signal_stop_emission_by_name(w, "copy_clipboard"); + gHandled = PR_TRUE; } static void @@ -63,6 +65,7 @@ cut_clipboard_cb(GtkWidget *w, gpointer user_data) { gCurrentCallback("cmd_cut", gCurrentCallbackData); g_signal_stop_emission_by_name(w, "cut_clipboard"); + gHandled = PR_TRUE; } // GTK distinguishes between display lines (wrapped, as they appear on the @@ -90,6 +93,7 @@ delete_from_cursor_cb(GtkWidget *w, GtkDeleteType del_type, gint count, gpointer user_data) { g_signal_stop_emission_by_name(w, "delete_from_cursor"); + gHandled = PR_TRUE; PRBool forward = count > 0; if (PRUint32(del_type) >= NS_ARRAY_LENGTH(sDeleteCommands)) { @@ -181,6 +185,7 @@ move_cursor_cb(GtkWidget *w, GtkMovementStep step, gint count, gboolean extend_selection, gpointer user_data) { g_signal_stop_emission_by_name(w, "move_cursor"); + gHandled = PR_TRUE; PRBool forward = count > 0; if (PRUint32(step) >= NS_ARRAY_LENGTH(sMoveCommands)) { // unsupported movement type @@ -203,6 +208,7 @@ paste_clipboard_cb(GtkWidget *w, gpointer user_data) { gCurrentCallback("cmd_paste", gCurrentCallbackData); g_signal_stop_emission_by_name(w, "paste_clipboard"); + gHandled = PR_TRUE; } // GtkTextView-only signals @@ -211,6 +217,7 @@ select_all_cb(GtkWidget *w, gboolean select, gpointer user_data) { gCurrentCallback("cmd_selectAll", gCurrentCallbackData); g_signal_stop_emission_by_name(w, "select_all"); + gHandled = PR_TRUE; } void @@ -283,17 +290,15 @@ nsNativeKeyBindings::KeyPress(const nsNativeKeyEvent& aEvent, gCurrentCallback = aCallback; gCurrentCallbackData = aCallbackData; - PRBool handled = PR_FALSE; + gHandled = PR_FALSE; - if (gtk_bindings_activate(GTK_OBJECT(mNativeTarget), - keyCode, GdkModifierType(modifiers))) { - handled = PR_TRUE; - } + gtk_bindings_activate(GTK_OBJECT(mNativeTarget), + keyCode, GdkModifierType(modifiers)); gCurrentCallback = nsnull; gCurrentCallbackData = nsnull; - return handled; + return gHandled; } PRBool