From d7c2dbed927b08b4de60443717b2f27873ae5ed3 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Wed, 20 Apr 2011 02:38:05 +0200 Subject: [PATCH] graphics: fix needs_redraw + properly handle videoexpose event to update canvas. Closes #28 (now drawing happen only when needed. carefully check for any bugs !!!) --- kivy/core/window/window_pygame.py | 5 ++++- kivy/graphics/instructions.pyx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kivy/core/window/window_pygame.py b/kivy/core/window/window_pygame.py index c907f1949..e4f7850c2 100644 --- a/kivy/core/window/window_pygame.py +++ b/kivy/core/window/window_pygame.py @@ -222,8 +222,11 @@ class WindowPygame(WindowBase): Clock.unschedule(cb) Clock.schedule_once(cb, .1) + elif event.type == pygame.VIDEOEXPOSE: + self.canvas.ask_update() + # ignored event - elif event.type in (pygame.ACTIVEEVENT, pygame.VIDEOEXPOSE): + elif event.type == pygame.ACTIVEEVENT: pass # unhandled event ! diff --git a/kivy/graphics/instructions.pyx b/kivy/graphics/instructions.pyx index b77709c75..457df7836 100644 --- a/kivy/graphics/instructions.pyx +++ b/kivy/graphics/instructions.pyx @@ -68,7 +68,7 @@ cdef class Instruction: property needs_redraw: def __get__(self): - return bool(self.flags | GI_NEEDS_UPDATE) + return bool(self.flags & GI_NEEDS_UPDATE) cdef class InstructionGroup(Instruction):