Changeset 887 in vbox for trunk/src/VBox/Main/ConsoleImpl.cpp
- Timestamp:
- Feb 13, 2007 7:08:24 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r886 r887 306 306 AssertReturn (mAudioSniffer, E_FAIL); 307 307 308 memset (&mCallbackData, 0, sizeof (mCallbackData));309 310 308 /* Confirm a successful initialization when it's the case */ 311 309 autoInitSpan.setSucceeded(); … … 421 419 unconst (mMachine).setNull(); 422 420 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 to426 * unregister a non-registered callback. */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 to 424 // unregister a non-registered callback. 427 425 mCallbacks.clear(); 428 429 /* dynamically allocated members of mCallbackData are uninitialized430 * at the end of powerDown() */431 Assert (!mCallbackData.mpsc.valid && mCallbackData.mpsc.shape == NULL);432 Assert (!mCallbackData.mcc.valid);433 Assert (!mCallbackData.klc.valid);434 426 435 427 LogFlowThisFuncLeave(); … … 2363 2355 mCallbacks.push_back (CallbackList::value_type (aCallback)); 2364 2356 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); 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); 2382 2372 aCallback->OnAdditionsStateChange(); 2383 2384 if (mCallbackData.klc.valid) 2385 aCallback->OnKeyboardLedsChange (mCallbackData.klc.numLock, 2386 mCallbackData.klc.capsLock, 2387 mCallbackData.klc.scrollLock); 2373 aCallback->OnKeyboardLedsChange(mCallbackStatus.keyboardLeds.fNumLock, 2374 mCallbackStatus.keyboardLeds.fCapsLock, 2375 mCallbackStatus.keyboardLeds.fScrollLock); 2376 #endif 2388 2377 2389 2378 return S_OK; … … 3275 3264 3276 3265 /** 3277 * @note Locks this object for writing.3266 * @note Locks this object for reading. 3278 3267 */ 3279 3268 void Console::onMousePointerShapeChange(bool fVisible, bool fAlpha, … … 3286 3275 fVisible, fAlpha, xHot, yHot, width, height, pShape)); 3287 3276 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; 3277 AutoReaderLock alock (this); 3314 3278 3315 3279 CallbackList::iterator it = mCallbacks.begin(); … … 3320 3284 3321 3285 /** 3322 * @note Locks this object for writing.3286 * @note Locks this object for reading. 3323 3287 */ 3324 3288 void Console::onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor) … … 3330 3294 AssertComRCReturnVoid (autoCaller.rc()); 3331 3295 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 3296 AutoReaderLock alock (this); 3297 3340 3298 CallbackList::iterator it = mCallbacks.begin(); 3341 3299 while (it != mCallbacks.end()) … … 3394 3352 3395 3353 /** 3396 * @note Locks this object for writing.3354 * @note Locks this object for reading. 3397 3355 */ 3398 3356 void Console::onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock) … … 3401 3359 AssertComRCReturnVoid (autoCaller.rc()); 3402 3360 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; 3361 AutoReaderLock alock (this); 3411 3362 3412 3363 CallbackList::iterator it = mCallbacks.begin(); … … 3706 3657 mVMDestroying = false; 3707 3658 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 3719 3659 LogFlowThisFuncLeave(); 3720 3660 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.