After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 695380 - gtk_binding_entry_skip broken
gtk_binding_entry_skip broken
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GdkDevice
3.5.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Carlos Garnacho
Depends on:
Blocks:
 
 
Reported: 2013-03-07 18:30 UTC by Christian Persch
Modified: 2013-04-17 11:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (774 bytes, patch)
2013-03-07 18:30 UTC, Christian Persch
none Details | Review

Description Christian Persch 2013-03-07 18:30:14 UTC
Created attachment 238330 [details] [review]
patch

Steps to repro:
In gnome-terminal, uncheck the "enable menubar accel" setting from the keybindings dialogue (on <= 3.6; or in prefs dialogue, general tab, on 3.7). Now in the terminal, press Shift-F10.

Expected results:
Shift-F10 does not pop up the context menu; the key event is passed to the terminal application (prints some escape sequence).

Actual results:
Shift-F10 both emits the escape sequence *and* the popup menu is opened.

Analysis:

gnome-terminal uses gtk_binding_entry_skip to skip the Shift-F10 binding. 

Breaking on terminal_screen_popup_menu to find out where the menu popup comes from, we get this:

(gdb) where
  • #0 terminal_screen_popup_menu
    at ../../../src/terminal-screen.c line 1511
  • #1 _gtk_marshal_BOOLEAN__VOID
    at gtkmarshalers.c line 1992
  • #2 g_type_class_meta_marshal
    at gclosure.c line 970
  • #3 g_closure_invoke
    at gclosure.c line 777
  • #4 signal_emit_unlocked_R
    at gsignal.c line 3605
  • #5 g_signal_emitv
    at gsignal.c line 3056
  • #6 gtk_binding_entry_activate
    at gtkbindings.c line 651
  • #7 binding_activate
    at gtkbindings.c line 1523
  • #8 gtk_bindings_activate_list
    at gtkbindings.c line 1584
  • #9 gtk_bindings_activate_event
    at gtkbindings.c line 1669
  • #10 gtk_widget_real_key_press_event
    at gtkwidget.c line 5835

In frame #9, we have a list of GtkBindingEntry's of length 12:
(gdb) p entries
$1 = (GSList *) 0x838db00
(gdb) p g_list_length(entries)
$3 = 12
(gdb) p *((GtkBindingEntry*)g_list_nth_data(entries, 0))
$9 = {keyval = 65479, modifiers = GDK_SHIFT_MASK, binding_set = 0x82bad20, destroyed = 0, 
  in_emission = 0, marks_unbound = 1, set_next = 0x0, hash_next = 0x80a6ec0, signals = 0x0}
(gdb) p *((GtkBindingEntry*)g_list_nth_data(entries, 1))

As you can see, the entry has marks_unbound which marks this as a 'skip' entry, and all the other entries shouldn't cause a binding activation. (The popup-menu entries are elements 8..11 of the entry list.) However, activation nevertheless happens.

I think this broke in commit 9a3466832cc73ae29b704547747b8699132c1250 where the "if (unbound) break;" code was removed from the loop in gtk_bindings_activate_list().

Attaching the (untested since I currently can't compile gtk+) patch.
Comment 1 Christian Persch 2013-03-15 18:08:57 UTC
I have tested the patch now and it fixes the bug.
Comment 2 Christian Persch 2013-04-17 11:23:02 UTC
Pushed to master with OK from mclasen on #gtk+.