VirtualBox

Opened 16 years ago

Closed 14 years ago

#1296 closed defect (fixed)

Key Repeat breaks application event handlers -> fixed in SVN

Reported by: Carlo Capocasa Owned by:
Component: other Version: VirtualBox 2.1.2
Keywords: Cc:
Guest type: other Host type: other

Description

Currently, VirtualBox apparently emulates key repeat events by repeatedly sending keyup and keydown events to the guest operating system, as if a user had really pressed keys that fast.

This is problematic for writing applications that require keyboard input, such as games or other interactive application software, since it is impossible to distinguish an actual key event from a repeated key event.

For example, in Internet Explorer and Firefox under Windows, key repeat usually triggers both the JavaScript keydown and keypress events, but not keyup. This way, it is relatively easy to filter out keydown events, since they are not followed by a keyup.

However, under Virtualbox, key repeat triggers keypress, keydown AND keyup events.

To immediately witness the effect, please try keyboard scrolling Google Maps with Firefox or IE in a Windows guest and a Linux host. You can also try the attached HTML file which contains reproduction code.

Thank you for the wonderful VirtualBox software, and I hope I can make it better this way!

Carlo

Attachments (1)

vboxbug-reproduce.html (841 bytes ) - added by Carlo Capocasa 16 years ago.
Reproduction Code

Download all attachments as: .zip

Change History (21)

by Carlo Capocasa, 16 years ago

Attachment: vboxbug-reproduce.html added

Reproduction Code

comment:1 by André Neves, 16 years ago

This bug is still present in 2.0.0 (with all the glory of breaking games).

comment:2 by Michael Thayer, 16 years ago

Was this on a Linux or Solaris host? I have just checked on my Linux system (don't have a Windows host available to test just now), and X11 sends both key release and key press events when I hold down a key. There is no indication that the key release event is "faked", except that the timestamp is the same as the following key press event. (Probably not always, but apparently usually).

comment:3 by André Neves, 16 years ago

In my case it is a Linux host.

comment:4 by Michael Thayer, 16 years ago

Resolution: fixed
Status: newclosed

This has been fixed for version 2.1 (it may still let through a few key up events, but it should catch most of them). The fix will not make it into future 2.0 versions though I'm afraid.

comment:5 by Michael Thayer, 16 years ago

Actually, this was a duplicate of #915.

comment:6 by Michael Thayer, 16 years ago

Summary: Key Repeat breaks application event handlersKey Repeat breaks application event handlers => fixed in svn

comment:7 by carlotheman, 15 years ago

Thanks for handling this, looking forward to testing it in 2.1. And thanks for VirtualBox, such a joy to work with! Carlo

comment:8 by carlotheman, 15 years ago

Resolution: fixed
Status: closedreopened

Hi! I know it seems fixed, but this bug seems to still be present in 2.1... I'll gladly answer questions, feel free to write to: theman (-&-&-AT-%-%-) carlocapocasa (-$-$-DOT-"-"-) com. While prioritizing this bug, please keep in mind I was forced to use VMWare for a while to finish my web application. Thanks for your great work on VirtualBox!

comment:9 by Michael Thayer, 15 years ago

Summary: Key Repeat breaks application event handlers => fixed in svnKey Repeat breaks application event handlers

Acknowledged. I thought that I had your test case working correctly, but I tried it out again and still get the original, wrong behaviour. I have now fixed this locally (again) and can no longer reproduce the wrong behaviour. I hope to commit this soon.

comment:10 by carlotheman, 15 years ago

Hi Michael, thanks a lot for looking into it again, I really appreciate it your responsiveness! Looking forward to testing this in the next release. Carlo

comment:11 by Michael Thayer, 15 years ago

Summary: Key Repeat breaks application event handlersKey Repeat breaks application event handlers -> fixed in SVN
Version: VirtualBox 1.5.6VirtualBox 2.1.2

I hope it is really fixed this time.

comment:12 by carlotheman, 15 years ago

Thanks for your responsiveness! I built SVN (rev 16769) from source and tested. There have not been any more keyup events when keeping keys pressed. Great!

Behavior of a native Windows host still differs slightly: Whenever there is a keydown event, there additionally is a keypress event.

comment:13 by Frank Mehnert, 15 years ago

Resolution: fixed
Status: reopenedclosed

Fix contained in 2.1.4.

comment:14 by carlotheman, 15 years ago

Resolution: fixed
Status: closedreopened

Sorry I probably wasn't clear; on a native Windows system, when there is a keydown event, there is also a keypress event. With the fix, there is only a keydown event.

While the difference is slight, it is still important to be able to rely on VirtualBox for Windows development.

comment:15 by Michael Thayer, 15 years ago

Without knowing how Windows is interpreting the keyboard data it gets from VirtualBox this will be hard to fix - the keyboard controller doesn't know anything about "keypress events", it just sends press and release events. If you can find out how the hardware events in VirtualBox differ from those of a real system we might be able to do something here.

comment:16 by carlotheman, 15 years ago

I understand. I will gladly tell you all I know about this.

  1. I have seen native systems where key repeat speed is configurable in the BIOS config tool. This would suggest that the keyboard controller does not send any key repeat information at all, but this happens somewhere on the motherboard. From what you say, VirtualBox currently does it in the keyboard controller itself. So you might need to take the repeat functionality out of the keyboard controller, and put it into another subsystem, which you might need to adapt or create. This subsystem should know how to send an expclicit key-repeat to the operating system.
  1. Linux guests lack keypress events compared to the native system, just like Windows guests do. Perhaps a linux kernel hacker can help you find out which subsystem should create the key-repeat events, and how the operating system notices them. I'm assuming here that this I/O operation is standardized enough to work with Windows guests too.

Hope this helps! Feel free to ask more.

Carlo

comment:17 by MrX1980, 15 years ago

Please try it with v3.0.0 again.

comment:18 by Frank Mehnert, 15 years ago

Resolution: fixed
Status: reopenedclosed

No response, closing.

comment:19 by Carlo Capocasa, 15 years ago

Resolution: fixed
Status: closedreopened

Missed your reply, will check shortly

comment:20 by Frank Mehnert, 14 years ago

Resolution: fixed
Status: reopenedclosed

No response, closing.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use