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 5cd86d45da74ebf34224157f12d693e82b59f4b2 (commit) via 0e4c5008405449803a027e648fdf868ac56cc831 (commit) from 09bc0dca7b0d23abbeb091baea61573a9cc0411d (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/5cd86d45da74ebf34224157f12d693e82b59f...
commit 5cd86d45da74ebf34224157f12d693e82b59f4b2 Author: Cyril Hrubis metan@ucw.cz Date: Sun Mar 31 19:27:23 2013 +0200
pywrap: backends: Make use of WaitEvent and PollEvent.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/py_simple/gfx.py b/demos/py_simple/gfx.py index 9c1ce13..2c9aef3 100755 --- a/demos/py_simple/gfx.py +++ b/demos/py_simple/gfx.py @@ -149,7 +149,7 @@ def main():
# Event loop while True: - ev = bk.Wait() + ev = bk.WaitEvent()
input.EventDump(ev)
diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py index c61f5ff..6c5e97c 100755 --- a/demos/py_simple/showimage.py +++ b/demos/py_simple/showimage.py @@ -23,7 +23,7 @@ def main():
# Event loop while True: - ev = bk.Wait() + ev = bk.WaitEvent()
input.EventDump(ev)
diff --git a/pylib/gfxprim/backends/_extend_backend.py b/pylib/gfxprim/backends/_extend_backend.py index 53e1700..d2f22b5 100644 --- a/pylib/gfxprim/backends/_extend_backend.py +++ b/pylib/gfxprim/backends/_extend_backend.py @@ -26,31 +26,31 @@ def extend_backend(_backend):
@extend(_backend) def Poll(self): + "Poll the backend." + c_backends.GP_BackendPoll(self) + + @extend(_backend) + def PollEvent(self): "Poll the backend for events." 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: + if c_backends.GP_BackendPollEvent(self, ev) != 0: return ev
return None
+ @extend(_backend) def Wait(self): - "Waits for backend event" + "Waits for backend." + c_backends.GP_BackendWait(self) + + @extend(_backend) + def WaitEvent(self): + "Waits for backend event." 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) + c_backends.GP_BackendWaitEvent(self, ev)
return ev
http://repo.or.cz/w/gfxprim.git/commit/0e4c5008405449803a027e648fdf868ac56cc...
commit 0e4c5008405449803a027e648fdf868ac56cc831 Author: Cyril Hrubis metan@ucw.cz Date: Sun Mar 31 19:18:11 2013 +0200
backends: Add WaitEvent and PollEvent
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/include/backends/GP_Backend.h b/include/backends/GP_Backend.h index c1b89d6..02c5b29 100644 --- a/include/backends/GP_Backend.h +++ b/include/backends/GP_Backend.h @@ -185,6 +185,11 @@ static inline void GP_BackendPoll(GP_Backend *backend) }
/* + * Poll and GetEvent combined. + */ +int GP_BackendPollEvent(GP_Backend *self, GP_Event *ev); + +/* * Waits for backend events. */ static inline void GP_BackendWait(GP_Backend *backend) @@ -193,6 +198,11 @@ static inline void GP_BackendWait(GP_Backend *backend) }
/* + * Wait and GetEvent combined. + */ +int GP_BackendWaitEvent(GP_Backend *self, GP_Event *ev); + +/* * Sets backend caption, if supported. * * When setting caption is not possible/implemented non zero is returned. diff --git a/libs/backends/GP_Backend.c b/libs/backends/GP_Backend.c index 87959e3..c31f29e 100644 --- a/libs/backends/GP_Backend.c +++ b/libs/backends/GP_Backend.c @@ -102,3 +102,30 @@ int GP_BackendResizeAck(GP_Backend *self)
return 0; } + +int GP_BackendWaitEvent(GP_Backend *self, GP_Event *ev) +{ + int ret; + + for (;;) { + if ((ret = GP_BackendGetEvent(self, ev))) + return ret; + + GP_BackendWait(self); + } +} + +int GP_BackendPollEvent(GP_Backend *self, GP_Event *ev) +{ + int ret; + + if ((ret = GP_BackendGetEvent(self, ev))) + return ret; + + GP_BackendPoll(self); + + if ((ret = GP_BackendGetEvent(self, ev))) + return ret; + + return 0; +}
-----------------------------------------------------------------------
Summary of changes: demos/py_simple/gfx.py | 2 +- demos/py_simple/showimage.py | 2 +- include/backends/GP_Backend.h | 10 ++++++++++ libs/backends/GP_Backend.c | 27 +++++++++++++++++++++++++++ pylib/gfxprim/backends/_extend_backend.py | 28 ++++++++++++++-------------- 5 files changed, 53 insertions(+), 16 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.