Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/draw_piano.py
diff options
context:
space:
mode:
Diffstat (limited to 'draw_piano.py')
-rwxr-xr-xdraw_piano.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/draw_piano.py b/draw_piano.py
index 5c1fbfb..93ae6b0 100755
--- a/draw_piano.py
+++ b/draw_piano.py
@@ -124,7 +124,10 @@ class PianoKeyboard(Gtk.DrawingArea):
elif event.type in (Gdk.EventType.TOUCH_END,
Gdk.EventType.BUTTON_RELEASE):
del self._touches[seq]
- updated_positions = True
+ # execute the update pressed keys with a delay,
+ # because motion events can came after the button release
+ # and all the state is confused
+ GObject.timeout_add(10, self._update_pressed_keys, old_touches)
if updated_positions:
self._update_pressed_keys(old_touches)
@@ -165,7 +168,6 @@ class PianoKeyboard(Gtk.DrawingArea):
min_x = self._width
max_x = 0
for touch in uniq_touches:
- logging.error('TOUCH %s %s', touch.__class__, touch)
min_x_touch, max_x_touch = \
self.get_damaged_range(int(touch[0]), int(touch[1]))
if min_x_touch < min_x: