GtkCTree keyboard binding problem



I have a problem with the default bindings in GtkCTree. Pressing +
should expand a branch and - should collapse it, likewise for the
keypad. The keypad works, - likewise, but + has no effect. = should
toggle, but that doesn't work either.

I am using gtk+ 1.2.3, linux 2.2.10, slackware 4.0, XFree86 3.3.5.

I went though the code for GtkCTree, and found this:

  binding_set = gtk_binding_set_by_class (klass);
  gtk_binding_entry_add_signal (binding_set,
				'+', GDK_SHIFT_MASK,
				"change_focus_row_expansion", 1,
				GTK_TYPE_ENUM, GTK_CTREE_EXPANSION_EXPAND);

The + has to be shifted! On my keyboard it is not. A shifted + is a
question mark. Likewise for the binding of =, which is shifted on my
keyboard (unshifted it is zero), but shouldn't be according to the
bindings in GtkCTree.

Gtk+ is making some assumptions that don't always hold. You have to
press shift to get a + on an american keyboard, but not on a danish
keyboard. 

I think gtk+ should either make mappings that ignores modifiers, if
possible, or these keys should be mapped both shifted and
unshifted. Double mappings shouldn't harm, as the shifted/unshifted key
will normally generate another character, preventing mistakes. On my
keyboard, I cannot make a shifted +, because it generates a shifted
question mark. Likewise, I cannot make an unshifted question mark.

I did some changes to my program to test it, and the following changes
makes the keyboard shortcuts work in the GtkCtree with my keyboard.


    GtkCTree *ctree;
    GtkBindingSet *binding_set;

    ...

    binding_set = gtk_binding_set_by_class(GTK_OBJECT(ctree)->klass);
    gtk_binding_entry_add_signal(binding_set,
				 '+', 0,
				 "change_focus_row_expansion", 1,
				 GTK_TYPE_ENUM, GTK_CTREE_EXPANSION_EXPAND);
    gtk_binding_entry_add_signal(binding_set,
				 '=', GDK_SHIFT_MASK,
				 "change_focus_row_expansion", 1,
				 GTK_TYPE_ENUM, GTK_CTREE_EXPANSION_TOGGLE);


I just don't think this belongs in my application.


-- 
René Seindal (rene@seindal.dk)			http://www.seindal.dk/rene/
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]