GdkModifiers bitmask and GDK_SHIFT_MASK question



Hi,

I have another problem regarding keyboard shortcuts:
in my code I set a bitmask in the following way:

GdkModifier modifiers = GDK_SHIFT_MASK | GDK_CONTROL_MASK;
guint key = GDK_r;

So, this should represent Ctrl+Shift+r.
In the callback function for a key-press-event I have the following
code:

gboolean got_key_event(GtkWidget *widget, GdkEventKey *event,
gpointer user_data) 
{
        if (event->keyval == key && event->state == mods)
        {
                ...
        }
}
The problem is, for Ctrl+Shift+r this does not work because the
event->keyval is GDK_R.
At the moment I check whether Shift is in event->state and then I
add to the variable key 32 (only if key is between GDK_a and GDK_z) so
the key is the capital of the original value. This works somehow but is
there a better way if the key value is given with GDK_r and not GDK_R?

regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.key
Geany, a lightweight IDE using GTK2 - http://geany.uvena.de


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