VirtualBox

Ignore:
Timestamp:
May 2, 2013 12:52:59 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: hopefully support AltGr correctly in the host combination editor on Windows hosts, clean-up.

File:
1 edited

Legend:

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

    r45873 r45876  
    386386/**
    387387 * @brief isSyntheticLCtrl
    388  * @param   pMsg  Windows event message structure
     388 * @param   pMsg  Windows WM_[SYS]KEY* event message structure
    389389 * @return  true if this is a synthetic LCtrl event, false otherwise
    390390 * This function is a heuristic to tell whether a key event is the first in
     
    405405    unsigned i;
    406406
    407     if ((pMsg->lParam & 0x01FF0000) >> 16 != 0x1d /* LCtrl */)
     407    Assert(   pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN
     408           || pMsg->message == WM_KEYUP || pMsg->message == WM_SYSKEYUP);
     409    if (   ((HIWORD(pMsg->lParam) & 0xFF) != 0x1d /* scan code: Control */)
     410        || HIWORD(pMsg->lParam) & KF_EXTENDED)
    408411        return false;
    409412    if (!PeekMessage(&peekMsg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE))
     
    415418        && (peekMsg.message != WM_KEYUP && peekMsg.message != WM_SYSKEYUP))
    416419        return false;
    417     if ((peekMsg.lParam & 0x01FF0000) >> 16 != 0x138 /* RAlt */)
    418         return false;
     420    if (   ((HIWORD(peekMsg.lParam) & 0xFF) != 0x38 /* scan code: Alt */)
     421        || !(HIWORD(peekMsg.lParam) & KF_EXTENDED))
     422        return false;
     423    LogRel(("The current event is a left control key event (time: %d).  There is a pending right alt key event (time: %d).\n",
     424            (int) pMsg->time, (int) peekMsg.time));
     425    /* If we got this far then we have a key event which could potentially
     426     * be a synthetic left control.  Now we check to see whether the current
     427     * keyboard layout actually has an AltGr key by checking whether any of
     428     * the keys which might do produce a symbol when AltGr (Control + Alt) is
     429     * depressed.  Generally this loop will exit pretty early (it exits on the
     430     * first iteration for my German layout).  If there is no AltGr key in the
     431     * layout then it will run right through, but that should not happen very
     432     * often as we should hardly ever reach the loop in that case.
     433     *
     434     * In theory we could do this once and cache the result, but that involves
     435     * tracking layout switches to invalidate the cache, and I don't think
     436     * that the added complexity is worth the price.
     437     */
    419438    for (i = '0'; i <= VK_OEM_102; ++i)
    420439    {
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