VirtualBox

Changeset 35864 in vbox


Ignore:
Timestamp:
Feb 7, 2011 11:35:09 AM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: 5245: GUI support for complex host-key combinations: Do NOT send the last key oh host-combination to the guest.

File:
1 edited

Legend:

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

    r35744 r35864  
    11121112
    11131113    /* Update the map of pressed host-combo keys: */
    1114     if (fFlags & KeyPressed)
    1115     {
    1116         if (allHostComboKeys.contains(iKey))
     1114    if (allHostComboKeys.contains(iKey))
     1115    {
     1116        if (fFlags & KeyPressed)
    11171117        {
    11181118            if (!m_pressedHostComboKeys.contains(iKey))
     
    11211121                return true;
    11221122        }
    1123     }
    1124     else
    1125     {
    1126         if (allHostComboKeys.contains(iKey) && m_pressedHostComboKeys.contains(iKey))
    1127             m_pressedHostComboKeys.remove(iKey);
     1123        else
     1124        {
     1125            if (m_pressedHostComboKeys.contains(iKey))
     1126                m_pressedHostComboKeys.remove(iKey);
     1127        }
    11281128    }
    11291129    /* Check if we are currently holding FULL host-combo: */
     
    11611161    }
    11621162
    1163     /* Prepare empty code-buffer: */
     1163    /* Preparing the press/release scan-codes array for sending to the guest:
     1164     * 1. if host-combo is NOT pressed, taking into account currently pressed key too,
     1165     * 2. if currently released key releases host-combo too.
     1166     * Using that rule, we are NOT sending to the guest:
     1167     * 1. the last key-press of host-combo,
     1168     * 2. all keys pressed while the host-combo being held. */
    11641169    LONG aCodesBuffer[16];
    11651170    LONG *pCodes = aCodesBuffer;
    11661171    uint uCodesCount = 0;
    1167     /* Processing usual key-presses/releases without host-key being held: */
    1168     if (!m_bIsHostComboPressed || isHostComboStateChanged)
     1172    if (!m_bIsHostComboPressed && !isHostComboStateChanged ||
     1173        m_bIsHostComboPressed && isHostComboStateChanged)
    11691174    {
    11701175        /* Special flags handling (KeyPrint): */
     
    13411346    emit keyboardStateChanged(keyboardState());
    13421347
    1343     /* If the VM is NOT paused and there are scancodes to send: */
    1344     if (!uisession()->isPaused() && uCodesCount)
    1345     {
    1346         /* Get the  VM keyboard to pass key in there: */
     1348    /* If the VM is NOT paused: */
     1349    if (!uisession()->isPaused())
     1350    {
     1351        /* Get the VM keyboard: */
    13471352        CKeyboard keyboard = session().GetConsole().GetKeyboard();
    13481353        Assert(!keyboard.isNull());
    13491354
    1350         /* Pass this key to the guest: */
    1351         std::vector<LONG> scancodes(pCodes, &pCodes[uCodesCount]);
    1352         keyboard.PutScancodes(QVector<LONG>::fromStdVector(scancodes));
    1353 
    1354         /* If full host-key sequence was just finalized
    1355          * and the last key of host-combination was just sent to the guest =>
    1356          * we have to notify guest to make it release keys from the host-combination: */
     1355        /* If there are scan-codes to send: */
     1356        if (uCodesCount)
     1357        {
     1358            /* Send prepared scan-codes to the guest: */
     1359            std::vector<LONG> scancodes(pCodes, &pCodes[uCodesCount]);
     1360            keyboard.PutScancodes(QVector<LONG>::fromStdVector(scancodes));
     1361        }
     1362
     1363        /* If full host-key sequence was just finalized: */
    13571364        if (isHostComboStateChanged && m_bIsHostComboPressed)
    13581365        {
     1366            /* We have to make guest to release pressed keys from the host-combination: */
    13591367            QList<uint8_t> hostComboScans = m_pressedHostComboKeys.values();
    13601368            for (int i = 0 ; i < hostComboScans.size(); ++i)
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