VirtualBox

Changeset 52924 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 2, 2014 7:47:58 AM (10 years ago)
Author:
vboxsync
Message:

IKeyboard::KeyboardLEDs getter

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r52921 r52924  
    1492314923  -->
    1492414924
     14925  <enum
     14926    name="KeyboardLED"
     14927    uuid="ef29ea38-409b-49c7-a817-c858d426dfba"
     14928    >
     14929    <desc>
     14930      Keyboard LED indicators.
     14931    </desc>
     14932
     14933    <const name="NumLock" value="0x01"/>
     14934    <const name="CapsLock" value="0x02"/>
     14935    <const name="ScrollLock" value="0x04"/>
     14936  </enum>
     14937
    1492514938  <interface
    1492614939    name="IKeyboard" extends="$unknown"
    14927     uuid="71aa2898-28bd-43fe-8c98-e53321451db7"
     14940    uuid="585cc5e8-349c-41c6-899d-d9a38e3f4126"
    1492814941    wsmap="managed"
    1492914942    >
     
    1493514948      to the virtual machine.
    1493614949    </desc>
     14950
     14951    <attribute name="keyboardLEDs" type="KeyboardLED" safearray="yes" readonly="yes">
     14952      <desc>
     14953        Current status of the guest keyboard LEDs.
     14954      </desc>
     14955    </attribute>
    1493714956
    1493814957    <method name="putScancode">
  • trunk/src/VBox/Main/include/KeyboardImpl.h

    r52858 r52924  
    6666    // Wrapped Keyboard properties
    6767    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
     68    HRESULT getKeyboardLEDs(std::vector<KeyboardLED_T> &aKeyboardLEDs);
     69
     70    // Wrapped Keyboard members
    6871    HRESULT putScancode(LONG aScancode);
    6972    HRESULT putScancodes(const std::vector<LONG> &aScancodes,
    7073                         ULONG *aCodesStored);
    71 
    72     // Wrapped Keyboard members
    7374    HRESULT putCAD();
    7475    HRESULT releaseKeys();
     
    8081    static DECLCALLBACK(void)   i_drvDestruct(PPDMDRVINS pDrvIns);
    8182
     83    void onKeyboardLedsChange(PDMKEYBLEDS enmLeds);
     84
    8285    Console * const         mParent;
    8386    /** Pointer to the associated keyboard driver(s). */
     
    8891    bool                    mfVMMDevInited;
    8992
     93    /* The current guest keyboard LED status. */
     94    PDMKEYBLEDS menmLeds;
     95
    9096    const ComObjPtr<EventSource> mEventSource;
    9197};
  • 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.

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