儲存庫 vbox 的更動 34288
- 時間撮記:
- 2010-11-23 下午04:02:26 (14 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/KeyboardImpl.cpp
r34012 r34288 156 156 STDMETHODIMP Keyboard::PutScancode(LONG scancode) 157 157 { 158 HRESULT rc = S_OK;159 160 AutoCaller autoCaller(this);161 if (FAILED(autoCaller.rc())) return autoCaller.rc();162 163 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);164 165 CHECK_CONSOLE_DRV(mpDrv[0]);166 167 PPDMIKEYBOARDPORT pUpPort = NULL;168 for (int i = KEYBOARD_MAX_DEVICES - 1; i >= 0 ; --i)169 {170 if (mpDrv[i] && (mpDrv[i]->u32DevCaps & KEYBOARD_DEVCAP_ENABLED))171 {172 pUpPort = mpDrv[i]->pUpPort;173 break;174 }175 }176 /* No enabled keyboard - throw the input away. */177 if (!pUpPort)178 return rc;179 180 int vrc = pUpPort->pfnPutEvent(pUpPort, (uint8_t)scancode);181 182 if (RT_FAILURE(vrc))183 rc = setError(VBOX_E_IPRT_ERROR,184 tr("Could not send scan code 0x%08X to the virtual keyboard (%Rrc)"),185 scancode, vrc);186 187 VBoxEventDesc evDesc;188 158 com::SafeArray<LONG> scancodes(1); 189 159 scancodes[0] = scancode; 190 evDesc.init(mEventSource, VBoxEventType_OnGuestKeyboardEvent, ComSafeArrayAsInParam(scancodes)); 191 evDesc.fire(0); 192 return rc; 160 return PutScancodes(ComSafeArrayAsInParam(scancodes), NULL); 193 161 } 194 162 … … 206 174 ULONG *codesStored) 207 175 { 208 HRESULT rc = S_OK;209 210 176 if (ComSafeArrayInIsNull(scancodes)) 211 177 return E_INVALIDARG; … … 213 179 AutoCaller autoCaller(this); 214 180 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 181 182 com::SafeArray<LONG> keys(ComSafeArrayInArg(scancodes)); 215 183 216 184 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 232 200 /* No enabled keyboard - throw the input away. */ 233 201 if (!pUpPort) 234 return rc; 235 236 com::SafeArray<LONG> keys(ComSafeArrayInArg(scancodes)); 202 { 203 if (codesStored) 204 *codesStored = (uint32_t)keys.size(); 205 return S_OK; 206 } 207 237 208 int vrc = VINF_SUCCESS; 238 209 239 for (uint32_t i = 0; (i < keys.size()) && RT_SUCCESS(vrc); i++) 240 vrc = pUpPort->pfnPutEvent(pUpPort, (uint8_t)keys[i]); 210 uint32_t sent; 211 for (sent = 0; (sent < keys.size()) && RT_SUCCESS(vrc); sent++) 212 vrc = pUpPort->pfnPutEvent(pUpPort, (uint8_t)keys[sent]); 213 214 if (codesStored) 215 *codesStored = sent; 216 217 /* Only signal the keys in the event which have been actually sent. */ 218 keys.resize(sent); 219 VBoxEventDesc evDesc; 220 evDesc.init(mEventSource, VBoxEventType_OnGuestKeyboardEvent, ComSafeArrayAsInParam(keys)); 221 evDesc.fire(0); 241 222 242 223 if (RT_FAILURE(vrc)) … … 245 226 vrc); 246 227 247 /// @todo is it actually possible that not all scancodes can be transmitted? 248 if (codesStored) 249 *codesStored = (uint32_t)keys.size(); 250 251 VBoxEventDesc evDesc; 252 evDesc.init(mEventSource, VBoxEventType_OnGuestKeyboardEvent, ComSafeArrayAsInParam(keys)); 253 evDesc.fire(0); 254 255 return rc; 228 return S_OK; 256 229 } 257 230
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器