VirtualBox

Changeset 37365 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jun 7, 2011 8:31:18 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72135
Message:

FE/Qt: only grab the keyboard focus when a non-modifier key (or the host combination) is pressed, remove dead code

File:
1 edited

Legend:

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

    r37364 r37365  
    483483         * and this hack is probably not necessary anymore. So disable it for Qt >= 4.5.0. */
    484484        case XFocusOut:
    485         case XFocusIn:
    486485        {
    487486            if (isSessionRunning())
     
    489488                if (VBoxGlobal::qtRTVersion() < ((4 << 16) | (5 << 8) | 0))
    490489                {
    491                     if (pEvent->type == XFocusIn)
    492                     {
    493 #if 0
    494                         /* Capture keyboard by chosen view number: */
    495                         captureKeyboard(uScreenId);
    496                         /* Reset the single-time disable capture flag: */
    497                         if (isAutoCaptureDisabled())
    498                             setAutoCaptureDisabled(false);
    499 #endif
    500                     }
    501                     else
    502                     {
    503                         /* Release keyboard: */
    504                         releaseKeyboard();
    505                         /* And all pressed keys including host-one: */
    506                         releaseAllPressedKeys(true);
    507                     }
     490                    /* Release keyboard: */
     491                    releaseKeyboard();
     492                    /* And all pressed keys including host-one: */
     493                    releaseAllPressedKeys(true);
    508494                }
    509495            }
     
    604590            break;
    605591        }
    606 #if 0
    607         case KMachineState_Running:
    608         {
    609             /* Capture the keyboard by the first focused view: */
    610             QList<ulong> theListOfViewIds = m_views.keys();
    611             for (int i = 0; i < theListOfViewIds.size(); ++i)
    612             {
    613                 if (viewHasFocus(theListOfViewIds[i]))
    614                 {
    615                     /* Capture keyboard: */
    616 #ifdef Q_WS_WIN
    617                     if (!isAutoCaptureDisabled() && autoCaptureSetGlobally() &&
    618                         GetAncestor(m_views[theListOfViewIds[i]]->winId(), GA_ROOT) == GetForegroundWindow())
    619 #else /* Q_WS_WIN */
    620                     if (!isAutoCaptureDisabled() && autoCaptureSetGlobally())
    621 #endif /* !Q_WS_WIN */
    622                         captureKeyboard(theListOfViewIds[i]);
    623                     /* Reset the single-time disable capture flag: */
    624                     if (isAutoCaptureDisabled())
    625                         setAutoCaptureDisabled(false);
    626                     break;
    627                 }
    628             }
    629             break;
    630         }
    631 #endif
    632592        default:
    633593            break;
     
    830790        switch (pEvent->type())
    831791        {
    832 #if 0
    833             case QEvent::FocusIn:
    834                 if (isSessionRunning())
    835                 {
    836                     /* Capture keyboard: */
    837 #ifdef Q_WS_WIN
    838                     if (!isAutoCaptureDisabled() && autoCaptureSetGlobally() &&
    839                         GetAncestor(pWatchedView->winId(), GA_ROOT) == GetForegroundWindow())
    840 #else /* Q_WS_WIN */
    841                     if (!isAutoCaptureDisabled() && autoCaptureSetGlobally())
    842 #endif /* !Q_WS_WIN */
    843                         captureKeyboard(uScreenId);
    844                     /* Reset the single-time disable capture flag: */
    845                     if (isAutoCaptureDisabled())
    846                         setAutoCaptureDisabled(false);
    847                 }
    848                 break;
    849 #endif
    850792            case QEvent::FocusOut:
    851793                /* Release keyboard: */
Note: See TracChangeset for help on using the changeset viewer.

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