VirtualBox

Ignore:
Timestamp:
Oct 2, 2014 7:47:58 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
96359
Message:

IKeyboard::KeyboardLEDs getter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/KeyboardImpl.cpp

    r52400 r52924  
    7979    mpVMMDev = NULL;
    8080    mfVMMDevInited = false;
     81    menmLeds = PDMKEYBLEDS_NONE;
    8182    return BaseFinalConstruct();
    8283}
     
    141142    mpVMMDev = NULL;
    142143    mfVMMDevInited = true;
     144
     145    menmLeds = PDMKEYBLEDS_NONE;
    143146
    144147    unconst(mParent) = NULL;
     
    261264}
    262265
     266HRESULT Keyboard::getKeyboardLEDs(std::vector<KeyboardLED_T> &aKeyboardLEDs)
     267{
     268    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     269
     270    aKeyboardLEDs.resize(0);
     271
     272    if (menmLeds & PDMKEYBLEDS_NUMLOCK)    aKeyboardLEDs.push_back(KeyboardLED_NumLock);
     273    if (menmLeds & PDMKEYBLEDS_CAPSLOCK)   aKeyboardLEDs.push_back(KeyboardLED_CapsLock);
     274    if (menmLeds & PDMKEYBLEDS_SCROLLLOCK) aKeyboardLEDs.push_back(KeyboardLED_ScrollLock);
     275
     276    return S_OK;
     277}
    263278
    264279HRESULT Keyboard::getEventSource(ComPtr<IEventSource> &aEventSource)
     
    273288// private methods
    274289//
     290void Keyboard::onKeyboardLedsChange(PDMKEYBLEDS enmLeds)
     291{
     292    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     293
     294    /* Save the current status. */
     295    menmLeds = enmLeds;
     296
     297    alock.release();
     298
     299    i_getParent()->i_onKeyboardLedsChange(RT_BOOL(enmLeds & PDMKEYBLEDS_NUMLOCK),
     300                                          RT_BOOL(enmLeds & PDMKEYBLEDS_CAPSLOCK),
     301                                          RT_BOOL(enmLeds & PDMKEYBLEDS_SCROLLLOCK));
     302}
     303
    275304DECLCALLBACK(void) Keyboard::i_keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds)
    276305{
    277306    PDRVMAINKEYBOARD pDrv = RT_FROM_MEMBER(pInterface, DRVMAINKEYBOARD, IConnector);
    278     pDrv->pKeyboard->i_getParent()->i_onKeyboardLedsChange(RT_BOOL(enmLeds & PDMKEYBLEDS_NUMLOCK),
    279                                                            RT_BOOL(enmLeds & PDMKEYBLEDS_CAPSLOCK),
    280                                                            RT_BOOL(enmLeds & PDMKEYBLEDS_SCROLLLOCK));
     307    pDrv->pKeyboard->onKeyboardLedsChange(enmLeds);
    281308}
    282309
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