Revision: 1842 http://geany.svn.sourceforge.net/geany/?rev=1842&view=rev Author: ntrel Date: 2007-08-30 07:07:49 -0700 (Thu, 30 Aug 2007)
Log Message: ----------- Fix Ctrl-Shift bindings not working when caps lock is on.
Modified Paths: -------------- trunk/ChangeLog trunk/src/keybindings.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-08-30 10:33:09 UTC (rev 1841) +++ trunk/ChangeLog 2007-08-30 14:07:49 UTC (rev 1842) @@ -7,6 +7,8 @@ geany.conf in 'Hidden preferences' appendix. * src/keybindings.c: Rename non-menu keybinding titles, e.g. Tags menu -> Tags commands. + * src/keybindings.c: + Fix Ctrl-Shift bindings not working when caps lock is on.
2007-08-29 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2007-08-30 10:33:09 UTC (rev 1841) +++ trunk/src/keybindings.c 2007-08-30 14:07:49 UTC (rev 1842) @@ -643,12 +643,16 @@ /* central keypress event handler, almost all keypress events go to this function */ gboolean keybindings_got_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { - guint i, k; + guint i, keyval = event->keyval;
- if (event->keyval == 0) + if (keyval == 0) return FALSE;
- // ignore caps-lock + // hack to get around that CTRL+Shift+r results in GDK_R not GDK_r + if (event->state & GDK_SHIFT_MASK || event->state & GDK_LOCK_MASK) + if (keyval >= GDK_A && keyval <= GDK_Z) + keyval += GDK_a - GDK_A; + // now ignore caps-lock if (event->state & GDK_LOCK_MASK) event->state -= GDK_LOCK_MASK; // ignore numlock key, not necessary but nice @@ -663,18 +667,8 @@
for (i = 0; i < GEANY_MAX_KEYS; i++) { - // ugly hack to get around that CTRL+Shift+r results in 'R' not 'r' - k = keys[i]->key; - if (event->state & GDK_SHIFT_MASK) + if (keyval == keys[i]->key && event->state == keys[i]->mods) { - // skip entries which don't include SHIFT - if (! (keys[i]->mods & GDK_SHIFT_MASK)) continue; - // raise the keyval - if (keys[i]->key >= GDK_a && keys[i]->key <= GDK_z) k = keys[i]->key - 32; - } - - if (event->keyval == k && event->state == keys[i]->mods) - { if (keys[i]->cb_func == NULL) return FALSE; // ignore the keybinding
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.