This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via d5c09d5b8cd72e73f0e0df4110a3981f943d44f9 (commit) from 81cfb3c3c3d08268a25747d38e05274c8b335300 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/d5c09d5b8cd72e73f0e0df4110a3981f943d4...
commit d5c09d5b8cd72e73f0e0df4110a3981f943d44f9 Author: Cyril Hrubis metan@ucw.cz Date: Tue Mar 19 23:36:12 2013 +0100
pywrap: backends: The Wait and Poll returns events directly.
diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py index b952078..c61f5ff 100755 --- a/demos/py_simple/showimage.py +++ b/demos/py_simple/showimage.py @@ -14,15 +14,16 @@ def main():
# Load Image img = loaders.Load(sys.argv[1]) - + + # Create X11 window bk = backends.BackendX11Init(None, 0, 0, img.w, img.h, sys.argv[1], 0) assert(bk) img.Blit(0, 0, bk.context, 0, 0, img.w, img.h) bk.Flip()
+ # Event loop while True: - bk.Wait() - ev = bk.GetEvent() + ev = bk.Wait()
input.EventDump(ev)
diff --git a/pylib/gfxprim/backends/_extend_backend.py b/pylib/gfxprim/backends/_extend_backend.py index 97975a7..53e1700 100644 --- a/pylib/gfxprim/backends/_extend_backend.py +++ b/pylib/gfxprim/backends/_extend_backend.py @@ -27,12 +27,32 @@ def extend_backend(_backend): @extend(_backend) def Poll(self): "Poll the backend for events." - return c_backends.GP_BackendPoll(self) + ev = c_input.GP_Event(); + + if c_backends.GP_BackendGetEvent(self, ev) != 0: + return ev + + c_backends.GP_BackendPoll(self) + + if c_backends.GP_BackendGetEvent(self, ev) != 0: + return ev + + return None
@extend(_backend) def Wait(self): "Waits for backend event" - return c_backends.GP_BackendWait(self) + ev = c_input.GP_Event(); + + if c_backends.GP_BackendGetEvent(self, ev) != 0: + return ev + + while c_backends.GP_BackendGetEvent(self, ev) == 0: + c_backends.GP_BackendWait(self) + + c_backends.GP_BackendGetEvent(self, ev) + + return ev
@extend(_backend) def SetCaption(self, caption): @@ -43,13 +63,3 @@ def extend_backend(_backend): def Resize(self, w, h): "Resize backend window (if possible)" return c_backends.GP_BackendResize(self, w, h) - - @extend(_backend) - def GetEvent(self): - "Removes and returns event from the top of the event queue" - if c_backends.GP_BackendEventsQueued(self) == 0: - return None - ev = c_input.GP_Event(); - if c_backends.GP_BackendGetEvent(self, ev) != 0: - return ev - return None
-----------------------------------------------------------------------
Summary of changes: demos/py_simple/showimage.py | 7 +++-- pylib/gfxprim/backends/_extend_backend.py | 34 ++++++++++++++++++---------- 2 files changed, 26 insertions(+), 15 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.