[pypy-commit] lang-smalltalk default: (tfel, lwassermann): minor fix to not send empty key-events when there were none

lwassermann noreply at buildbot.pypy.org
Thu Mar 21 16:12:28 CET 2013


Author: Lars Wassermann <lars.wassermann at gmail.com>
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)
 
 
 # ___________________________________________________________________________


More information about the pypy-commit mailing list