Changeset 886 in vbox
- Timestamp:
- Feb 13, 2007 5:51:42 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 18598
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r833 r886 306 306 AssertReturn (mAudioSniffer, E_FAIL); 307 307 308 memset (&mCallbackData, 0, sizeof (mCallbackData)); 309 308 310 /* Confirm a successful initialization when it's the case */ 309 311 autoInitSpan.setSucceeded(); … … 419 421 unconst (mMachine).setNull(); 420 422 421 / /Release all callbacks. Do this after uninitializing the components,422 //as some of them are well-behaved and unregister their callbacks.423 //These would trigger error messages complaining about trying to424 // unregister a non-registered callback.423 /* Release all callbacks. Do this after uninitializing the components, 424 * as some of them are well-behaved and unregister their callbacks. 425 * These would trigger error messages complaining about trying to 426 * unregister a non-registered callback. */ 425 427 mCallbacks.clear(); 428 429 /* dynamically allocated members of mCallbackData are uninitialized 430 * at the end of powerDown() */ 431 Assert (!mCallbackData.mpsc.valid && mCallbackData.mpsc.shape == NULL); 432 Assert (!mCallbackData.mcc.valid); 433 Assert (!mCallbackData.klc.valid); 426 434 427 435 LogFlowThisFuncLeave(); … … 2355 2363 mCallbacks.push_back (CallbackList::value_type (aCallback)); 2356 2364 2357 #if 0 2358 /* @todo dmik please implement this. 2359 * Inform the callback about the current status, because the new callback 2360 * must know at least the current mouse capabilities and the pointer shape. 2361 */ 2362 aCallback->OnMousePointerShapeChange (mCallbacksStatus.pointerShape.fVisible, 2363 mCallbackStatus.pointerShape.fAlpha, 2364 mCallbackStatus.pointerShape.xHot, 2365 mCallbackStatus.pointerShape.yHot, 2366 mCallbackStatus.pointerShape.width, 2367 mCallbackStatus.pointerShape.height, 2368 mCallbackStatus.pointerShape.pShape); 2369 aCallback->OnMouseCapabilityChange (mCallbackStatus.mouseCapability.supportsAbsolute, 2370 mCallbackStatus.mouseCapability.needsHostCursor); 2371 aCallback->OnStateChange (mCallbackStatus.machineState); 2365 /* Inform the callback about the current status (for example, the new 2366 * callback must know the current mouse capabilities and the pointer 2367 * shape in order to properly integrate the mouse pointer). */ 2368 2369 if (mCallbackData.mpsc.valid) 2370 aCallback->OnMousePointerShapeChange (mCallbackData.mpsc.visible, 2371 mCallbackData.mpsc.alpha, 2372 mCallbackData.mpsc.xHot, 2373 mCallbackData.mpsc.yHot, 2374 mCallbackData.mpsc.width, 2375 mCallbackData.mpsc.height, 2376 mCallbackData.mpsc.shape); 2377 if (mCallbackData.mcc.valid) 2378 aCallback->OnMouseCapabilityChange (mCallbackData.mcc.supportsAbsolute, 2379 mCallbackData.mcc.needsHostCursor); 2380 2381 aCallback->OnStateChange (mMachineState); 2372 2382 aCallback->OnAdditionsStateChange(); 2373 aCallback->OnKeyboardLedsChange(mCallbackStatus.keyboardLeds.fNumLock, 2374 mCallbackStatus.keyboardLeds.fCapsLock, 2375 mCallbackStatus.keyboardLeds.fScrollLock); 2376 #endif 2383 2384 if (mCallbackData.klc.valid) 2385 aCallback->OnKeyboardLedsChange (mCallbackData.klc.numLock, 2386 mCallbackData.klc.capsLock, 2387 mCallbackData.klc.scrollLock); 2377 2388 2378 2389 return S_OK; … … 3264 3275 3265 3276 /** 3266 * @note Locks this object for reading.3277 * @note Locks this object for writing. 3267 3278 */ 3268 3279 void Console::onMousePointerShapeChange(bool fVisible, bool fAlpha, … … 3275 3286 fVisible, fAlpha, xHot, yHot, width, height, pShape)); 3276 3287 3277 AutoReaderLock alock (this); 3288 AutoCaller autoCaller (this); 3289 AssertComRCReturnVoid (autoCaller.rc()); 3290 3291 /* We need a write lock because we alter the cached callback data */ 3292 AutoLock alock (this); 3293 3294 /* save the callback arguments */ 3295 mCallbackData.mpsc.visible = fVisible; 3296 mCallbackData.mpsc.alpha = fAlpha; 3297 mCallbackData.mpsc.xHot = xHot; 3298 mCallbackData.mpsc.yHot = yHot; 3299 mCallbackData.mpsc.width = width; 3300 mCallbackData.mpsc.height = height; 3301 3302 if (pShape != NULL) 3303 { 3304 size_t cb = (width + 7) / 8 * height; /* size of the AND mask */ 3305 cb += (cb + 3) & ~3 + width * 4 * height; /* + gap + size of the XOR mask */ 3306 mCallbackData.mpsc.shape = (BYTE *) RTMemAllocZ (cb); 3307 AssertReturnVoid (mCallbackData.mpsc.shape); 3308 memcpy (mCallbackData.mpsc.shape, pShape, cb); 3309 } 3310 else 3311 mCallbackData.mpsc.shape = NULL; 3312 3313 mCallbackData.mpsc.valid = true; 3278 3314 3279 3315 CallbackList::iterator it = mCallbacks.begin(); … … 3284 3320 3285 3321 /** 3286 * @note Locks this object for reading.3322 * @note Locks this object for writing. 3287 3323 */ 3288 3324 void Console::onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor) … … 3294 3330 AssertComRCReturnVoid (autoCaller.rc()); 3295 3331 3296 AutoReaderLock alock (this); 3297 3332 /* We need a write lock because we alter the cached callback data */ 3333 AutoLock alock (this); 3334 3335 /* save the callback arguments */ 3336 mCallbackData.mcc.supportsAbsolute = supportsAbsolute; 3337 mCallbackData.mcc.needsHostCursor = needsHostCursor; 3338 mCallbackData.mcc.valid = true; 3339 3298 3340 CallbackList::iterator it = mCallbacks.begin(); 3299 3341 while (it != mCallbacks.end()) … … 3352 3394 3353 3395 /** 3354 * @note Locks this object for reading.3396 * @note Locks this object for writing. 3355 3397 */ 3356 3398 void Console::onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock) … … 3359 3401 AssertComRCReturnVoid (autoCaller.rc()); 3360 3402 3361 AutoReaderLock alock (this); 3403 /* We need a write lock because we alter the cached callback data */ 3404 AutoLock alock (this); 3405 3406 /* save the callback arguments */ 3407 mCallbackData.klc.numLock = fNumLock; 3408 mCallbackData.klc.capsLock = fCapsLock; 3409 mCallbackData.klc.scrollLock = fScrollLock; 3410 mCallbackData.klc.valid = true; 3362 3411 3363 3412 CallbackList::iterator it = mCallbacks.begin(); … … 3657 3706 mVMDestroying = false; 3658 3707 3708 if (SUCCEEDED (rc)) 3709 { 3710 /* uninit dynamically allocated members of mCallbackData */ 3711 if (mCallbackData.mpsc.valid) 3712 { 3713 if (mCallbackData.mpsc.shape != NULL) 3714 RTMemFree (mCallbackData.mpsc.shape); 3715 } 3716 memset (&mCallbackData, 0, sizeof (mCallbackData)); 3717 } 3718 3659 3719 LogFlowThisFuncLeave(); 3660 3720 return rc; -
trunk/src/VBox/Main/include/ConsoleImpl.h
r606 r886 478 478 bool mVMStateChangeCallbackDisabled; 479 479 480 / / local state value480 /* Local machine state value */ 481 481 MachineState_T mMachineState; 482 482 … … 484 484 CallbackList mCallbacks; 485 485 486 struct 487 { 488 /** OnMousePointerShapeChange() cache */ 489 struct 490 { 491 bool valid; 492 bool visible; 493 bool alpha; 494 uint32_t xHot; 495 uint32_t yHot; 496 uint32_t width; 497 uint32_t height; 498 BYTE *shape; 499 } 500 mpsc; 501 502 /** OnMouseCapabilityChange() cache */ 503 struct 504 { 505 bool valid; 506 BOOL supportsAbsolute; 507 BOOL needsHostCursor; 508 } 509 mcc; 510 511 /** OnKeyboardLedsChange() cache */ 512 struct 513 { 514 bool valid; 515 bool numLock; 516 bool capsLock; 517 bool scrollLock; 518 } 519 klc; 520 } 521 mCallbackData; 522 486 523 friend struct VMTask; 487 524 };
Note:
See TracChangeset
for help on using the changeset viewer.