Author: Lars Wassermann <[email protected]>
Branch: 
Changeset: r229:76bfdbc738e7
Date: 2013-03-21 16:08 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/76bfdbc738e7/

Log:    (tfel, lwassermann): minor fix to not send empty key-events when
        there were none

diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -661,11 +661,19 @@
 
 @expose_primitive(KBD_NEXT, unwrap_spec=[object])
 def func(interp, s_frame, w_rcvr):
-    return interp.space.wrap_int(interp.space.get_display().next_keycode())
+    code = interp.space.get_display().next_keycode()
+    if code == 0:
+        return interp.space.w_nil
+    else:
+        return interp.space.wrap_int(code)
 
 @expose_primitive(KBD_PEEK, unwrap_spec=[object])
 def func(interp, s_frame, w_rcvr):
-    return interp.space.wrap_int(interp.space.get_display().peek_keycode())
+    code = interp.space.get_display().peek_keycode()
+    if code == 0:
+        return interp.space.w_nil
+    else:
+        return interp.space.wrap_int(code)
 
 
 # ___________________________________________________________________________
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to