VirtualBox

Changeset 78672 in vbox for trunk/src


Ignore:
Timestamp:
May 22, 2019 5:32:20 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6143. Handling the CapsLock correctly

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 edited

Legend:

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

    r78669 r78672  
    4646enum UIKeyType
    4747{
    48     UIKeyType_SingleState,
    49     UIKeyType_DualState,
    50     UIKeyType_TriState,
     48    UIKeyType_Ordinary,
     49    /** e.g. CapsLock. Can be only in UIKeyState_NotPressed, UIKeyState_Locked, */
     50    UIKeyType_Toggleable,
     51    /** e.g. Shift Can be in all 3 states*/
     52    UIKeyType_Modifier,
    5153    UIKeyType_Max
    5254};
     
    248250    key.m_scanCodePrefix = 0;
    249251    key.m_iSpaceAfter = 0;
    250     key.m_enmType = UIKeyType_SingleState;
     252    key.m_enmType = UIKeyType_Ordinary;
    251253
    252254    while (m_xmlReader.readNextStartElement())
     
    280282        {
    281283            QString strType = m_xmlReader.readElementText();
    282             if (strType == "tristate")
    283                 key.m_enmType = UIKeyType_TriState;
    284             else if (strType == "dualstate")
    285                 key.m_enmType = UIKeyType_DualState;
     284            if (strType == "modifier")
     285                key.m_enmType = UIKeyType_Modifier;
     286            else if (strType == "toggleable")
     287                key.m_enmType = UIKeyType_Toggleable;
    286288        }
    287289        else
     
    301303    , m_scanCode(0)
    302304    , m_scanCodePrefix(0)
    303     , m_enmType(UIKeyType_SingleState)
     305    , m_enmType(UIKeyType_Ordinary)
    304306    , m_enmState(UIKeyState_NotPressed)
    305307    , m_fScaleMultiplier(1.f)
     
    401403    QToolButton::paintEvent(pEvent);
    402404
    403     if (m_enmType == UIKeyType_SingleState)
    404         return;
    405 
     405    if (m_enmType == UIKeyType_Ordinary)
     406        return;
    406407
    407408    QPainter painter(this);
     
    427428void UISoftKeyboardKey::updateState(bool fPressed)
    428429{
    429     if (m_enmType == UIKeyType_SingleState)
    430         return;
    431     if (m_enmType == UIKeyType_TriState)
     430    if (m_enmType == UIKeyType_Ordinary)
     431        return;
     432    if (m_enmType == UIKeyType_Modifier)
    432433    {
    433434        if (fPressed)
     
    446447        }
    447448    }
    448     else if (m_enmType == UIKeyType_DualState)
     449    else if (m_enmType == UIKeyType_Toggleable)
    449450    {
    450451        if (fPressed)
     
    566567    if (!pKey)
    567568        return;
    568     if (pKey->type() != UIKeyType_SingleState)
     569    if (pKey->type() == UIKeyType_Modifier)
    569570        return;
    570571
     
    591592    if (!pKey)
    592593        return;
    593 
    594     if (pKey->type() != UIKeyType_SingleState)
     594    /* We only send the scan codes of Ordinary keys: */
     595    if (pKey->type() == UIKeyType_Modifier)
    595596        return;
    596597
     
    604605    {
    605606        UISoftKeyboardKey *pModifier = m_pressedModifiers[i];
    606         if (pModifier->type() == UIKeyType_DualState)
    607             continue;
    608607        if (pModifier->scanCodePrefix() != 0)
    609608            sequence << pModifier->scanCodePrefix();
     
    620619    if (!pKey)
    621620        return;
    622     if (pKey->type() == UIKeyType_SingleState)
     621    if (pKey->type() != UIKeyType_Modifier)
    623622        return;
    624623    if (pKey->state() == UIKeyState_NotPressed)
  • trunk/src/VBox/Frontends/VirtualBox/xml/us_layout.xml

    r78664 r78672  
    290290            <width>70</width>
    291291            <label>CapsLock</label>
    292             <type>dualstate</type>
     292            <type>toggleable</type>
    293293            <position>30</position>
    294294            <scancode>0x3a</scancode>
     
    374374            <width>115</width>
    375375            <label>Shift</label>
    376             <type>tristate</type>
     376            <type>modifier</type>
    377377            <position>44</position>
    378378            <scancode>0x2a</scancode>
     
    444444            <width>115</width>
    445445            <label>Shift</label>
    446             <type>tristate</type>
     446            <type>modifier</type>
    447447            <position>57</position>
    448448            <scancode>0x36</scancode>
     
    455455            <width>90</width>
    456456            <label>Ctrl</label>
    457             <type>tristate</type>
     457            <type>modifier</type>
    458458            <position>58</position>
    459459            <scancode>0x1d</scancode>
     
    462462            <width>50</width>
    463463            <label>Win</label>
    464             <type>tristate</type>
     464            <type>modifier</type>
    465465            <scancodeprefix>0xe0</scancodeprefix>
    466466            <scancode>0x5b</scancode>
     
    470470            <position>60</position>
    471471            <label>Alt</label>
    472             <type>tristate</type>
     472            <type>modifier</type>
    473473            <scancode>0x38</scancode>
    474474        </key>
     
    481481            <width>70</width>
    482482            <label>AltGr</label>
    483             <type>tristate</type>
     483            <type>modifier</type>
    484484            <scancodeprefix>0xe0</scancodeprefix>
    485485            <scancode>0x38</scancode>
     
    488488            <width>50</width>
    489489            <label>Win</label>
    490             <type>tristate</type>
     490            <type>modifier</type>
    491491            <scancodeprefix>0xe0</scancodeprefix>
    492492            <scancode>0x5c</scancode>
     
    501501            <width>90</width>
    502502            <label>Ctrl</label>
    503             <type>tristate</type>
     503            <type>modifier</type>
    504504            <scancodeprefix>0xe0</scancodeprefix>
    505505            <scancode>0x1d</scancode>
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