gtk accelerator problem (GTK+ 2.0)



Hi folks

I have this bit of (working) code, which is designed to call a popup
routine whenever the 'q' key is pressed anywhere in my application:

GtkAccelGroup *accels = gtk_accel_group_new();
guint keyval;
GdkModifierType keymods;
const gchar *str = "q";
gtk_accelerator_parse(str, &keyval, &keymods);
GClosure * closure = g_cclosure_new_swap(G_CALLBACK(popup), NULL, NULL);
gtk_accel_group_connect(accels, keyval, keymods, GTK_ACCEL_VISIBLE, closure);
gtk_window_add_accel_group(GTK_WINDOW(toplevel), accels);

This successfully triggers the popup routine whenever I press the key
q (i.e. on the downstroke).

Now I change one line:

const gchar *str = "<Release>q";

According to the documentation, this should trigger the popup routine
when I _release_ the q key (i.e. on the upstroke).  However, it
doesn't work.  gtk_accelerator_parse is working (gives the expected
mask, which is GDK_RELEASE_MASK) but nothing happens when I press the
q key (either on the downstroke or the upstroke).

Am I doing something wrong or is this an example of a GTK or documentation bug?

I have tried searching on google and in this mailing list, without success.

-- 
Tony (echo 'spend!,pocket awide' | sed 'y/acdeikospntw!, /l omcgtjuba phi/')



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