Re: gtk accelerator problem (GTK+ 2.0)



On 2/14/12, jumbophut <removed> wrote:
const gchar *str = "q";
gtk_accelerator_parse(str, &keyval, &keymods);
GClosure * closure = g_cclosure_new_swap(G_CALLBACK(popup), NULL, NULL);

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.

Perhaps answering my own question, I believe the reason it doesn't
work is that gtk_window_key_release_event never even calls
gtk_window_activate_key (the latter is required to trigger any
registered accelerators).  This is in contrast to
gtk_window_key_press_event, which does call the activate routine.

If this is correct, there is a bug in the documentation, since there
would never be any point in using "<release>".  Would it be possible
for someone out there to confirm that I am reading the GTK+ source
correctly?  I will then look into how I would go about getting the
documentation changed?

On a slightly related note, even when using key press rather than key
release, I discovered that the cursor keys cannot be used as
accelerators.  This is "documented" only in the source code, and
attempting to assign them as accelerators fails completely silently
(grrrr).

-- 
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]