VirtualBox

Ignore:
Timestamp:
Feb 13, 2007 7:08:24 PM (18 years ago)
Author:
vboxsync
Message:

Backed out rev. 18598

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r886 r887  
    306306    AssertReturn (mAudioSniffer, E_FAIL);
    307307
    308     memset (&mCallbackData, 0, sizeof (mCallbackData));   
    309    
    310308    /* Confirm a successful initialization when it's the case */
    311309    autoInitSpan.setSucceeded();
     
    421419    unconst (mMachine).setNull();
    422420
    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. */
     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.
    427425    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);
    434426
    435427    LogFlowThisFuncLeave();
     
    23632355    mCallbacks.push_back (CallbackList::value_type (aCallback));
    23642356
    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);
    23822372    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
    23882377
    23892378    return S_OK;
     
    32753264
    32763265/**
    3277  *  @note Locks this object for writing.
     3266 *  @note Locks this object for reading.
    32783267 */
    32793268void Console::onMousePointerShapeChange(bool fVisible, bool fAlpha,
     
    32863275                      fVisible, fAlpha, xHot, yHot, width, height, pShape));
    32873276
    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);
    33143278
    33153279    CallbackList::iterator it = mCallbacks.begin();
     
    33203284
    33213285/**
    3322  *  @note Locks this object for writing.
     3286 *  @note Locks this object for reading.
    33233287 */
    33243288void Console::onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor)
     
    33303294    AssertComRCReturnVoid (autoCaller.rc());
    33313295
    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
    33403298    CallbackList::iterator it = mCallbacks.begin();
    33413299    while (it != mCallbacks.end())
     
    33943352
    33953353/**
    3396  *  @note Locks this object for writing.
     3354 *  @note Locks this object for reading.
    33973355 */
    33983356void Console::onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock)
     
    34013359    AssertComRCReturnVoid (autoCaller.rc());
    34023360
    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);
    34113362
    34123363    CallbackList::iterator it = mCallbacks.begin();
     
    37063657        mVMDestroying = false;
    37073658
    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    
    37193659    LogFlowThisFuncLeave();
    37203660    return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette