Bug 1176929 - Disable Ctrl-K in GtkEntry unless custom key bindings are

set on GTK3. r=karlt
This commit is contained in:
Andrew Comminos 2015-09-24 12:37:08 -07:00
parent d5f5467827
commit 24d5f445ce
2 changed files with 20 additions and 2 deletions

View File

@ -65,9 +65,25 @@ 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 = true;
bool forward = count > 0;
#if (MOZ_WIDGET_GTK == 3)
// Ignore GTK's Ctrl-K keybinding introduced in GTK 3.14 and removed in
// 3.18 if the user has custom bindings set. See bug 1176929.
if (del_type == GTK_DELETE_PARAGRAPH_ENDS && forward && GTK_IS_ENTRY(w) &&
!gtk_check_version(3, 14, 1) && gtk_check_version(3, 17, 9)) {
GtkStyleContext* context = gtk_widget_get_style_context(w);
GtkStateFlags flags = gtk_widget_get_state_flags(w);
GPtrArray* array;
gtk_style_context_get(context, flags, "gtk-key-bindings", &array, nullptr);
if (!array)
return;
g_ptr_array_unref(array);
}
#endif
gHandled = true;
if (uint32_t(del_type) >= ArrayLength(sDeleteCommands)) {
// unsupported deletion type
return;

View File

@ -540,6 +540,7 @@ STUB(gtk_scale_new)
STUB(gtk_scrollbar_new)
STUB(gtk_style_context_add_class)
STUB(gtk_style_context_add_region)
STUB(gtk_style_context_get)
STUB(gtk_style_context_get_background_color)
STUB(gtk_style_context_get_border)
STUB(gtk_style_context_get_border_color)
@ -555,6 +556,7 @@ STUB(gtk_style_context_set_path)
STUB(gtk_style_context_set_state)
STUB(gtk_tree_view_column_get_button)
STUB(gtk_widget_get_preferred_size)
STUB(gtk_widget_get_state_flags)
STUB(gtk_widget_get_style_context)
STUB(gtk_widget_path_append_type)
STUB(gtk_widget_path_free)