From 35997bc815c869fcee2b1f158e3d28a6a3553c4e Mon Sep 17 00:00:00 2001
From: pin <pin@fe552daf-6dbe-4428-90eb-1537e0879342>
Date: Mon, 6 Sep 2010 13:20:12 +0000
Subject: [PATCH] =?utf8?q?Le=20test=20des=20boutons=20de=20la=20souris=20n?=
 =?utf8?q?'est=20pas=20fiable,=20tant=20que=20le=20set=5Fpos=20n'aura=20pa?=
 =?utf8?q?s=20comme=20param=C3=A8tre=20les=20boutons=20appuy=C3=A9s?=
 =?utf8?q?=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@314 fe552daf-6dbe-4428-90eb-1537e0879342
---
 src/minwii/widgets/cursors.py       | 5 ++++-
 src/minwii/widgets/playingscreen.py | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/minwii/widgets/cursors.py b/src/minwii/widgets/cursors.py
index f7940fd..4edc2dc 100755
--- a/src/minwii/widgets/cursors.py
+++ b/src/minwii/widgets/cursors.py
@@ -48,6 +48,7 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin):
         self.duration = duration
         
         self.image = self.images[0]
+        self.pressed = False
         # workarround cursor alignement problem
         pygame.event.set_blocked(pygame.MOUSEMOTION)
         pygame.mouse.set_pos(pygame.mouse.get_pos())
@@ -91,6 +92,7 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin):
         self.dirty = 1
         self._blinking = False
         self.image = self.flashImage
+        self.pressed = True
 
     @event_handler(pygame.MOUSEBUTTONUP)
     def flashOff(self, event) :
@@ -99,6 +101,7 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin):
             self._blinking = True
         else :
             self.image = self.images[0]
+        self.pressed = False
     
     @event_handler(pygame.MOUSEMOTION)
     def move(self, event) :
@@ -129,4 +132,4 @@ class ForeverTimer(Thread) :
             time.sleep(self.duration)
     
     def stop(self) :
-        self.running = False
\ No newline at end of file
+        self.running = False
diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py
index 66c4776..ca6a1e3 100755
--- a/src/minwii/widgets/playingscreen.py
+++ b/src/minwii/widgets/playingscreen.py
@@ -229,7 +229,7 @@ class SongPlayingScreen(PlayingScreenBase) :
     def handleEasyColumnOver(self, event) :
         col = event.column
         if col.state and \
-           any(event.mouseEvent.buttons) and \
+           self.cursor.pressed and \
            not self.currentNotePlayed :
             self.playnote(col, event.pos)
             SongPlayingScreen.setNoteTimeout(
@@ -242,7 +242,7 @@ class SongPlayingScreen(PlayingScreenBase) :
     def handleNormalColumnOver(self, event) :
         col = event.column
         if col.state and \
-           any(event.mouseEvent.buttons) and \
+           self.cursor.pressed and \
            not self.currentNotePlayed :
             self.playnote(col, event.pos)
             self.currentNotePlayed = True
-- 
2.20.1