VirtualBox

Changeset 43854 in vbox


Ignore:
Timestamp:
Nov 9, 2012 7:44:50 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: attempt to fix sporadic stuck AltGr key on Windows host.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp

    r41689 r43854  
    940940        return false;
    941941
     942    /* It's possible that a key has been pressed while the keyboard was not
     943     * captured, but is being released under the capture. Detect this situation
     944     * and return false to let Windows process the message normally and update
     945     * its key state table (to avoid the stuck key effect). */
     946    /** @todo Is there any reason why we can't generally return "false" for
     947     * key releases, even if we do process them?  It would let us drop this
     948     * hard-to-read logic. */
     949    uint8_t what_pressed =      (event.flags & 0x01)
     950                             && (event.vkCode != VK_RSHIFT)
     951                           ? IsExtKeyPressed : IsKeyPressed;
     952    if (   (event.flags & 0x80) /* released */
     953        && (   (   UIHotKeyCombination::toKeyCodeList(m_globalSettings.hostCombo()).contains(event.vkCode)
     954                && !m_bIsHostkeyInCapture)
     955            ||    (  m_pressedKeys[event.scanCode]
     956                   & (IsKbdCaptured | what_pressed))
     957               == what_pressed))
     958        return false;
     959
    942960    /* Sometimes it happens that Win inserts additional events on some key
    943961     * press/release. For example, it prepends ALT_GR in German layout with
     
    964982     *        and not in the keyboard capture handler. */
    965983    if (!m_fIsKeyboardCaptured)
    966         return false;
    967 
    968     /* It's possible that a key has been pressed while the keyboard was not
    969      * captured, but is being released under the capture. Detect this situation
    970      * and return false to let Windows process the message normally and update
    971      * its key state table (to avoid the stuck key effect). */
    972     uint8_t what_pressed = (event.flags & 0x01) && (event.vkCode != VK_RSHIFT) ? IsExtKeyPressed : IsKeyPressed;
    973     if ((event.flags & 0x80) /* released */ &&
    974         ((UIHotKeyCombination::toKeyCodeList(m_globalSettings.hostCombo()).contains(event.vkCode) && !m_bIsHostkeyInCapture) ||
    975          (m_pressedKeys[event.scanCode] & (IsKbdCaptured | what_pressed)) == what_pressed))
    976984        return false;
    977985
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette