diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2014-10-02 07:47:58 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2014-10-02 07:47:58 +0000 |
commit | c37e16633e603d8b5f077bf2af18e41f0e96236a (patch) | |
tree | 6d464b66de9b3a2e90f426fc34a88a33b33e4da4 /src/VBox/Main/src-client/KeyboardImpl.cpp | |
parent | f8630cf85de6c82cf0287725071b2861112ae6c5 (diff) | |
download | VirtualBox-svn-c37e16633e603d8b5f077bf2af18e41f0e96236a.tar.gz |
IKeyboard::KeyboardLEDs getter
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@52924 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Main/src-client/KeyboardImpl.cpp')
-rw-r--r-- | src/VBox/Main/src-client/KeyboardImpl.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/VBox/Main/src-client/KeyboardImpl.cpp b/src/VBox/Main/src-client/KeyboardImpl.cpp index 996f481d4ea..e75cf7d6817 100644 --- a/src/VBox/Main/src-client/KeyboardImpl.cpp +++ b/src/VBox/Main/src-client/KeyboardImpl.cpp @@ -78,6 +78,7 @@ HRESULT Keyboard::FinalConstruct() RT_ZERO(mpDrv); mpVMMDev = NULL; mfVMMDevInited = false; + menmLeds = PDMKEYBLEDS_NONE; return BaseFinalConstruct(); } @@ -141,6 +142,8 @@ void Keyboard::uninit() mpVMMDev = NULL; mfVMMDevInited = true; + menmLeds = PDMKEYBLEDS_NONE; + unconst(mParent) = NULL; unconst(mEventSource).setNull(); } @@ -260,6 +263,18 @@ HRESULT Keyboard::releaseKeys() return putScancodes(scancodes, NULL); } +HRESULT Keyboard::getKeyboardLEDs(std::vector<KeyboardLED_T> &aKeyboardLEDs) +{ + AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); + + aKeyboardLEDs.resize(0); + + if (menmLeds & PDMKEYBLEDS_NUMLOCK) aKeyboardLEDs.push_back(KeyboardLED_NumLock); + if (menmLeds & PDMKEYBLEDS_CAPSLOCK) aKeyboardLEDs.push_back(KeyboardLED_CapsLock); + if (menmLeds & PDMKEYBLEDS_SCROLLLOCK) aKeyboardLEDs.push_back(KeyboardLED_ScrollLock); + + return S_OK; +} HRESULT Keyboard::getEventSource(ComPtr<IEventSource> &aEventSource) { @@ -272,12 +287,24 @@ HRESULT Keyboard::getEventSource(ComPtr<IEventSource> &aEventSource) // // private methods // +void Keyboard::onKeyboardLedsChange(PDMKEYBLEDS enmLeds) +{ + AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); + + /* Save the current status. */ + menmLeds = enmLeds; + + alock.release(); + + i_getParent()->i_onKeyboardLedsChange(RT_BOOL(enmLeds & PDMKEYBLEDS_NUMLOCK), + RT_BOOL(enmLeds & PDMKEYBLEDS_CAPSLOCK), + RT_BOOL(enmLeds & PDMKEYBLEDS_SCROLLLOCK)); +} + DECLCALLBACK(void) Keyboard::i_keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds) { PDRVMAINKEYBOARD pDrv = RT_FROM_MEMBER(pInterface, DRVMAINKEYBOARD, IConnector); - pDrv->pKeyboard->i_getParent()->i_onKeyboardLedsChange(RT_BOOL(enmLeds & PDMKEYBLEDS_NUMLOCK), - RT_BOOL(enmLeds & PDMKEYBLEDS_CAPSLOCK), - RT_BOOL(enmLeds & PDMKEYBLEDS_SCROLLLOCK)); + pDrv->pKeyboard->onKeyboardLedsChange(enmLeds); } /** |