Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/keyboard.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-08-08 13:52:13 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-08-09 10:44:50 (GMT)
commit52cdd25b95027678e1aaa2d29ce899cdfcc95e9c (patch)
treee7215d4f8a3d2a677c4243d14a096b7fa2b2c8ea /keyboard.py
parent01f0549f788c520b7cc030d1c2fad056cd783935 (diff)
Hack to allow SHIFT and ALT GR mask
When SHIFT or ALT GR are pressed the characters on the keyboard change to show the correct symbols that are going to be typed. Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Diffstat (limited to 'keyboard.py')
-rw-r--r--keyboard.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/keyboard.py b/keyboard.py
index 90cbf98..3a05248 100644
--- a/keyboard.py
+++ b/keyboard.py
@@ -506,14 +506,28 @@ class KeyboardWidget(KeyboardData, Gtk.DrawingArea):
# Hack to get the current modifier state - which will not be represented by the event.
# state = Gdk.device_get_core_pointer().get_state(self.get_window())[1]
- if self.active_group != event.group or self.active_state != event.state:
+ # This is a NEW HACK for the Gtk3 version of Typing Turtle. I
+ # didn't find the way to translate the old hack into a new one
+ state = event.state
+ if event.hardware_keycode in (50, 62):
+ if event.type == Gdk.EventType.KEY_PRESS:
+ state |= Gdk.ModifierType.SHIFT_MASK
+ else:
+ state ^= Gdk.ModifierType.SHIFT_MASK
+ if event.hardware_keycode == 92:
+ if event.type == Gdk.EventType.KEY_PRESS:
+ state |= Gdk.ModifierType.MOD5_MASK
+ else:
+ state ^= Gdk.ModifierType.MOD5_MASK
+
+ if self.active_group != event.group or self.active_state != state:
self.active_group = event.group
- self.active_state = event.state
+ self.active_state = state
self.queue_draw()
if event.string:
- sig = self.format_key_sig(event.hardware_keycode, event.state, event.group)
+ sig = self.format_key_sig(event.hardware_keycode, state, event.group)
if not self.letter_map.has_key(sig):
self.letter_map[sig] = event.string
self.queue_draw()