VirtualBox

Changeset 6767 in vbox


Ignore:
Timestamp:
Feb 3, 2008 5:39:44 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt: 1) Release pressed keys even on focus loss in Paused state (for example when a warning about the ignored keyboard input is shown) to avoid stuck keys in the guest after resuming. 2) Show the keyboard input warning on key release (instead of key press) which is a kind of more expected by the user.

File:
1 edited

Legend:

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

    r6721 r6767  
    10351035                else
    10361036                {
    1037                     /* release the host key even when paused */
    1038                     mIsHostkeyPressed = false;
    1039                     emitKeyboardStateChanged();
     1037                    /* release the host key and all other pressed keys too even
     1038                     * when paused (otherwise, we will get stuck keys in the
     1039                     * guest when doing sendChangedKeyStates() on resume because
     1040                     * key presses were already recorded in mPressedKeys but key
     1041                     * releases will most likely not reach us but the new focus
     1042                     * window instead). */
     1043                    releaseAllPressedKeys (true /* aReleaseHostKey */);
    10401044                }
    10411045                break;
     
    12791283
    12801284            case QEvent::KeyPress:
     1285            case QEvent::KeyRelease:
     1286            {
     1287                QKeyEvent *ke = (QKeyEvent *) e;
     1288
    12811289#ifdef Q_WS_PM
    1282             case QEvent::KeyRelease:
    1283             {
    12841290                /// @todo temporary solution to send Alt+Tab and friends to
    12851291                //  the guest. The proper solution is to write a keyboard
     
    12871293                //  impossible to do so using hooks on OS/2).
    12881294
    1289                 QKeyEvent *ke = (QKeyEvent *) e;
    12901295                if (mIsHostkeyPressed)
    12911296                {
     
    13591364                    }
    13601365                }
    1361                 if (e->type() == QEvent::KeyRelease)
    1362                     break;
    1363 
    1364                 /* fall through for normal processing of KeyPress */
    1365 #else
    1366             {
    1367                 QKeyEvent *ke = (QKeyEvent *) e;
    1368 #endif
    1369                 if (mIsHostkeyPressed)
     1366
     1367                /* fall through to normal processing */
     1368
     1369#endif /* Q_WS_PM */
     1370
     1371                if (mIsHostkeyPressed && e->type() == QEvent::KeyPress)
    13701372                {
    13711373                    if (ke->key() >= Key_F1 && ke->key() <= Key_F12)
     
    14091411                    }
    14101412                }
    1411                 else
     1413                else if (!mIsHostkeyPressed && e->type() == QEvent::KeyRelease)
    14121414                {
     1415                    /* Show a possible warning on key release which seems to
     1416                     * be more expected by the end user */
     1417
    14131418                    if (isPaused())
    14141419                    {
     
    14201425                    }
    14211426                }
     1427
    14221428                ke->accept();
    14231429                return true;
     
    29572963
    29582964#ifdef Q_WS_MAC
    2959         ::DarwinUpdateDockPreview (DarwinQPixmapToCGImage (&mPausedShot), 
    2960                                    mVirtualBoxLogo, 
     2965        ::DarwinUpdateDockPreview (DarwinQPixmapToCGImage (&mPausedShot),
     2966                                   mVirtualBoxLogo,
    29612967                                   mMainWnd->dockImageState());
    29622968#endif
     
    31363142 * @param aReleaseHostKey @c true to set the host key state to unpressed.
    31373143 */
    3138 void VBoxConsoleView::releaseAllPressedKeys (bool aReleaseHostKey)
     3144void VBoxConsoleView::releaseAllPressedKeys (bool aReleaseHostKey /* = true*/)
    31393145{
    31403146    AssertMsg (mAttached, ("Console must be attached"));
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