diff options
author | John Finlay <finlay@src.gnome.org> | 2005-04-09 06:59:03 +0000 |
---|---|---|
committer | John Finlay <finlay@src.gnome.org> | 2005-04-09 06:59:03 +0000 |
commit | b909e415cc90041d5152264ce88c5cacadddea54 (patch) | |
tree | 16503123a0a7f197c80e12488fe9e0a6bd2c47f4 | |
parent | 7679589e6bcae328418da2c7cd9caeeac2caa7c7 (diff) | |
download | pygtk-b909e415cc90041d5152264ce88c5cacadddea54.tar.gz |
update translate_keycode_state() example
* update translate_keycode_state() example
-rw-r--r-- | docs/reference/pygtk-gdkkeymap.xml | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/docs/reference/pygtk-gdkkeymap.xml b/docs/reference/pygtk-gdkkeymap.xml index 80340e30..1d7c48df 100644 --- a/docs/reference/pygtk-gdkkeymap.xml +++ b/docs/reference/pygtk-gdkkeymap.xml @@ -429,9 +429,10 @@ key press and release events.</simpara> <refsect3> <title>Consumed Modifiers</title> - <para>The consumed_modifiers are modifiers that should be masked out -from state when comparing this key press to a hot key. For instance, on a US -keyboard, the <keysym>plus</keysym> symbol is shifted, so when comparing a key press to a + <para>The consumed modifiers are modifiers that should be masked out +from <parameter>state</parameter> when comparing this key press to a hot +key. For instance, on a US keyboard, the <keysym>plus</keysym> symbol is +shifted, so when comparing a key press to a <keycombo> <keycap>Control</keycap><keysym>plus</keysym></keycombo> accelerator <keycap>Shift</keycap> should be masked out. For @@ -443,11 +444,17 @@ keyboard, the <keysym>plus</keysym> symbol is shifted, so when comparing a key p | gtk.gdk.MOD1_MASK) keyval, egroup, level, consumed = keymap.translate_keyboard_state( event.hardware_keycode, event.state, event.group) - if (keyval == ord('+') and + if (keyval == gtk.keysyms.plus and (event.state & ~consumed & ALL_ACCELS_MASK) == gtk.gdk.CONTROL_MASK): # Control was pressed </programlisting> + <para>Note that most keys that are affected by the +<keycap>Shift</keycap> key will have <literal>gtk.gdk.SHIFT_MASK</literal> +part of the consumed modifiers (e.g. <keycombo> +<keycap>Control</keycap><keycap>Shift</keycap><keycap>Tab</keycap> +</keycombo>).</para> + <para>All single modifier combinations that could affect the key for any combination of modifiers will be returned in consumed_modifiers. Multi-modifier combinations are returned only when actually found in |