Commits

Lars Wassermann committed 76bfdbc

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

  • Participants
  • Parent commits 7e8d424

Comments (0)

Files changed (1)

File spyvm/primitives.py

 
 @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)
 
 
 # ___________________________________________________________________________