VirtualBox

Ticket #1296 (closed defect: fixed)

Opened 15 years ago

Last modified 13 years ago

Key Repeat breaks application event handlers -> fixed in SVN

Reported by: ccapocasa 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

vboxbug-reproduce.html Download (841 bytes) - added by ccapocasa 15 years ago.
Reproduction Code

Change History

Changed 15 years ago by ccapocasa

Reproduction Code

comment:1 Changed 15 years ago by achalella

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

comment:2 Changed 15 years ago by michael

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 Changed 15 years ago by achalella

In my case it is a Linux host.

comment:4 Changed 15 years ago by michael

  • Status changed from new to closed
  • Resolution set to fixed

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 Changed 15 years ago by michael

Actually, this was a duplicate of #915.

comment:6 Changed 15 years ago by michael

  • Summary changed from Key Repeat breaks application event handlers to Key Repeat breaks application event handlers => fixed in svn

comment:7 Changed 15 years ago by carlotheman

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 Changed 14 years ago by carlotheman

  • Status changed from closed to reopened
  • Resolution fixed deleted

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 Changed 14 years ago by michael

  • Summary changed from Key Repeat breaks application event handlers => fixed in svn to Key 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 Changed 14 years ago by carlotheman

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 Changed 14 years ago by michael

  • Version changed from VirtualBox 1.5.6 to VirtualBox 2.1.2
  • Summary changed from Key Repeat breaks application event handlers to Key Repeat breaks application event handlers -> fixed in SVN

I hope it is really fixed this time.

comment:12 Changed 14 years ago by carlotheman

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 Changed 14 years ago by frank

  • Status changed from reopened to closed
  • Resolution set to fixed

Fix contained in 2.1.4.

comment:14 Changed 14 years ago by carlotheman

  • Status changed from closed to reopened
  • Resolution fixed deleted

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 Changed 14 years ago by michael

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 Changed 14 years ago by carlotheman

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 Changed 14 years ago by MrX1980

Please try it with v3.0.0 again.

comment:18 Changed 14 years ago by frank

  • Status changed from reopened to closed
  • Resolution set to fixed

No response, closing.

comment:19 Changed 14 years ago by ccapocasa

  • Status changed from closed to reopened
  • Resolution fixed deleted

Missed your reply, will check shortly

comment:20 Changed 13 years ago by frank

  • Status changed from reopened to closed
  • Resolution set to fixed

No response, closing.

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use