Changeset 11659 in vbox
- Timestamp:
- Aug 26, 2008 12:32:46 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBFE/COMDefs.h
r11655 r11659 74 74 #endif /* !RT_OS_WINDOWS */ 75 75 76 #define ComSafeArrayIn(aType, aArg) unsigned aArg##Size, aType *aArg77 #define ComSafeArrayInIsNull(aArg) (aArg == NULL)78 #define ComSafeArrayInArg(aArg) aArg##Size, aArg79 #define ComSafeArrayAsInParam(aArray) \80 (aArray).size(), aArray.raw()81 82 83 namespace com84 {85 template<class T> class SafeArray {86 T t;87 public:88 SafeArray (size_t aSize) {}89 SafeArray (ComSafeArrayIn (T, aArg)) {}90 T &operator[] (size_t aIdx) { return t; }91 size_t size() const { return 0; }92 T *raw() { return &t; }93 };94 }95 76 #endif -
trunk/src/VBox/Frontends/VBoxBFE/KeyboardImpl.cpp
r11655 r11659 25 25 #else 26 26 # include <VBox/com/defs.h> 27 //# include <VBox/com/array.h>28 27 #endif 29 28 #include <VBox/pdm.h> … … 100 99 * 101 100 * @returns COM status code 102 * @param scancodes Safe array of scancodes 101 * @param scancodes Pointer to the first scancode 102 * @param count Number of scancodes 103 103 * @param codesStored Address of variable to store the number 104 104 * of scancodes that were sent to the keyboard. 105 105 This value can be NULL. 106 106 */ 107 STDMETHODIMP Keyboard::PutScancodes(ComSafeArrayIn (LONG, scancodes), 107 STDMETHODIMP Keyboard::PutScancodes(LONG *scancodes, 108 ULONG count, 108 109 ULONG *codesStored) 109 110 { 110 if ( ComSafeArrayInIsNull(scancodes))111 if (!scancodes) 111 112 return E_INVALIDARG; 112 113 if (!mpDrv) 113 114 return S_OK; 114 115 115 com::SafeArray <LONG> keys(ComSafeArrayInArg(scancodes));116 LONG *currentScancode = scancodes; 116 117 int rcVBox = VINF_SUCCESS; 117 118 118 for (uint32_t i = 0; (i < keys.size()) && VBOX_SUCCESS(rcVBox); i++)119 { 120 rcVBox = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)keys[i]);119 for (uint32_t i = 0; (i < count) && VBOX_SUCCESS(rcVBox); i++, currentScancode++) 120 { 121 rcVBox = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, *(uint8_t*)currentScancode); 121 122 } 122 123 … … 126 127 /// @todo is it actually possible that not all scancodes can be transmitted? 127 128 if (codesStored) 128 *codesStored = keys.size();129 *codesStored = count; 129 130 130 131 return S_OK; … … 140 141 STDMETHODIMP Keyboard::PutCAD() 141 142 { 142 static com::SafeArray<LONG> cadSequence(6);143 144 cadSequence[0] = 0x1d; // Ctrldown145 cadSequence[1] = 0x38; // Altdown146 cadSequence[2] = 0x53; // Del down147 cadSequence[3] = 0xd3; // Delup148 cadSequence[4] = 0xb8; // Altup149 cadSequence[5] = 0x9d; // Ctrl up150 151 return PutScancodes ( ComSafeArrayAsInParam(cadSequence), NULL);143 static LONG cadSequence[] = { 144 0x1d, // Ctrl down 145 0x38, // Alt down 146 0x53, // Del down 147 0xd3, // Del up 148 0xb8, // Alt up 149 0x9d // Ctrl up 150 }; 151 152 return PutScancodes (cadSequence, ELEMENTS (cadSequence), NULL); 152 153 } 153 154 -
trunk/src/VBox/Frontends/VBoxBFE/KeyboardImpl.h
r11655 r11659 48 48 49 49 STDMETHOD(PutScancode)(LONG scancode); 50 STDMETHOD(PutScancodes)(ComSafeArrayIn (LONG, scancodes), 50 STDMETHOD(PutScancodes)(LONG *scancodes, 51 ULONG count, 51 52 ULONG *codesStored); 52 53 STDMETHOD(PutCAD)(); -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r11655 r11659 4742 4742 case SDLK_F10: case SDLK_F11: case SDLK_F12: 4743 4743 { 4744 // /* send Ctrl-Alt-Fx to guest */ 4745 com::SafeArray<LONG> keys(6); 4746 4747 keys[0] = 0x1d; // Ctrl down 4748 keys[1] = 0x38; // Alt down 4749 keys[2] = Keyevent2Keycode(pEv); // Fx down 4750 keys[3] = keys[2] + 0x80; // Fx up 4751 keys[4] = 0xb8; // Alt up 4752 keys[5] = 0x9d; // Ctrl up 4753 4754 gKeyboard->PutScancodes(ComSafeArrayAsInParam(keys), NULL); 4744 /* send Ctrl-Alt-Fx to guest */ 4745 static LONG keySequence[] = { 4746 0x1d, // Ctrl down 4747 0x38, // Alt down 4748 0x00, // Fx down (placeholder) 4749 0x00, // Fx up (placeholder) 4750 0xb8, // Alt up 4751 0x9d // Ctrl up 4752 }; 4753 4754 /* put in the right Fx key */ 4755 keySequence[2] = Keyevent2Keycode(pEv); 4756 keySequence[3] = keySequence[2] + 0x80; 4757 4758 gKeyboard->PutScancodes(keySequence, ELEMENTS(keySequence), NULL); 4755 4759 return VINF_SUCCESS; 4756 4760 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r11655 r11659 1388 1388 if (ke->key() >= Key_F1 && ke->key() <= Key_F12) 1389 1389 { 1390 QValueVector <LONG> combo (6);1390 LONG combo [6]; 1391 1391 combo [0] = 0x1d; /* Ctrl down */ 1392 1392 combo [1] = 0x38; /* Alt down */ … … 1408 1408 1409 1409 CKeyboard keyboard = mConsole.GetKeyboard(); 1410 keyboard.PutScancodes (combo );1410 keyboard.PutScancodes (combo, 6); 1411 1411 } 1412 1412 else if (ke->key() == Key_Home) … … 2615 2615 #endif 2616 2616 2617 std::vector <LONG> tmp(codes, &codes[count]); 2618 QValueVector <LONG> scancodes (tmp); 2619 keyboard.PutScancodes (scancodes); 2617 keyboard.PutScancodes (codes, count); 2620 2618 2621 2619 /* grab the key from Qt */ … … 3187 3185 fSentRESEND = true; 3188 3186 } 3189 QValueVector <LONG> codes (2);3187 LONG codes [2]; 3190 3188 codes[0] = 0xE0; 3191 3189 codes[1] = i | 0x80; 3192 keyboard.PutScancodes (codes );3190 keyboard.PutScancodes (codes, 2); 3193 3191 } 3194 3192 mPressedKeys [i] = 0; … … 3217 3215 AssertMsg (mAttached, ("Console must be attached")); 3218 3216 3219 QValueVector <LONG> codes (2);3217 LONG codes [2]; 3220 3218 CKeyboard keyboard = mConsole.GetKeyboard(); 3221 3219 for (uint i = 0; i < SIZEOF_ARRAY (mPressedKeys); ++ i) … … 3236 3234 if (!(ns & IsExtKeyPressed)) 3237 3235 codes [1] |= 0x80; 3238 keyboard.PutScancodes (codes );3236 keyboard.PutScancodes (codes, 2); 3239 3237 } 3240 3238 } -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleView.cpp
r11655 r11659 1426 1426 if (ke->key() >= Qt::Key_F1 && ke->key() <= Qt::Key_F12) 1427 1427 { 1428 QVector <LONG> combo (6);1428 LONG combo [6]; 1429 1429 combo [0] = 0x1d; /* Ctrl down */ 1430 1430 combo [1] = 0x38; /* Alt down */ … … 1446 1446 1447 1447 CKeyboard keyboard = mConsole.GetKeyboard(); 1448 keyboard.PutScancodes (combo );1448 keyboard.PutScancodes (combo, 6); 1449 1449 } 1450 1450 else if (ke->key() == Qt::Key_Home) … … 2657 2657 #endif 2658 2658 2659 std::vector <LONG> scancodes(codes, &codes[count]); 2660 keyboard.PutScancodes (QVector<LONG>::fromStdVector(scancodes)); 2659 keyboard.PutScancodes (codes, count); 2661 2660 2662 2661 /* grab the key from Qt */ … … 3227 3226 fSentRESEND = true; 3228 3227 } 3229 QVector <LONG> codes (2);3228 LONG codes [2]; 3230 3229 codes[0] = 0xE0; 3231 3230 codes[1] = i | 0x80; 3232 keyboard.PutScancodes (codes );3231 keyboard.PutScancodes (codes, 2); 3233 3232 } 3234 3233 mPressedKeys [i] = 0; … … 3257 3256 AssertMsg (mAttached, ("Console must be attached")); 3258 3257 3259 QVector <LONG> codes (2);3258 LONG codes [2]; 3260 3259 CKeyboard keyboard = mConsole.GetKeyboard(); 3261 3260 for (uint i = 0; i < SIZEOF_ARRAY (mPressedKeys); ++ i) … … 3276 3275 if (!(ns & IsExtKeyPressed)) 3277 3276 codes [1] |= 0x80; 3278 keyboard.PutScancodes (codes );3277 keyboard.PutScancodes (codes, 2); 3279 3278 } 3280 3279 } -
trunk/src/VBox/Main/KeyboardImpl.cpp
r11655 r11659 25 25 #include "Logging.h" 26 26 27 #include <VBox/com/array.h>28 27 #include <VBox/pdmdrv.h> 29 28 #include <iprt/asm.h> … … 149 148 This value can be NULL. 150 149 */ 151 STDMETHODIMP Keyboard::PutScancodes(ComSafeArrayIn (LONG, scancodes), 150 STDMETHODIMP Keyboard::PutScancodes(LONG *scancodes, 151 ULONG count, 152 152 ULONG *codesStored) 153 153 { 154 if ( ComSafeArrayInIsNull(scancodes))154 if (!scancodes) 155 155 return E_INVALIDARG; 156 156 … … 160 160 CHECK_CONSOLE_DRV (mpDrv); 161 161 162 com::SafeArray <LONG> keys(ComSafeArrayInArg(scancodes));162 LONG *currentScancode = scancodes; 163 163 int rcVBox = VINF_SUCCESS; 164 164 165 for (uint32_t i = 0; (i < keys.size()) && VBOX_SUCCESS(rcVBox); i++)166 { 167 rcVBox = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)keys[i]);165 for (uint32_t i = 0; (i < count) && VBOX_SUCCESS(rcVBox); i++, currentScancode++) 166 { 167 rcVBox = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, *(uint8_t*)currentScancode); 168 168 } 169 169 … … 174 174 /// @todo is it actually possible that not all scancodes can be transmitted? 175 175 if (codesStored) 176 *codesStored = keys.size();176 *codesStored = count; 177 177 178 178 return S_OK; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r11655 r11659 7707 7707 <interface 7708 7708 name="IKeyboard" extends="$unknown" 7709 uuid=" 2d1a531b-4c6e-49cc-8af6-5c857b78b5d7"7709 uuid="FD443EC1-000A-4F5B-9282-D72760A66916" 7710 7710 wsmap="managed" 7711 7711 > … … 7724 7724 <method name="putScancodes"> 7725 7725 <desc>Sends an array of scancode to the keyboard.</desc> 7726 <param name="scancodes" type="long" dir="in" safearray="yes"/> 7726 <param name="scancodes" type="long" dir="in" array="count"/> 7727 <param name="count" type="unsigned long" dir="in"/> 7727 7728 <param name="codesStored" type="unsigned long" dir="return"/> 7728 7729 </method> -
trunk/src/VBox/Main/include/KeyboardImpl.h
r11655 r11659 72 72 73 73 STDMETHOD(PutScancode)(LONG scancode); 74 STDMETHOD(PutScancodes)(ComSafeArrayIn (LONG, scancodes), 74 STDMETHOD(PutScancodes)(LONG *scancodes, 75 ULONG count, 75 76 ULONG *codesStored); 76 77 STDMETHOD(PutCAD)();
Note:
See TracChangeset
for help on using the changeset viewer.