gtk_bindings_activate



Hi! I think there is a bug in the gtk_bindings_activate from gtkbindings.
I'm not sure, thus I didn't open it.

Here is example of what happens:

    GtkWidget *entry;
    entry = gtk_entry_new ();
//... Some routines like settext
  int modifiers = 0;
  modifiers |= GDK_CONTROL_MASK;
gtk_bindings_activate(G_OBJECT(entry),118,modifiers); //118 is the keycode of 'V', and it works (text is pasted).
gtk_bindings_activate(G_OBJECT(entry),1741,modifiers);
/*
1741 is the code of Cyrillic_em, which is located on the same physical key as 'V'. So thei shortcut should work too, but gtk_bindings_activate returns FALSE.
What's wrong? Should it work or the idea of gtk_bindings_activate in something else?
*/

Here is another example of shortcut (for the menu, I got it from the Gtk+-2.0 tutorial):

static GtkItemFactoryEntry menu_items[] = {
  { "/File/_New",     "<control>V", print_hello,    0, "<Item>" } }
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
  GtkItemFactory *item_factory;
  GtkAccelGroup *accel_group;
  accel_group = gtk_accel_group_new ();
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>",
                                       accel_group);
  gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
  gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);

/* It doesn't depends on the language group and works both for the 'V' and for the Cyrillic_em */

I don't understand the difference between Accelerators and Bindings. But I think I need gtk_binding_activate (it is in the code I work with). I will try to look the code of the gtk_bindings_activate functions, but it's hard to me (I'm week in gtk). It uses key hashes -- should it depend on the language group?

Best regards, E.I.

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