VirtualBox

Changeset 30825 in vbox


Ignore:
Timestamp:
Jul 14, 2010 12:44:14 PM (14 years ago)
Author:
vboxsync
Message:

Main: callbacks removal

Location:
trunk
Files:
2 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/VirtualBox.h

    r29388 r30825  
    5353#include "VBox/com/ptr.h"
    5454
    55 template <class I>
    56 inline HRESULT createCallbackWrapper(I* aInstance,
    57                                      I** paWrapper)
    58 {
    59     ComPtr<ILocalOwner> ptr;
    60 
    61 #ifdef VBOX_WITH_XPCOM /* very noisy in pedantic mode */
    62     static const CLSID clsid = NS_CALLBACKWRAPPER_CID;
    63     HRESULT rc = ptr.createInprocObject(clsid);
    64 #else
    65     HRESULT rc = ptr.createInprocObject(CLSID_CallbackWrapper);
    6655#endif
    67     if (FAILED(rc))
    68         return rc;
    69 
    70     rc = ptr->SetLocalObject(aInstance);
    71     if (FAILED(rc))
    72         return rc;
    73 
    74     ComPtr<I> ptr2 = ptr;
    75     if (ptr2.isNull())
    76         return E_FAIL;
    77 
    78     rc = ptr2.queryInterfaceTo(paWrapper);
    79     return rc;
    80 }
    81 #endif
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r30627 r30825  
    155155            case VBoxEventType_OnGuestPropertyChange:
    156156            {
    157                 ComPtr<IGuestPropertyChangeEvent> gpcev = aEvent;
     157                ComPtr<IGuestPropertyChangedEvent> gpcev = aEvent;
    158158                Assert(gpcev);
    159159
     
    289289            {
    290290
    291                 ComPtr<IMouseCapabilityChangeEvent> mccev = aEvent;
     291                ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent;
    292292                Assert(mccev);
    293293
     
    313313            case VBoxEventType_OnStateChange:
    314314            {
    315                 ComPtr<IStateChangeEvent> scev = aEvent;
     315                ComPtr<IStateChangedEvent> scev = aEvent;
    316316                Assert(scev);
    317317
     
    324324            case VBoxEventType_OnRemoteDisplayInfoChange:
    325325            {
    326                 ComPtr<IRemoteDisplayInfoChangeEvent> rdicev = aEvent;
     326                ComPtr<IRemoteDisplayInfoChangedEvent> rdicev = aEvent;
    327327                Assert(rdicev);
    328328
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp

    r30806 r30825  
    338338                case VBoxEventType_OnGuestPropertyChange:
    339339                {
    340                     ComPtr<IGuestPropertyChangeEvent> gpcev = ev;
     340                    ComPtr<IGuestPropertyChangedEvent> gpcev = ev;
    341341                    Assert(gpcev);
    342342                    Bstr aNextStrGuid;
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r30681 r30825  
    276276            {
    277277#ifdef VBOX_SECURELABEL
    278                 ComPtr<IExtraDataChangeEvent> edcev = aEvent;
     278                ComPtr<IExtraDataChangedEvent> edcev = aEvent;
    279279                Assert(edcev);
    280280                Bstr key, machineId;
     
    366366            case VBoxEventType_OnMousePointerShapeChange:
    367367            {
    368                 ComPtr<IMousePointerShapeChangeEvent> mpscev = aEvent;
     368                ComPtr<IMousePointerShapeChangedEvent> mpscev = aEvent;
    369369                Assert(mpscev);
    370370                PointerShapeChangeData *data;
     
    399399            case VBoxEventType_OnMouseCapabilityChange:
    400400            {
    401                 ComPtr<IMouseCapabilityChangeEvent> mccev = aEvent;
     401                ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent;
    402402                Assert(mccev);
    403403                mccev->COMGETTER(SupportsAbsolute)(&gfAbsoluteMouseGuest);
     
    413413            case VBoxEventType_OnKeyboardLedsChange:
    414414            {
    415                 ComPtr<IKeyboardLedsChangeEvent> klcev = aEvent;
     415                ComPtr<IKeyboardLedsChangedEvent> klcev = aEvent;
    416416                Assert(klcev);
    417417                BOOL fNumLock, fCapsLock, fScrollLock;
     
    432432            case VBoxEventType_OnStateChange:
    433433            {
    434                 ComPtr<IStateChangeEvent> scev = aEvent;
     434                ComPtr<IStateChangedEvent> scev = aEvent;
    435435                Assert(scev);
    436436                MachineState_T machineState;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp

    r30699 r30825  
    6666        case KVBoxEventType_OnMachineStateChange:
    6767        {
    68             CMachineStateChangeEvent es(event);
     68            CMachineStateChangedEvent es(event);
    6969            emit sigMachineStateChange(es.GetMachineId(), es.GetState());
    7070            break;
     
    7272        case KVBoxEventType_OnMachineDataChange:
    7373        {
    74             CMachineDataChangeEvent es(event);
     74            CMachineDataChangedEvent es(event);
    7575            emit sigMachineDataChange(es.GetMachineId());
    7676            break;
     
    8989        case KVBoxEventType_OnExtraDataChange:
    9090        {
    91             CExtraDataChangeEvent es(event);
     91            CExtraDataChangedEvent es(event);
    9292            emit sigExtraDataChange(es.GetMachineId(), es.GetKey(), es.GetValue());
    9393            break;
     
    104104        case KVBoxEventType_OnSessionStateChange:
    105105        {
    106             CSessionStateChangeEvent es(event);
     106            CSessionStateChangedEvent es(event);
    107107            emit sigSessionStateChange(es.GetMachineId(), es.GetState());
    108108            break;
     
    114114        case KVBoxEventType_OnSnapshotChange:
    115115        {
    116             CSnapshotChangeEvent es(event);
     116            CSnapshotChangedEvent es(event);
    117117            emit sigSnapshotChange(es.GetMachineId(), es.GetSnapshotId());
    118118            break;
     
    126126        case KVBoxEventType_OnMousePointerShapeChange:
    127127        {
    128             CMousePointerShapeChangeEvent es(event);
     128            CMousePointerShapeChangedEvent es(event);
    129129            emit sigMousePointerShapeChange(es.GetVisible(), es.GetAlpha(), QPoint(es.GetXhot(), es.GetYhot()), QSize(es.GetWidth(), es.GetHeight()), es.GetShape());
    130130            break;
     
    132132        case KVBoxEventType_OnMouseCapabilityChange:
    133133        {
    134             CMouseCapabilityChangeEvent es(event);
     134            CMouseCapabilityChangedEvent es(event);
    135135            emit sigMouseCapabilityChange(es.GetSupportsAbsolute(), es.GetSupportsRelative(), es.GetNeedsHostCursor());
    136136            break;
     
    138138        case KVBoxEventType_OnKeyboardLedsChange:
    139139        {
    140             CKeyboardLedsChangeEvent es(event);
     140            CKeyboardLedsChangedEvent es(event);
    141141            emit sigKeyboardLedsChangeEvent(es.GetNumLock(), es.GetCapsLock(), es.GetScrollLock());
    142142            break;
     
    144144        case KVBoxEventType_OnStateChange:
    145145        {
    146             CStateChangeEvent es(event);
     146            CStateChangedEvent es(event);
    147147            emit sigStateChange(es.GetState());
    148148            break;
     
    155155        case KVBoxEventType_OnNetworkAdapterChange:
    156156        {
    157             CNetworkAdapterChangeEvent es(event);
     157            CNetworkAdapterChangedEvent es(event);
    158158            emit sigNetworkAdapterChange(es.GetNetworkAdapter());
    159159            break;
     
    166166        case KVBoxEventType_OnMediumChange:
    167167        {
    168             CMediumChangeEvent es(event);
     168            CMediumChangedEvent es(event);
    169169            emit sigMediumChange(es.GetMediumAttachment());
    170170            break;
     
    182182        case KVBoxEventType_OnUSBDeviceStateChange:
    183183        {
    184             CUSBDeviceStateChangeEvent es(event);
     184            CUSBDeviceStateChangedEvent es(event);
    185185            emit sigUSBDeviceStateChange(es.GetDevice(), es.GetAttached(), es.GetError());
    186186            break;
     
    188188        case KVBoxEventType_OnSharedFolderChange:
    189189        {
    190             CSharedFolderChangeEvent es(event);
     190            CSharedFolderChangedEvent es(event);
    191191            emit sigSharedFolderChange();
    192192            break;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r30696 r30825  
    3434/* Local forwards */
    3535class UIActionsPool;
    36 class UIConsoleCallback;
    3736class UIFrameBuffer;
    3837class UIMachine;
     
    209208    UIMachine *m_pMachine;
    210209    CSession &m_session;
    211     const CConsoleCallback m_callback;
    212210
    213211    UIMachineMenuBar *m_pMenuPool;
     
    261259
    262260#endif // !___UIConsole_h___
    263 
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r30804 r30825  
    255255{
    256256public:
    257     ComPtr<IConsoleCallback> ptrICb;
    258     /** Bitmap of disabled callback methods, that is methods that has return
    259      * VBOX_E_DONT_CALL_AGAIN. */
    260     uint32_t                    bmDisabled;
    261257    /** Callback bit indexes (for bmDisabled). */
    262258    typedef enum
     
    283279    } CallbackBit;
    284280
    285     ConsoleCallbackRegistration(IConsoleCallback *pIConsoleCallback)
    286         : ptrICb(pIConsoleCallback), bmDisabled(0)
     281    ConsoleCallbackRegistration()
    287282    {
    288283        /* nothing */
     
    292287    {
    293288       /* nothing */
    294     }
    295 
    296     /** Equal operator for std::find. */
    297     bool operator==(const ConsoleCallbackRegistration &rThat) const
    298     {
    299         return this->ptrICb == rThat.ptrICb;
    300     }
    301 
    302     /**
    303      * Checks if the callback is wanted, i.e. if the method hasn't yet returned
    304      * VBOX_E_DONT_CALL_AGAIN.
    305      * @returns @c true if it is wanted, @c false if not.
    306      * @param   enmBit      The callback, be sure to get this one right!
    307      */
    308     inline bool isWanted(CallbackBit enmBit) const
    309     {
    310         return !ASMBitTest(&bmDisabled, enmBit);
    311     }
    312 
    313     /**
    314      * Called in response to VBOX_E_DONT_CALL_AGAIN.
    315      * @param   enmBit      The callback, be sure to get this one right!
    316      */
    317     inline void setDontCallAgain(CallbackBit enmBit)
    318     {
    319         ASMAtomicBitSet(&bmDisabled, enmBit);
    320     }
    321 
    322     /**
    323      * Handle a callback return code, picking up VBOX_E_DONT_CALL_AGAIN.
    324      *
    325      * @returns hrc or S_OK if VBOX_E_DONT_CALL_AGAIN.
    326      * @param   enmBit      The callback, be sure to get this one right!
    327      * @param   hrc         The status code returned by the callback.
    328      */
    329     inline HRESULT handleResult(CallbackBit enmBit, HRESULT hrc)
    330     {
    331         if (hrc == VBOX_E_DONT_CALL_AGAIN)
    332         {
    333             setDontCallAgain(enmBit);
    334             hrc = S_OK;
    335         }
    336         return hrc;
    337289    }
    338290};
     
    349301#define PREP_ARGS8(a1,a2,a3,a4,a5,a6,a7,a8)  a1, a2, a3, a4, a5, a6, a7, a8
    350302
    351 #ifdef RT_OS_WINDOWS
    352 
    353303/**
    354  * Macro used to prepare for COM event firing, note CComObjectRootEx locking.
    355  */
    356 #define CONSOLE_COM_EVENTS_START(name,count)    \
    357    {                                            \
    358       ComEventDesc evDesc;                      \
    359                                                 \
    360       this->Lock();                             \
    361       int nConnections = this->m_vec.GetSize(); \
    362       if (nConnections)                         \
    363          evDesc.init(#name, count);
    364 
    365 /**
    366  * Actual event firing for all connection points.
    367  * Note some subtlety in the fact that connection point list access
    368  * must be synchronized with CComObjectRootEx Lock()/Unlock() methods.
    369  */
    370 #define CONSOLE_COM_EVENTS_END()                                \
    371     for (int i=0; i<nConnections; i++)                          \
    372     {                                                           \
    373         ComPtr<IUnknown> sp = this->m_vec.GetAt(i);             \
    374         ComPtr<IDispatch> cbD;                                  \
    375         cbD = sp;                                               \
    376         if (cbD != NULL)                                        \
    377         {                                                       \
    378             CComVariant varResult;                              \
    379             this->mComEvHelper.fire(cbD, evDesc, &varResult);   \
    380         }                                                       \
    381     }                                                           \
    382     this->Unlock();                                             \
    383    }
    384 
    385 /**
    386  * A bit non-trivial part about those macros is that we rely heavily on C++ type
    387  * casting and assignment operator overloading in CComVariant when instantiating
    388  * member template add(), and every add() here could be, ofc, different function.
    389  */
    390 #define PREP_COM_ARGS0()
    391 #define PREP_COM_ARGS1(a1)                      if (nConnections) evDesc.add(a1)
    392 #define PREP_COM_ARGS2(a1,a2)                   if (nConnections) evDesc.add(a1).add(a2)
    393 #define PREP_COM_ARGS3(a1,a2,a3)                if (nConnections) evDesc.add(a1).add(a2).add(a3)
    394 #define PREP_COM_ARGS4(a1,a2,a3,a4)             if (nConnections) evDesc.add(a1).add(a2).add(a3).add(a4)
    395 #define PREP_COM_ARGS5(a1,a2,a3,a4,a5)          if (nConnections) evDesc.add(a1).add(a2).add(a3).add(a4).add(a5)
    396 #define PREP_COM_ARGS6(a1,a2,a3,a4,a5,a6)       if (nConnections) evDesc.add(a1).add(a2).add(a3).add(a4).add(a5).add(a6)
    397 #define PREP_COM_ARGS7(a1,a2,a3,a4,a5,a6,a7)    if (nConnections) evDesc.add(a1).add(a2).add(a3).add(a4).add(a5).add(a6).add(a7)
    398 #define PREP_COM_ARGS8(a1,a2,a3,a4,a5,a6,a7,a8) if (nConnections) evDesc.add(a1).add(a2).add(a3).add(a4).add(a5).add(a6).add(a7).add(a8)
    399 
    400 #else
    401 
    402 /**
    403  * No COM events for XPCOM targets ofc.
    404  */
    405 #define CONSOLE_COM_EVENTS_START(name,count)
    406 #define CONSOLE_COM_EVENTS_END()
    407 #define PREP_COM_ARGS0()
    408 #define PREP_COM_ARGS1(a1)
    409 #define PREP_COM_ARGS2(a1,a2)
    410 #define PREP_COM_ARGS3(a1,a2,a3)
    411 #define PREP_COM_ARGS4(a1,a2,a3,a4)
    412 #define PREP_COM_ARGS5(a1,a2,a3,a4,a5)
    413 #define PREP_COM_ARGS6(a1,a2,a3,a4,a5,a6)
    414 #define PREP_COM_ARGS7(a1,a2,a3,a4,a5,a6,a7)
    415 #define PREP_COM_ARGS8(a1,a2,a3,a4,a5,a6,a7,a8)
    416 
    417 #endif
    418 
    419 /**
    420  * Macro for iterating the callback list (Console::mCallbacks) and invoking the
    421  * given method on each entry, along with firing appropriate COM events on Windows.
    422  *
    423  * This handles VBOX_E_DONT_CALL_AGAIN as well as removing dead interfaces
    424  * which.  This makes the code a big and clunky, thus this macro.  It may make
    425  * debugging and selective logging a bit of a pain, but duplicating this code
    426  * some seventeen times is much more of a pain.
    427  *
    428  * The caller must hold the console object lock - read or write, we don't care.
    429  * The caller must be a Console method - the console members accessible thru the
    430  * 'this' pointer.
     304 * Macro for firing appropriate event.
    431305 *
    432306 * @param   CallbackMethod      The callback method, like OnKeyboardLedsChange.
     
    435309 * @param   Args                Number of callback arguments
    436310 */
    437 #define CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, Argc, Args, PrepComArgs, MaybeComma) \
     311#define CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, Args, MaybeComma) \
    438312    do \
    439313    { \
    440         CONSOLE_COM_EVENTS_START(CallbackMethod,Argc);   \
    441         PrepComArgs; \
    442         CONSOLE_COM_EVENTS_END();  \
    443314        VBoxEventDesc evDesc; \
    444315        evDesc.init(mEventSource, VBoxEventType_##CallbackMethod MaybeComma Args);     \
    445316        evDesc.fire(/* don't wait for delivery */ 0); \
    446         CallbackList::iterator it = this->mCallbacks.begin(); \
    447         while (it != this->mCallbacks.end()) \
    448         { \
    449             if (it->isWanted(ConsoleCallbackRegistration::k ## CallbackMethod)) \
    450             { \
    451                 HRESULT hrc = it->ptrICb-> CallbackMethod (Args);                   \
    452                 hrc = it->handleResult(ConsoleCallbackRegistration::k ## CallbackMethod, hrc); \
    453                 if (FAILED_DEAD_INTERFACE(hrc)) \
    454                 { \
    455                     it = this->mCallbacks.erase(it); \
    456                     continue; \
    457                 } \
    458             } \
    459             ++it; \
    460         } \
    461317    } while (0)
    462318
     
    465321/* Actual invocation macroses for different number of parameters */
    466322#define CONSOLE_DO_CALLBACKS0(CallbackMethod)                           \
    467     CONSOLE_DO_CALLBACKS_GEN(CallbackMethod,  0, PREP_ARGS0(), PREP_COM_ARGS0(), NO_COMMA)
     323    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod,  PREP_ARGS0(), NO_COMMA)
    468324#define CONSOLE_DO_CALLBACKS1(CallbackMethod,Arg1)                      \
    469     CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, 1, PREP_ARGS1(Arg1), PREP_COM_ARGS1(Arg1), COMMA)
     325    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, PREP_ARGS1(Arg1), COMMA)
    470326#define CONSOLE_DO_CALLBACKS2(CallbackMethod,Arg1,Arg2)                 \
    471     CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, 2, PREP_ARGS2(Arg1,Arg2),PREP_COM_ARGS2(Arg1,Arg2), COMMA)
     327    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, PREP_ARGS2(Arg1,Arg2),COMMA)
    472328#define CONSOLE_DO_CALLBACKS3(CallbackMethod,Arg1,Arg2,Arg3)            \
    473     CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, 3, PREP_ARGS3(Arg1,Arg2,Arg3), PREP_COM_ARGS3(Arg1,Arg2,Arg3), COMMA)
     329    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, PREP_ARGS3(Arg1,Arg2,Arg3), COMMA)
    474330#define CONSOLE_DO_CALLBACKS4(CallbackMethod,Arg1,Arg2,Arg3,Arg4)       \
    475     CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, 4, PREP_ARGS4(Arg1,Arg2,Arg3,Arg4), PREP_COM_ARGS4(Arg1,Arg2,Arg3,Arg4), COMMA)
     331    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, PREP_ARGS4(Arg1,Arg2,Arg3,Arg4), COMMA)
    476332#define CONSOLE_DO_CALLBACKS7(CallbackMethod,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) \
    477     CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, 7, PREP_ARGS7(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7), PREP_COM_ARGS7(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7), COMMA)
     333    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, PREP_ARGS7(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7), COMMA)
    478334#define CONSOLE_DO_CALLBACKS8(CallbackMethod,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8) \
    479     CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, 8, PREP_ARGS8(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8), PREP_COM_ARGS8(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7, Arg8), COMMA)
     335    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, PREP_ARGS8(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8), COMMA)
    480336
    481337// constructor / destructor
     
    546402    unconst(mControl) = aControl;
    547403
    548     mCallbackData.clear();
    549 
    550404    /* Cache essential properties and objects */
    551405
     
    606460    unconst(mAudioSniffer) = new AudioSniffer(this);
    607461    AssertReturn(mAudioSniffer, E_FAIL);
    608 
    609 #ifdef RT_OS_WINDOWS
    610     if (SUCCEEDED(rc))
    611         rc = mComEvHelper.init(IID_IConsoleCallback);
    612 #endif
    613462
    614463    /* Confirm a successful initialization when it's the case */
     
    727576    // we don't perform uninit() as it's possible that some pending event refers to this source
    728577    unconst(mEventSource).setNull();
    729 
    730     /* Release all callbacks. Do this after uninitializing the components,
    731      * as some of them are well-behaved and unregister their callbacks.
    732      * These would trigger error messages complaining about trying to
    733      * unregister a non-registered callback. */
    734     mCallbacks.clear();
    735578
    736579    /* dynamically allocated members of mCallbackData are uninitialized
     
    31062949
    31072950    setMachineStateLocally(machineState);
    3108     return S_OK;
    3109 }
    3110 
    3111 STDMETHODIMP Console::RegisterCallback(IConsoleCallback *aCallback)
    3112 {
    3113     CheckComArgNotNull(aCallback);
    3114 
    3115     AutoCaller autoCaller(this);
    3116     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    3117 
    3118     /* Query the interface we associate with IConsoleCallback as the caller
    3119        might've been compiled against a different SDK. */
    3120     void *pvCallback;
    3121     HRESULT hrc = aCallback->QueryInterface(COM_IIDOF(IConsoleCallback), &pvCallback);
    3122     if (FAILED(hrc))
    3123         return setError(hrc, tr("Incompatible IConsoleCallback interface - version mismatch?"));
    3124     aCallback = (IConsoleCallback *)pvCallback;
    3125 
    3126     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    3127 
    3128     mCallbacks.push_back(CallbackList::value_type(aCallback));
    3129 
    3130     /* Inform the callback about the current status (for example, the new
    3131      * callback must know the current mouse capabilities and the pointer
    3132      * shape in order to properly integrate the mouse pointer). */
    3133 
    3134     if (mCallbackData.mpsc.valid)
    3135         aCallback->OnMousePointerShapeChange(mCallbackData.mpsc.visible,
    3136                                              mCallbackData.mpsc.alpha,
    3137                                              mCallbackData.mpsc.xHot,
    3138                                              mCallbackData.mpsc.yHot,
    3139                                              mCallbackData.mpsc.width,
    3140                                              mCallbackData.mpsc.height,
    3141                                              ComSafeArrayAsInParam(mCallbackData.mpsc.shape));
    3142     if (mCallbackData.mcc.valid)
    3143         aCallback->OnMouseCapabilityChange(mCallbackData.mcc.supportsAbsolute,
    3144                                            mCallbackData.mcc.supportsRelative,
    3145                                            mCallbackData.mcc.needsHostCursor);
    3146 
    3147     aCallback->OnAdditionsStateChange();
    3148 
    3149     if (mCallbackData.klc.valid)
    3150         aCallback->OnKeyboardLedsChange(mCallbackData.klc.numLock,
    3151                                         mCallbackData.klc.capsLock,
    3152                                         mCallbackData.klc.scrollLock);
    3153 
    3154     /* Note: we don't call OnStateChange for new callbacks because the
    3155      * machine state is a) not actually changed on callback registration
    3156      * and b) can be always queried from Console. */
    3157 
    3158     /* Drop the reference we got via QueryInterface. */
    3159     aCallback->Release();
    3160     return S_OK;
    3161 }
    3162 
    3163 STDMETHODIMP Console::UnregisterCallback(IConsoleCallback *aCallback)
    3164 {
    3165     CheckComArgNotNull(aCallback);
    3166 
    3167     AutoCaller autoCaller(this);
    3168     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    3169 
    3170     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    3171 
    3172     CallbackList::iterator it;
    3173     it = std::find(mCallbacks.begin(),
    3174                    mCallbacks.end(),
    3175                    CallbackList::value_type(aCallback));
    3176     if (it == mCallbacks.end())
    3177         return setError(E_INVALIDARG,
    3178             tr("The given callback handler is not registered"));
    3179 
    3180     mCallbacks.erase(it);
    31812951    return S_OK;
    31822952}
     
    49654735
    49664736    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    4967     CallbackList::iterator it = mCallbacks.begin();
    49684737    VBoxEventDesc evDesc;
    49694738
    49704739    if (aCheck)
    49714740    {
    4972         while (it != mCallbacks.end())
    4973         {
    4974             if (it->isWanted(ConsoleCallbackRegistration::kOnCanShowWindow))
    4975             {
    4976                 BOOL canShow = FALSE;
    4977                 HRESULT hrc = it->ptrICb->OnCanShowWindow(&canShow);
    4978                 hrc = it->handleResult(ConsoleCallbackRegistration::kOnCanShowWindow, hrc);
    4979                 if (FAILED_DEAD_INTERFACE(hrc))
    4980                 {
    4981                     it = this->mCallbacks.erase(it);
    4982                     continue;
    4983                 }
    4984                 AssertComRC(hrc);
    4985                 if (FAILED(hrc) || !canShow)
    4986                     return hrc;
    4987             }
    4988             ++it;
    4989         }
    49904741        evDesc.init(mEventSource, VBoxEventType_OnCanShowWindow);
    49914742        BOOL fDelivered = evDesc.fire(5000); /* Wait up to 5 secs for delivery */
     
    50144765    else
    50154766    {
    5016         while (it != mCallbacks.end())
    5017         {
    5018             if (it->isWanted(ConsoleCallbackRegistration::kOnShowWindow))
    5019             {
    5020                 ULONG64 winId = 0;
    5021                 HRESULT hrc = it->ptrICb->OnShowWindow(&winId);
    5022                 hrc = it->handleResult(ConsoleCallbackRegistration::kOnCanShowWindow, hrc);
    5023                 if (FAILED_DEAD_INTERFACE(hrc))
    5024                 {
    5025                     it = this->mCallbacks.erase(it);
    5026                     continue;
    5027                 }
    5028                 AssertComRC(hrc);
    5029                 if (FAILED(hrc))
    5030                     return hrc;
    5031 
    5032                 /* only one callback may return non-null winId */
    5033                 Assert(*aWinId == 0 || winId == 0);
    5034                 if (*aWinId == 0)
    5035                     *aWinId = winId;
    5036             }
    5037             ++it;
    5038         }
    50394767        evDesc.init(mEventSource, VBoxEventType_OnShowWindow, UINT64_C(0));
    50404768        BOOL fDelivered = evDesc.fire(5000); /* Wait up to 5 secs for delivery */
  • trunk/src/VBox/Main/ConsoleVRDPServer.cpp

    r30764 r30825  
    9191            case VBoxEventType_OnMousePointerShapeChange:
    9292            {
    93                 ComPtr<IMousePointerShapeChangeEvent> mpscev = aEvent;
     93                ComPtr<IMousePointerShapeChangedEvent> mpscev = aEvent;
    9494                Assert(mpscev);
    9595                BOOL    visible,  alpha;
     
    110110            case VBoxEventType_OnMouseCapabilityChange:
    111111            {
    112                 ComPtr<IMouseCapabilityChangeEvent> mccev = aEvent;
     112                ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent;
    113113                Assert(mccev);
    114114                if (m_server)
     
    122122            case VBoxEventType_OnKeyboardLedsChange:
    123123            {
    124                 ComPtr<IKeyboardLedsChangeEvent> klcev = aEvent;
     124                ComPtr<IKeyboardLedsChangedEvent> klcev = aEvent;
    125125                Assert(klcev);
    126126
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r30681 r30825  
    747747        case VBoxEventType_OnStateChange:
    748748        {
    749             ComPtr<IStateChangeEvent> scev = aEvent;
     749            ComPtr<IStateChangedEvent> scev = aEvent;
    750750            Assert(scev);
    751751            MachineState_T machineState;
  • trunk/src/VBox/Main/EventImpl.cpp

    r30770 r30825  
    371371    ListenerRecord* mRef; /* must be weak reference */
    372372    int32_t         mRefCnt;
    373    
     373
    374374public:
    375375    EventMapRecord(ListenerRecord* aRef)
  • trunk/src/VBox/Main/Global.cpp

    r29815 r30825  
    434434        case VBOX_E_INVALID_SESSION_STATE:      return VERR_COM_INVALID_SESSION_STATE;
    435435        case VBOX_E_OBJECT_IN_USE:              return VERR_COM_OBJECT_IN_USE;
    436         case VBOX_E_DONT_CALL_AGAIN:            return VERR_COM_DONT_CALL_AGAIN;
    437436
    438437        default:
     
    480479        case VERR_COM_INVALID_SESSION_STATE:    return VBOX_E_INVALID_SESSION_STATE;
    481480        case VERR_COM_OBJECT_IN_USE:            return VBOX_E_OBJECT_IN_USE;
    482         case VERR_COM_DONT_CALL_AGAIN:          return VBOX_E_DONT_CALL_AGAIN;
    483481
    484482        /* Other errors. */
  • trunk/src/VBox/Main/Makefile.kmk

    r30739 r30825  
    639639        SharedFolderImpl.cpp \
    640640        SessionImpl.cpp \
    641         VirtualBoxCallbackImpl.cpp \
    642641        ConsoleImpl.cpp \
    643642        ConsoleImpl2.cpp \
     
    659658        win/dllmain.cpp \
    660659        win/VBoxC.def \
    661         win/VBoxC.rc \
    662         win/VBoxComEvents.cpp
     660        win/VBoxC.rc
    663661
    664662
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r30777 r30825  
    118118{
    119119public:
    120     ComPtr<IVirtualBoxCallback> ptrICb;
    121     /** Bitmap of disabled callback methods, that is methods that has return
    122      * VBOX_E_DONT_CALL_AGAIN. */
    123     uint32_t                    bmDisabled;
    124120    /** Callback bit indexes (for bmDisabled). */
    125121    typedef enum
     
    138134    } CallbackBit;
    139135
    140     VirtualBoxCallbackRegistration(IVirtualBoxCallback *pIVirtualBoxCallback)
    141         : ptrICb(pIVirtualBoxCallback), bmDisabled(0)
     136    VirtualBoxCallbackRegistration()
    142137    {
    143138        /* nothing */
     
    147142    {
    148143       /* nothing */
    149     }
    150 
    151     /** Equal operator for std::find. */
    152     bool operator==(const VirtualBoxCallbackRegistration &rThat) const
    153     {
    154         return this->ptrICb == rThat.ptrICb;
    155     }
    156 
    157     /**
    158      * Checks if the callback is wanted, i.e. if the method hasn't yet returned
    159      * VBOX_E_DONT_CALL_AGAIN.
    160      * @returns @c true if it is wanted, @c false if not.
    161      * @param   enmBit      The callback, be sure to get this one right!
    162      */
    163     inline bool isWanted(CallbackBit enmBit) const
    164     {
    165         return !ASMBitTest(&bmDisabled, enmBit);
    166     }
    167 
    168     /**
    169      * Called in response to VBOX_E_DONT_CALL_AGAIN.
    170      * @param   enmBit      The callback, be sure to get this one right!
    171      */
    172     inline void setDontCallAgain(CallbackBit enmBit)
    173     {
    174         ASMAtomicBitSet(&bmDisabled, enmBit);
    175144    }
    176145};
     
    204173    void *handler();
    205174
    206     virtual HRESULT handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback) = 0;
    207175    virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) = 0;
    208 
    209 #ifdef RT_OS_WINDOWS
    210     virtual HRESULT prepareComEventDesc(ComEventDesc& aEvDesc) = 0;
    211 #endif
    212176
    213177private:
     
    218182     */
    219183    VirtualBox        *mVirtualBox;
    220 
    221184protected:
    222     /** The callback being called, used for handling VBOX_E_DONT_CALL_AGAIN. */
    223185    VirtualBoxCallbackRegistration::CallbackBit mWhat;
    224186};
     
    343305    RWLockHandle                        mtxProgressOperations;
    344306    ProgressMap                         mapProgressOperations;
    345     CallbackList                        llCallbacks;
    346307
    347308    // the following are data for the client watcher thread
     
    600561    }
    601562
    602 #ifdef RT_OS_WINDOWS
    603     if (SUCCEEDED(rc))
    604         rc = m->mComEvHelper.init(IID_IVirtualBoxCallback);
    605 #endif
    606563    /* Confirm a successful initialization when it's the case */
    607564    if (SUCCEEDED(rc))
     
    753710    }
    754711#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    755 
    756     LogFlowThisFunc(("Releasing callbacks...\n"));
    757     if (m->llCallbacks.size())
    758     {
    759         /* release all callbacks */
    760         LogWarningFunc(("%d unregistered callbacks!\n",
    761                         m->llCallbacks.size()));
    762         m->llCallbacks.clear();
    763     }
    764712
    765713    LogFlowThisFunc(("Terminating the async event handler...\n"));
     
    21132061}
    21142062
    2115 /**
    2116  *  @note Locks this object for writing.
    2117  */
    2118 STDMETHODIMP VirtualBox::RegisterCallback(IVirtualBoxCallback *aCallback)
    2119 {
    2120     LogFlowThisFunc(("aCallback=%p\n", aCallback));
    2121 
    2122     CheckComArgNotNull(aCallback);
    2123 
    2124     AutoCaller autoCaller(this);
    2125     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    2126 
    2127     /* Query the interface we associate with IVirtualBoxCallback as the caller
    2128        might've been compiled against a different SDK. */
    2129     void *pvCallback;
    2130     HRESULT hrc = aCallback->QueryInterface(COM_IIDOF(IVirtualBoxCallback), &pvCallback);
    2131     if (FAILED(hrc))
    2132         return setError(hrc, tr("Incompatible IVirtualBoxCallback interface - version mismatch?"));
    2133     aCallback = (IVirtualBoxCallback *)pvCallback;
    2134 
    2135     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    2136     m->llCallbacks.push_back(CallbackList::value_type(aCallback));
    2137 
    2138     aCallback->Release();
    2139     return S_OK;
    2140 }
    2141 
    2142 /**
    2143  *  @note Locks this object for writing.
    2144  */
    2145 STDMETHODIMP VirtualBox::UnregisterCallback(IVirtualBoxCallback *aCallback)
    2146 {
    2147     CheckComArgNotNull(aCallback);
    2148 
    2149     AutoCaller autoCaller(this);
    2150     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    2151 
    2152     HRESULT rc = S_OK;
    2153 
    2154     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    2155 
    2156     CallbackList::iterator it;
    2157     it = std::find(m->llCallbacks.begin(),
    2158                    m->llCallbacks.end(),
    2159                    CallbackList::value_type(aCallback));
    2160     if (it == m->llCallbacks.end())
    2161         rc = E_INVALIDARG;
    2162     else
    2163         m->llCallbacks.erase(it);
    2164 
    2165     LogFlowThisFunc(("aCallback=%p, rc=%08X\n", aCallback, rc));
    2166     return rc;
    2167 }
    2168 
    2169 
    21702063STDMETHODIMP VirtualBox::WaitForPropertyChange(IN_BSTR /* aWhat */,
    21712064                                               ULONG /* aTimeout */,
     
    25722465}
    25732466
    2574 /**
    2575  * Removes a dead callback.
    2576  * @param aCallback     The reference to the registered callback interface.
    2577  */
    2578 void VirtualBox::removeDeadCallback(const ComPtr<IVirtualBoxCallback> &aCallback)
    2579 {
    2580     /* find and delete */
    2581     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    2582     CallbackList::iterator it = std::find(m->llCallbacks.begin(),
    2583                                           m->llCallbacks.end(),
    2584                                           CallbackList::value_type(aCallback));
    2585     if (it != m->llCallbacks.end())
    2586     {
    2587         LogRel(("Removing dead callback: %p\n", &*it));
    2588         m->llCallbacks.erase(it);
    2589     }
    2590 }
    2591 
    25922467/** Event for onMachineStateChange(), onMachineDataChange(), onMachineRegistered() */
    25932468struct MachineEvent : public VirtualBox::CallbackEvent
     
    26072482        {}
    26082483
    2609     HRESULT handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback)
     2484    virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc)
    26102485    {
    26112486        switch (mWhat)
    26122487        {
    26132488            case VirtualBoxCallbackRegistration::kOnMachineDataChange:
    2614                 LogFlow(("OnMachineDataChange: id={%ls}\n", id.raw()));
    2615                 return aCallback->OnMachineDataChange(id);
     2489                aEvDesc.init(aSource, VBoxEventType_OnMachineDataChange, id.raw());
     2490                break;
    26162491
    26172492            case VirtualBoxCallbackRegistration::kOnMachineStateChange:
    2618                 LogFlow(("OnMachineStateChange: id={%ls}, state=%d\n",
    2619                          id.raw(), state));
    2620                 return aCallback->OnMachineStateChange(id, state);
     2493                aEvDesc.init(aSource, VBoxEventType_OnMachineStateChange, id.raw(), state);
     2494                break;
    26212495
    26222496            case VirtualBoxCallbackRegistration::kOnMachineRegistered:
    2623                 LogFlow(("OnMachineRegistered: id={%ls}, registered=%d\n",
    2624                          id.raw(), registered));
    2625                 return aCallback->OnMachineRegistered(id, registered);
    2626 
    2627             default:
    2628                 AssertFailedReturn(S_OK);
    2629         }
    2630     }
    2631 #ifdef RT_OS_WINDOWS
    2632     HRESULT prepareComEventDesc(ComEventDesc& aEvDesc)
    2633     {
    2634         switch (mWhat)
    2635         {
    2636             case VirtualBoxCallbackRegistration::kOnMachineDataChange:
    2637                 aEvDesc.init("OnMachineDataChange", 1);
    2638                 aEvDesc.add(id);
    2639                 break;
    2640 
    2641             case VirtualBoxCallbackRegistration::kOnMachineStateChange:
    2642                 aEvDesc.init("OnMachineStateChange", 2);
    2643                 aEvDesc.add(id).add((int)state);
    2644                 break;
    2645 
    2646             case VirtualBoxCallbackRegistration::kOnMachineRegistered:
    2647                 aEvDesc.init("OnMachineRegistered", 2);
    2648                 aEvDesc.add(id).add(registered);
     2497                aEvDesc.init(aSource, VBoxEventType_OnMachineRegistered, id.raw(), registered);
    26492498                break;
    26502499
     
    26542503         return S_OK;
    26552504    }
    2656 #endif
    2657     virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc)
    2658     {
    2659         switch (mWhat)
    2660         {
    2661             case VirtualBoxCallbackRegistration::kOnMachineDataChange:
    2662                 aEvDesc.init(aSource, VBoxEventType_OnMachineDataChange, id.raw());
    2663                 break;
    2664 
    2665             case VirtualBoxCallbackRegistration::kOnMachineStateChange:
    2666                 aEvDesc.init(aSource, VBoxEventType_OnMachineStateChange, id.raw(), state);
    2667                 break;
    2668 
    2669             case VirtualBoxCallbackRegistration::kOnMachineRegistered:
    2670                 aEvDesc.init(aSource, VBoxEventType_OnMachineRegistered, id.raw(), registered);
    2671                 break;
    2672 
    2673             default:
    2674                 AssertFailedReturn(S_OK);
    2675          }
    2676          return S_OK;
    2677     }
    26782505
    26792506    Bstr id;
     
    27102537    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    27112538
    2712     CallbackList list;
    2713     {
    2714         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    2715         list = m->llCallbacks;
    2716     }
    2717 
    27182539    BOOL allowChange = TRUE;
    2719     CallbackList::iterator it = list.begin();
    27202540    Bstr id = aId.toUtf16();
    2721     while ((it != list.end()) && allowChange)
    2722     {
    2723         if (it->isWanted(VirtualBoxCallbackRegistration::kOnExtraDataCanChange))
    2724         {
    2725             HRESULT rc = it->ptrICb->OnExtraDataCanChange(id, aKey, aValue,
    2726                                                           aError.asOutParam(),
    2727                                                           &allowChange);
    2728             if (FAILED(rc))
    2729             {
    2730                 if (rc == VBOX_E_DONT_CALL_AGAIN)
    2731                 {
    2732                     /* Have to update the original. */
    2733                     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    2734                     CallbackList::iterator itOrg;
    2735                     itOrg = std::find(m->llCallbacks.begin(),
    2736                                       m->llCallbacks.end(),
    2737                                       CallbackList::value_type(it->ptrICb));
    2738                     if (itOrg != m->llCallbacks.end())
    2739                         itOrg->setDontCallAgain(VirtualBoxCallbackRegistration::kOnExtraDataCanChange);
    2740                 }
    2741                 else if (FAILED_DEAD_INTERFACE(rc))
    2742                     removeDeadCallback(it->ptrICb);
    2743 
    2744                 /* if a call to this method fails for some reason (for ex., because
    2745                  * the other side is dead), we ensure allowChange stays true
    2746                  * (MS COM RPC implementation seems to zero all output vars before
    2747                  * issuing an IPC call or after a failure, so it's essential
    2748                  * there) */
    2749                 allowChange = TRUE;
    2750             }
    2751         }
    2752         ++it;
    2753     }
    27542541
    27552542    VBoxEventDesc evDesc;
     
    27912578    {}
    27922579
    2793     HRESULT handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback)
    2794     {
    2795         LogFlow(("OnExtraDataChange: machineId={%ls}, key='%ls', val='%ls'\n",
    2796                  machineId.raw(), key.raw(), val.raw()));
    2797         return aCallback->OnExtraDataChange(machineId, key, val);
    2798     }
    2799 #ifdef RT_OS_WINDOWS
    2800     HRESULT prepareComEventDesc(ComEventDesc& aEvDesc)
    2801     {
    2802        aEvDesc.init("OnExtraDataChange", 3);
    2803        aEvDesc.add(machineId).add(key).add(val);
    2804        return S_OK;
    2805     }
    2806 #endif
    28072580    virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc)
    28082581    {
     
    28372610    {}
    28382611
    2839     HRESULT handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback)
    2840     {
    2841         LogFlow(("OnSessionStateChange: machineId={%ls}, sessionState=%d\n",
    2842                  machineId.raw(), sessionState));
    2843         return aCallback->OnSessionStateChange(machineId, sessionState);
    2844     }
    2845 
    2846 #ifdef RT_OS_WINDOWS
    2847     HRESULT prepareComEventDesc(ComEventDesc& aEvDesc)
    2848     {
    2849        aEvDesc.init("OnSessionStateChange", 2);
    2850        aEvDesc.add(machineId).add((int)sessionState);
    2851        return S_OK;
    2852     }
    2853 #endif
    28542612    virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc)
    28552613    {
     
    28772635        {}
    28782636
    2879     HRESULT handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback)
    2880     {
    2881         Bstr mid = machineId.toUtf16();
    2882         Bstr sid = snapshotId.toUtf16();
    2883 
    2884         switch (mWhat)
    2885         {
    2886             case VirtualBoxCallbackRegistration::kOnSnapshotTaken:
    2887                 LogFlow(("OnSnapshotTaken: machineId={%RTuuid}, snapshotId={%RTuuid}\n",
    2888                           machineId.ptr(), snapshotId.ptr()));
    2889                 return aCallback->OnSnapshotTaken(mid, sid);
    2890 
    2891             case VirtualBoxCallbackRegistration::kOnSnapshotDeleted:
    2892                 LogFlow(("OnSnapshotDeleted: machineId={%RTuuid}, snapshotId={%RTuuid}\n",
    2893                           machineId.ptr(), snapshotId.ptr()));
    2894                 return aCallback->OnSnapshotDeleted(mid, sid);
    2895 
    2896             case VirtualBoxCallbackRegistration::kOnSnapshotChange:
    2897                 LogFlow(("OnSnapshotChange: machineId={%RTuuid}, snapshotId={%RTuuid}\n",
    2898                           machineId.ptr(), snapshotId.ptr()));
    2899                 return aCallback->OnSnapshotChange(mid, sid);
    2900 
    2901             default:
    2902                 AssertFailedReturn(S_OK);
    2903         }
    2904     }
    2905 
    2906 #ifdef RT_OS_WINDOWS
    2907     HRESULT prepareComEventDesc(ComEventDesc& aEvDesc)
    2908     {
    2909        aEvDesc.init("OnSnapshotTaken", 2);
    2910        aEvDesc.add(machineId.toUtf16()).add(snapshotId.toUtf16());
    2911        return S_OK;
    2912     }
    2913 #endif
    29142637    virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc)
    29152638    {
     
    29612684    {}
    29622685
    2963     HRESULT handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback)
    2964     {
    2965         LogFlow(("OnGuestPropertyChange: machineId={%RTuuid}, name='%ls', value='%ls', flags='%ls'\n",
    2966                  machineId.ptr(), name.raw(), value.raw(), flags.raw()));
    2967         return aCallback->OnGuestPropertyChange(machineId.toUtf16(), name, value, flags);
    2968     }
    2969 
    2970 #ifdef RT_OS_WINDOWS
    2971     HRESULT prepareComEventDesc(ComEventDesc& aEvDesc)
    2972     {
    2973        aEvDesc.init("OnGuestPropertyChange", 4);
    2974        aEvDesc.add(machineId.toUtf16()).add(name).add(value).add(flags);
    2975        return S_OK;
    2976     }
    2977 #endif
    29782686    virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc)
    29792687    {
     
    46694377    }
    46704378
    4671     CallbackList callbacks;
    4672 #ifdef RT_OS_WINDOWS
    4673     EventListenersList listeners;
    4674 #endif
    4675     {
    4676         /* Make a copy to release the lock before iterating */
    4677         AutoReadLock alock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
    4678         callbacks = mVirtualBox->m->llCallbacks;
    4679 #ifdef RT_OS_WINDOWS
    4680         IUnknown** pp;
    4681         for (pp = mVirtualBox->m_vec.begin(); pp < mVirtualBox->m_vec.end(); pp++)
    4682         {
    4683             listeners.Add(*pp);
    4684         }
    4685 #endif
    4686     }
    4687 
    4688 
    4689 #ifdef RT_OS_WINDOWS
    4690     {
    4691      ComEventDesc evDesc;
    4692 
    4693      int nConnections = listeners.GetSize();
    4694      /* Only prepare args if someone really needs them */
    4695      if (nConnections)
    4696         prepareComEventDesc(evDesc);
    4697 
    4698      for (int i=0; i<nConnections; i++)
    4699      {
    4700         ComPtr<IUnknown> sp = listeners.GetAt(i);
    4701         ComPtr<IVirtualBoxCallback> cbI;
    4702         ComPtr<IDispatch> cbD;
    4703 
    4704         cbI = sp;
    4705         cbD = sp;
    4706 
    4707         /**
    4708          * Would be just handleCallback(cbI) in an ideal world, unfortunately our
    4709          * consumers want to be invoked via IDispatch, thus going the hard way.
    4710          */
    4711         if (cbI != NULL && cbD != NULL)
    4712         {
    4713              CComVariant varResult;
    4714              mVirtualBox->m->mComEvHelper.fire(cbD, evDesc, &varResult);
    4715              // what we gonna do with the result?
    4716         }
    4717      }
    4718     }
    4719 #endif
    47204379
    47214380    {
     
    47244383
    47254384        evDesc.fire(/* don't wait for delivery */0);
    4726     }
    4727 
    4728     for (CallbackList::const_iterator it = callbacks.begin();
    4729          it != callbacks.end();
    4730          ++it)
    4731     {
    4732         if (it->isWanted(mWhat))
    4733         {
    4734             HRESULT hrc = handleCallback(it->ptrICb);
    4735             if (hrc == VBOX_E_DONT_CALL_AGAIN)
    4736             {
    4737                 /* Have to update the original. */
    4738                 AutoReadLock alock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
    4739                 CallbackList::iterator itOrg;
    4740                 itOrg = std::find(mVirtualBox->m->llCallbacks.begin(),
    4741                                   mVirtualBox->m->llCallbacks.end(),
    4742                                   CallbackList::value_type(it->ptrICb));
    4743                 if (itOrg != mVirtualBox->m->llCallbacks.end())
    4744                     itOrg->setDontCallAgain(mWhat);
    4745             }
    4746             else if (FAILED_DEAD_INTERFACE(hrc))
    4747                 mVirtualBox->removeDeadCallback(it->ptrICb);
    4748         }
    47494385    }
    47504386
  • trunk/src/VBox/Main/glue/tests/TestVBox.java

    r30591 r30825  
    1616import java.math.BigInteger;
    1717
    18 class VBoxCallbacks extends VBoxObjectBase implements IVirtualBoxCallback
    19 {
    20     public void onGuestPropertyChange(String machineId, String name, String value, String flags)
    21     {
    22         System.out.println("onGuestPropertyChange -- VM: " + machineId + ", " + name + "->" + value);
    23     }
    24     public void onSnapshotChange(String machineId, String snapshotId)
    25     {
    26         System.out.println("onSnapshotChange -- VM: " + machineId + ", snap: " + snapshotId);
    27 
    28     }
    29     public void onSnapshotDeleted(String machineId, String snapshotId)
    30     {
    31         System.out.println("onSnapshotDeleted -- VM: " + machineId + ", snap: " + snapshotId);
    32     }
    33     public void onSnapshotTaken(String machineId, String snapshotId)
    34     {
    35         System.out.println("onSnapshotTaken -- VM: " + machineId + ", snap: " + snapshotId);
    36     }
    37     public void onSessionStateChange(String machineId, SessionState state)
    38     {
    39         System.out.println("onSessionStateChange -- VM: " + machineId + ", state: " + state);
    40     }
    41     public void onMachineRegistered(String machineId, Boolean registered)
    42     {
    43         System.out.println("onMachineRegistered -- VM: " + machineId + ", registered: " + registered);
    44     }
    45     public void onMediumRegistered(String mediumId, DeviceType mediumType, Boolean registered)
    46     {
    47         System.out.println("onMediumRegistered -- ID: " + mediumId + ", type=" + mediumType + ", registered: " + registered);
    48     }
    49     public void onExtraDataChange(String machineId, String key, String value)
    50     {
    51         System.out.println("onExtraDataChange -- VM: " + machineId + ": " + key+"->"+value);
    52     }
    53     public Boolean onExtraDataCanChange(String machineId, String key, String value, Holder<String> error)
    54     {
    55         return true;
    56     }
    57     public void onMachineDataChange(String machineId)
    58     {
    59         System.out.println("onMachineDataChange -- VM: " + machineId);
    60     }
    61     public void onMachineStateChange(String machineId, MachineState state)
    62     {
    63         System.out.println("onMachineStateChange -- VM: " + machineId + ", state: " + state);
    64     }
    65 }
    66 
    67 class ConsoleCallbacks extends VBoxObjectBase implements IConsoleCallback
    68 {
    69     String mach;
    70     ConsoleCallbacks(String mach)
    71     {
    72        this.mach = mach;
    73     }
    74     public void onMousePointerShapeChange(Boolean visible, Boolean alpha, Long xHot, Long yHot, Long width, Long height, List<Short> shape)
    75     {
    76        System.out.println("onMousePointerShapeChange -- VM: " + mach);
    77     }
    78     public void onMouseCapabilityChange(Boolean supportsAbsolute, Boolean supportsRelative, Boolean needsHostCursor)
    79     {
    80        System.out.println("onMouseCapabilityChange -- VM: " + mach+" abs="+supportsAbsolute+ " rel="+supportsRelative+" need host="+needsHostCursor);
    81     }
    82     public void onKeyboardLedsChange(Boolean numLock, Boolean capsLock, Boolean scrollLock)
    83     {
    84        System.out.println("onKeyboardLedsChange -- VM: " + mach);
    85     }
    86     public void onStateChange(org.virtualbox_3_3.MachineState state)
    87     {
    88        System.out.println("onStateChange -- VM: " + mach);
    89     }
    90     public void onAdditionsStateChange()
    91     {
    92        System.out.println("onAdditionsStateChange -- VM: " + mach);
    93     }
    94     public void onNetworkAdapterChange(org.virtualbox_3_3.INetworkAdapter networkAdapter)
    95     {
    96        System.out.println("onNetworkAdapterChange -- VM: " + mach);
    97     }
    98     public void onSerialPortChange(org.virtualbox_3_3.ISerialPort serialPort)
    99     {
    100        System.out.println("onSerialPortChange -- VM: " + mach);
    101     }
    102     public void onParallelPortChange(org.virtualbox_3_3.IParallelPort parallelPort)
    103     {
    104        System.out.println("onParallelPortChange -- VM: " + mach);
    105     }
    106     public void onStorageControllerChange()
    107     {
    108        System.out.println("onStorageControllerChange -- VM: " + mach);
    109     }
    110     public void onMediumChange(org.virtualbox_3_3.IMediumAttachment mediumAttachment)
    111     {
    112        System.out.println("onMediumChange -- VM: " + mach);
    113     }
    114     public void onCPUChange(Long cpu, Boolean add)
    115     {
    116        System.out.println("onCPUChange -- VM: " + mach);
    117     }
    118     public void onVRDPServerChange()
    119     {
    120        System.out.println("onVRDPServerChange -- VM: " + mach);
    121     }
    122     public void onRemoteDisplayInfoChange()
    123     {
    124        System.out.println("onRemoteDisplayInfoChange -- VM: " + mach);
    125     }
    126     public void onUSBControllerChange()
    127     {
    128        System.out.println("onUSBControllerChange -- VM: " + mach);
    129     }
    130     public void onUSBDeviceStateChange(org.virtualbox_3_3.IUSBDevice device, Boolean attached, org.virtualbox_3_3.IVirtualBoxErrorInfo error)
    131     {
    132        System.out.println("onUSBDeviceStateChange -- VM: " + mach);
    133     }
    134     public void onSharedFolderChange(org.virtualbox_3_3.Scope scope)
    135     {
    136        System.out.println("onSharedFolderChange -- VM: " + mach);
    137     }
    138 
    139     public void onRuntimeError(Boolean fatal, String id, String message)
    140     {
    141        System.out.println("onRuntimeError -- VM: " + mach);
    142     }
    143 
    144     public Boolean onCanShowWindow()
    145     {
    146        System.out.println("onCanShowWindow -- VM: " + mach);
    147        return true;
    148     }
    149 
    150     public BigInteger onShowWindow()
    151     {
    152        System.out.println("onShowWindow -- VM: " + mach);
    153        return BigInteger.ZERO;
    154     }
    155 }
    156 
    15718public class TestVBox
    15819{
    159     static void testCallbacks(VirtualBoxManager mgr, IVirtualBox vbox)
    160     {
    161 
    162         IVirtualBoxCallback cbs = new VBoxCallbacks();
    163         mgr.registerGlobalCallback(vbox, cbs);
    164 
    165         IMachine mach = vbox.getMachines().get(0);
    166         IConsoleCallback mcbs = new ConsoleCallbacks(mach.getName());
    167 
    168         ISession session = null;
    169         try {
    170           session = mgr.openMachineSession(mach);
    171           mgr.registerMachineCallback(session, mcbs);
    172 
    173           for (int i=0; i<100; i++)
    174           {
    175             mgr.waitForEvents(500);
    176           }
    177 
    178           System.out.println("done waiting");
    179 
    180           mgr.unregisterMachineCallback(session, mcbs);
    181         } catch (Exception e) {
    182           e.printStackTrace();
    183         } finally {
    184           mgr.closeMachineSession(session);
    185         }
    186         mgr.unregisterGlobalCallback(vbox, cbs);
    187     }
    188 
    189 
    19020    static void processEvent(IEvent ev)
    19121    {
     
    19828        {
    19929            case OnMachineStateChange:
    200                 IMachineStateChangeEvent mcse = IMachineStateChangeEvent.queryInterface(ev);
     30                IMachineStateChangedEvent mcse = IMachineStateChangedEvent.queryInterface(ev);
    20131                if (mcse == null)
    20232                    System.out.println("Cannot query an interface");
     
    22353    {
    22454        // active mode for Java doesn't fully work yet, and using passive
    225         // is more portable (the only mode for MSCOM and WS) and thus generally 
     55        // is more portable (the only mode for MSCOM and WS) and thus generally
    22656        // recommended
    22757        IEventListener listener = active ? mgr.createListener(new EventHandler()) : es.createListener();
     
    285115            testEnumeration(mgr, vbox);
    286116            testStart(mgr, vbox);
    287             //testCallbacks(mgr, vbox);
    288117            testEvents(mgr, vbox.getEventSource(), false);
    289118
  • trunk/src/VBox/Main/glue/vboxapi.py

    r30533 r30825  
    217217            win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
    218218            win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox')
    219             win32com.client.gencache.EnsureDispatch('VirtualBox.CallbackWrapper')
    220219
    221220    def getSessionObject(self, vbox):
     
    245244        import pythoncom
    246245        pythoncom.CoUninitialize()
    247 
    248     def createCallback(self, iface, impl, arg):
    249         d = {}
    250         d['BaseClass'] = impl
    251         d['arg'] = arg
    252         d['tlb_guid'] = PlatformMSCOM.VBOX_TLB_GUID
    253         str = ""
    254         str += "import win32com.server.util\n"
    255         str += "import pythoncom\n"
    256 
    257         str += "class "+iface+"Impl(BaseClass):\n"
    258         str += "   _com_interfaces_ = ['"+iface+"']\n"
    259         str += "   _typelib_guid_ = tlb_guid\n"
    260         str += "   _typelib_version_ = 1, 0\n"
    261         str += "   _reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER\n"
    262         # Maybe we'd better implement Dynamic invoke policy, to be more flexible here
    263         str += "   _reg_policy_spec_ = 'win32com.server.policy.EventHandlerPolicy'\n"
    264 
    265         # generate capitalized version of callback methods -
    266         # that's how Python COM looks them up
    267         for m in dir(impl):
    268            if m.startswith("on"):
    269              str += "   "+ComifyName(m)+"=BaseClass."+m+"\n"
    270 
    271         str += "   def __init__(self): BaseClass.__init__(self, arg)\n"
    272         str += "result = win32com.client.Dispatch('VirtualBox.CallbackWrapper')\n"
    273         str += "result.SetLocalObject(win32com.server.util.wrap("+iface+"Impl()))\n"
    274         exec (str,d,d)
    275         return d['result']
    276246
    277247    def createListener(self, impl, arg):
     
    292262        str += "   _reg_policy_spec_ = 'win32com.server.policy.EventHandlerPolicy'\n"
    293263
    294         # capitalized version of callback method
     264        # capitalized version of listener method
    295265        str += "   HandleEvent=BaseClass.handleEvent\n"
    296266        str += "   def __init__(self): BaseClass.__init__(self, arg)\n"
     
    370340        import xpcom
    371341        xpcom._xpcom.DetachThread()
    372 
    373     def createCallback(self, iface, impl, arg):
    374         d = {}
    375         d['BaseClass'] = impl
    376         d['arg'] = arg
    377         str = ""
    378         str += "import xpcom.components\n"
    379         str += "class "+iface+"Impl(BaseClass):\n"
    380         str += "   _com_interfaces_ = xpcom.components.interfaces."+iface+"\n"
    381         str += "   def __init__(self): BaseClass.__init__(self, arg)\n"
    382         str += "result = xpcom.components.classes['@virtualbox.org/CallbackWrapper;1'].createInstance()\n"
    383         str += "result.setLocalObject("+iface+"Impl())\n"
    384         exec (str,d,d)
    385         return d['result']
    386342
    387343    def createListener(self, impl, arg):
     
    478434        pass
    479435
    480     def createCallback(self, iface, impl, arg):
    481         raise Exception("no callbacks for webservices")
    482 
    483436    def createListener(self, impl, arg):
    484437        raise Exception("no active listeners for webservices")
     
    581534        self.platform.deinitPerThread()
    582535
    583     def createCallback(self, iface, impl, arg):
    584         return self.platform.createCallback(iface, impl, arg)
    585 
    586536    def createListener(self, impl, arg = None):
    587537        return self.platform.createListener(impl, arg)
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r30714 r30825  
    372372  </result>
    373373
    374   <result name="VBOX_E_DONT_CALL_AGAIN" value="0x80BB000D">
    375     <desc>
    376       Returned by callback methods which does not need to be called again
    377       because the client does not actually make use of them.
    378     </desc>
    379   </result>
    380 
    381374  <!--
    382375    Note that src/VBox/Runtime/common/err/errmsgvboxcom.xsl will ignore
     
    12051198  </interface>
    12061199
    1207   <interface
    1208      name="ILocalOwner" extends="$unknown"
    1209      uuid="308FF42A-DC45-49D4-A950-B1EEE5E00BB5" wsmap="suppress"
    1210      >
    1211     <desc>
    1212       The ILocalOwner interface allows to register local objects
    1213       (created without COM calls, but with new()).
    1214       Once registered, calls to methods of such objects can be made
    1215       from remote COM processes.
    1216       The main usecase is the event callback implementation where
    1217       API clients provide callback objects.
    1218     </desc>
    1219     <method name="setLocalObject">
    1220       <desc>
    1221         Set local object.
    1222       </desc>
    1223       <param name="object" type="$unknown" dir="in">
    1224         <desc>Local object to forward requests to.
    1225           If null, clears currently set local object.</desc>
    1226       </param>
    1227     </method>
    1228   </interface>
    1229 
    12301200  <!--
    12311201  // IVirtualBox
    12321202  /////////////////////////////////////////////////////////////////////////
    12331203  -->
    1234 
    1235   <interface
    1236      name="IVirtualBoxCallback" extends="$unknown"
    1237      uuid="7f6a65b6-ad5d-4a67-8872-0b11cb7ea95c"
    1238      wsmap="suppress"
    1239      >
    1240 
    1241     <method name="onMachineStateChange">
    1242       <desc>
    1243         The execution state of the given machine has changed.
    1244         <see>IMachine::state</see>
    1245         <result name="VBOX_E_DONT_CALL_AGAIN">
    1246           Do not call again, this method is a NOP.
    1247         </result>
    1248       </desc>
    1249       <param name="machineId" type="uuid" mod="string" dir="in">
    1250         <desc>ID of the machine this event relates to.</desc>
    1251       </param>
    1252       <param name="state" type="MachineState" dir="in">
    1253         <desc>New execution state.</desc>
    1254       </param>
    1255     </method>
    1256 
    1257     <method name="onMachineDataChange">
    1258       <desc>
    1259         Any of the settings of the given machine has changed.
    1260         <result name="VBOX_E_DONT_CALL_AGAIN">
    1261           Do not call again, this method is a NOP.
    1262         </result>
    1263       </desc>
    1264       <param name="machineId" type="uuid" mod="string" dir="in">
    1265         <desc>ID of the machine this event relates to.</desc>
    1266       </param>
    1267     </method>
    1268 
    1269     <method name="onExtraDataCanChange">
    1270       <desc>
    1271         Notification when someone tries to change extra data for
    1272         either the given machine or (if @c null) global extra data.
    1273         This gives the chance to veto against changes.
    1274         <result name="VBOX_E_DONT_CALL_AGAIN">
    1275           Do not call again, this method is a NOP. Change is allowed.
    1276         </result>
    1277       </desc>
    1278       <param name="machineId" type="uuid" mod="string" dir="in">
    1279         <desc>
    1280           ID of the machine this event relates to
    1281           (@c null ID for global extra data change requests).
    1282         </desc>
    1283       </param>
    1284       <param name="key" type="wstring" dir="in">
    1285         <desc>
    1286           Extra data key for the attempted write.
    1287         </desc>
    1288       </param>
    1289       <param name="value" type="wstring" dir="in">
    1290         <desc>
    1291           Extra data value for the given key.
    1292         </desc>
    1293       </param>
    1294       <param name="error" type="wstring" dir="out">
    1295         <desc>
    1296           Optional error message describing the reason of the
    1297           veto (ignored if this notification returns @c true).
    1298         </desc>
    1299       </param>
    1300       <param name="allowChange" type="boolean" dir="return">
    1301         <desc>
    1302           Flag to indicate whether the callee agrees (@c true)
    1303           or vetoes against the change (@c false).
    1304         </desc>
    1305       </param>
    1306     </method>
    1307 
    1308     <method name="onExtraDataChange">
    1309       <desc>
    1310         Notification when machine specific or global extra data
    1311         has changed.
    1312         <result name="VBOX_E_DONT_CALL_AGAIN">
    1313           Do not call again, this method is a NOP.
    1314         </result>
    1315       </desc>
    1316       <param name="machineId" type="uuid" mod="string" dir="in">
    1317         <desc>
    1318           ID of the machine this event relates to.
    1319           Null for global extra data changes.
    1320         </desc>
    1321       </param>
    1322       <param name="key" type="wstring" dir="in">
    1323         <desc>
    1324           Extra data key that has changed.
    1325         </desc>
    1326       </param>
    1327       <param name="value" type="wstring" dir="in">
    1328         <desc>
    1329           Extra data value for the given key.
    1330         </desc>
    1331       </param>
    1332     </method>
    1333 
    1334     <method name="onMediumRegistered">
    1335       <desc>
    1336         The given medium was registered or unregistered
    1337         within this VirtualBox installation.
    1338 
    1339         The @a mediumType parameter describes what type of
    1340         medium the specified @a mediumId refers to. Possible
    1341         values are:
    1342 
    1343         <ul>
    1344         <li><link to="DeviceType_HardDisk"/>: the medium is a hard disk
    1345         that, if registered, can be obtained using the
    1346         <link to="IVirtualBox::getHardDisk"/> call.</li>
    1347         <li><link to="DeviceType_DVD"/>: the medium is a CD/DVD image
    1348         that, if registered, can be obtained using the
    1349         <link to="IVirtualBox::getDVDImage"/> call.</li>
    1350         <li><link to="DeviceType_Floppy"/>: the medium is a Floppy image
    1351         that, if registered, can be obtained using the
    1352         <link to="IVirtualBox::getFloppyImage"/> call.</li>
    1353         </ul>
    1354 
    1355         Note that if this is a deregistration notification,
    1356         there is no way to access the object representing the
    1357         unregistered medium. It is supposed that the
    1358         application will do required cleanup based on the
    1359         @a mediumId value.
    1360 
    1361         <result name="VBOX_E_DONT_CALL_AGAIN">
    1362           Do not call again, this method is a NOP.
    1363         </result>
    1364       </desc>
    1365       <param name="mediumId" type="uuid" mod="string" dir="in">
    1366         <desc>ID of the medium this event relates to.</desc>
    1367       </param>
    1368       <param name="mediumType" type="DeviceType" dir="in">
    1369         <desc>Type of the medium this event relates to.</desc>
    1370       </param>
    1371       <param name="registered" type="boolean" dir="in">
    1372         <desc>
    1373           If @c true, the medium was registered, otherwise it was
    1374           unregistered.
    1375         </desc>
    1376       </param>
    1377     </method>
    1378 
    1379     <method name="onMachineRegistered">
    1380       <desc>
    1381         The given machine was registered or unregistered
    1382         within this VirtualBox installation.
    1383         <result name="VBOX_E_DONT_CALL_AGAIN">
    1384           Do not call again, this method is a NOP.
    1385         </result>
    1386       </desc>
    1387       <param name="machineId" type="uuid" mod="string" dir="in">
    1388         <desc>ID of the machine this event relates to.</desc>
    1389       </param>
    1390       <param name="registered" type="boolean" dir="in">
    1391         <desc>
    1392           If @c true, the machine was registered, otherwise it was
    1393           unregistered.
    1394         </desc>
    1395       </param>
    1396     </method>
    1397 
    1398     <method name="onSessionStateChange">
    1399       <desc>
    1400         The state of the session for the given machine was changed.
    1401         <see>IMachine::sessionState</see>
    1402         <result name="VBOX_E_DONT_CALL_AGAIN">
    1403           Do not call again, this method is a NOP.
    1404         </result>
    1405       </desc>
    1406       <param name="machineId" type="uuid" mod="string" dir="in">
    1407         <desc>ID of the machine this event relates to.</desc>
    1408       </param>
    1409       <param name="state" type="SessionState" dir="in">
    1410         <desc>New session state.</desc>
    1411       </param>
    1412     </method>
    1413 
    1414     <method name="onSnapshotTaken">
    1415       <desc>
    1416         A new snapshot of the machine has been taken.
    1417         <see>ISnapshot</see>
    1418         <result name="VBOX_E_DONT_CALL_AGAIN">
    1419           Do not call again, this method is a NOP.
    1420         </result>
    1421       </desc>
    1422       <param name="machineId" type="uuid" mod="string" dir="in">
    1423         <desc>ID of the machine this event relates to.</desc>
    1424       </param>
    1425       <param name="snapshotId" type="uuid" mod="string" dir="in">
    1426         <desc>ID of the new snapshot.</desc>
    1427       </param>
    1428     </method>
    1429 
    1430     <method name="onSnapshotDeleted">
    1431       <desc>
    1432         Snapshot of the given machine has been deleted.
    1433 
    1434         <note>
    1435           This notification is delivered <b>after</b> the snapshot
    1436           object has been uninitialized on the server (so that any
    1437           attempt to call its methods will return an error).
    1438         </note>
    1439 
    1440         <see>ISnapshot</see>
    1441 
    1442         <result name="VBOX_E_DONT_CALL_AGAIN">
    1443           Do not call again, this method is a NOP.
    1444         </result>
    1445       </desc>
    1446       <param name="machineId" type="uuid" mod="string" dir="in">
    1447         <desc>ID of the machine this event relates to.</desc>
    1448       </param>
    1449       <param name="snapshotId" type="uuid" mod="string" dir="in">
    1450         <desc>
    1451           ID of the deleted snapshot. @c null means the current machine
    1452           state has been deleted (restored from the current snapshot).
    1453         </desc>
    1454       </param>
    1455     </method>
    1456 
    1457     <method name="onSnapshotChange">
    1458       <desc>
    1459         Snapshot properties (name and/or description) have been changed.
    1460         <see>ISnapshot</see>
    1461         <result name="VBOX_E_DONT_CALL_AGAIN">
    1462           Do not call again, this method is a NOP.
    1463         </result>
    1464       </desc>
    1465       <param name="machineId" type="uuid" mod="string" dir="in">
    1466         <desc>ID of the machine this event relates to.</desc>
    1467       </param>
    1468       <param name="snapshotId" type="uuid" mod="string" dir="in">
    1469         <desc>ID of the changed snapshot.</desc>
    1470       </param>
    1471     </method>
    1472 
    1473     <method name="onGuestPropertyChange">
    1474       <desc>
    1475         Notification when a guest property has changed.
    1476         <result name="VBOX_E_DONT_CALL_AGAIN">
    1477           Do not call again, this method is a NOP.
    1478         </result>
    1479       </desc>
    1480       <param name="machineId" type="uuid" mod="string" dir="in">
    1481         <desc>
    1482           ID of the machine this event relates to.
    1483         </desc>
    1484       </param>
    1485       <param name="name" type="wstring" dir="in">
    1486         <desc>
    1487           The name of the property that has changed.
    1488         </desc>
    1489       </param>
    1490       <param name="value" type="wstring" dir="in">
    1491         <desc>
    1492           The new property value.
    1493         </desc>
    1494       </param>
    1495       <param name="flags" type="wstring" dir="in">
    1496         <desc>
    1497           The new property flags.
    1498         </desc>
    1499       </param>
    1500     </method>
    1501 
    1502   </interface>
    15031204
    15041205  <interface
     
    19591660        <link to="#openMachine"/> within this VirtualBox installation. After
    19601661        successful method invocation, the
    1961         <link to="IVirtualBoxCallback::onMachineRegistered"/> signal is sent
    1962         to all registered callbacks.
     1662        <link to="IMachineRegisteredEvent"/> event is fired.
    19631663
    19641664        <note>
     
    20131713        Unregisters the machine previously registered using
    20141714        <link to="#registerMachine"/>. After successful method invocation, the
    2015         <link to="IVirtualBoxCallback::onMachineRegistered"/> signal is sent
    2016         to all registered callbacks.
     1715        <link to="IMachineRegisteredEvent"/> event is fired.
    20171716
    20181717        <note>
     
    25712270        <note>
    25722271          Before performing the actual data change, this method will ask all
    2573           registered callbacks using the
    2574           <link to="IVirtualBoxCallback::onExtraDataCanChange"/>
    2575           notification for a permission. If one of the callbacks refuses the
     2272          registered event listener using the
     2273          <link to="IExtraDataCanChangeEvent"/>
     2274          notification for a permission. If one of the listeners refuses the
    25762275          new value, the change will not be performed.
    25772276        </note>
    25782277        <note>
    25792278          On success, the
    2580           <link to="IVirtualBoxCallback::onExtraDataChange"/> notification
    2581           is called to inform all registered callbacks about a successful data
     2279          <link to="IExtraDataChanged"/> notification
     2280          is called to inform all registered listeners about a successful data
    25822281          change.
    25832282        </note>
     
    28542553      <param name="machineId" type="uuid" mod="string" dir="in">
    28552554        <desc>ID of the virtual machine to open a session with.</desc>
    2856       </param>
    2857     </method>
    2858 
    2859     <method name="registerCallback">
    2860       <desc>
    2861         Registers a new global VirtualBox callback. The methods of the given
    2862         callback object will be called by VirtualBox when an appropriate
    2863         event occurs.
    2864 
    2865         <result name="E_INVALIDARG">
    2866           A @c null callback cannot be registered.
    2867         </result>
    2868 
    2869       </desc>
    2870       <param name="callback" type="IVirtualBoxCallback" dir="in">
    2871         <desc>Callback object to register.</desc>
    2872       </param>
    2873     </method>
    2874 
    2875     <method name="unregisterCallback">
    2876       <desc>
    2877         Unregisters the previously registered global VirtualBox callback.
    2878 
    2879         <result name="E_INVALIDARG">
    2880           Specified @a callback not registered.
    2881         </result>
    2882 
    2883       </desc>
    2884       <param name="callback" type="IVirtualBoxCallback" dir="in">
    2885         <desc>Callback object to unregister.</desc>
    28862555      </param>
    28872556    </method>
     
    47254394        A comma-separated list of simple glob patterns.  Changes to guest
    47264395        properties whose name matches one of the patterns will generate an
    4727         <link to="IVirtualBoxCallback::onGuestPropertyChange"/> signal.
     4396        <link to="IGuestPropertyChangedEvent"/> signal.
    47284397      </desc>
    47294398    </attribute>
     
    52894958        <note>
    52904959          Before performing the actual data change, this method will ask all
    5291           registered callbacks using the
    5292           <link to="IVirtualBoxCallback::onExtraDataCanChange"/>
    5293           notification for a permission. If one of the callbacks refuses the
     4960          registered listeners using the
     4961          <link to="IExtraDataCanChangeEvent"/>
     4962          notification for a permission. If one of the listeners refuses the
    52944963          new value, the change will not be performed.
    52954964        </note>
    52964965        <note>
    52974966          On success, the
    5298           <link to="IVirtualBoxCallback::onExtraDataChange"/> notification
    5299           is called to inform all registered callbacks about a successful data
     4967          <link to="IExtraDataChangedEvent"/> notification
     4968          is called to inform all registered listeners about a successful data
    53004969          change.
    53014970        </note>
     
    55255194        method.
    55265195        <note>
    5527           The method sends <link to="IVirtualBoxCallback::onMachineDataChange"/>
     5196          The method sends <link to="IMachineDataChangedEvent"/>
    55285197          notification event after the configuration has been successfully
    55295198          saved (only for registered machines).
     
    61555824
    61565825  <interface
    6157      name="IConsoleCallback" extends="$unknown"
    6158      uuid="60703f8d-81e4-4b45-a147-dcfd07692b19"
    6159      wsmap="suppress"
    6160      >
    6161 
    6162     <desc>
    6163         This interface is used by a client of the Main API that need to
    6164         be notified of events. For example, a graphical user interface
    6165         can use this to learn about machine state changes so they can
    6166         update the list of virtual machines without having to rely
    6167         on polling.
    6168 
    6169         Whenever relevant events occur in VirtualBox, the callbacks in
    6170         objects of this interface are called. In order for this to be
    6171         useful, a client needs to create its own subclass that implements
    6172         this interface in which the methods for the relevant callbacks
    6173         are overridden. An instance of this subclass interface can then
    6174         be passed to <link to="IConsole::registerCallback" />.
    6175     </desc>
    6176 
    6177     <method name="onMousePointerShapeChange">
    6178       <desc>
    6179         Notification when the guest mouse pointer shape has
    6180         changed. The new shape data is given.
    6181         <result name="VBOX_E_DONT_CALL_AGAIN">
    6182           Do not call again, this method is a NOP.
    6183         </result>
    6184       </desc>
    6185       <param name="visible" type="boolean" dir="in">
    6186         <desc>
    6187           Flag whether the pointer is visible.
    6188         </desc>
    6189       </param>
    6190       <param name="alpha" type="boolean" dir="in">
    6191         <desc>
    6192           Flag whether the pointer has an alpha channel.
    6193         </desc>
    6194       </param>
    6195       <param name="xHot" type="unsigned long" dir="in">
    6196         <desc>
    6197           The pointer hot spot x coordinate.
    6198         </desc>
    6199       </param>
    6200       <param name="yHot" type="unsigned long" dir="in">
    6201         <desc>
    6202           The pointer hot spot y coordinate.
    6203         </desc>
    6204       </param>
    6205       <param name="width" type="unsigned long" dir="in">
    6206         <desc>
    6207           Width of the pointer shape in pixels.
    6208         </desc>
    6209       </param>
    6210       <param name="height" type="unsigned long" dir="in">
    6211         <desc>
    6212           Height of the pointer shape in pixels.
    6213         </desc>
    6214       </param>
    6215       <param name="shape" type="octet" safearray="yes" dir="in">
    6216         <desc>
    6217           Shape buffer arrays.
    6218 
    6219           The @a shape buffer contains a 1-bpp (bits per pixel) AND mask
    6220           followed by a 32-bpp XOR (color) mask.
    6221 
    6222           For pointers without alpha channel the XOR mask pixels are 32
    6223           bit values: (lsb)BGR0(msb). For pointers with alpha channel
    6224           the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
    6225 
    6226           An AND mask is used for pointers with alpha channel, so if the
    6227           callback does not support alpha, the pointer could be
    6228           displayed as a normal color pointer.
    6229 
    6230           The AND mask is a 1-bpp bitmap with byte aligned scanlines. The
    6231           size of the AND mask therefore is <tt>cbAnd = (width + 7) / 8 *
    6232           height</tt>. The padding bits at the end of each scanline are
    6233           undefined.
    6234 
    6235           The XOR mask follows the AND mask on the next 4-byte aligned
    6236           offset: <tt>uint8_t *pXor = pAnd + (cbAnd + 3) &amp; ~3</tt>.
    6237           Bytes in the gap between the AND and the XOR mask are undefined.
    6238           The XOR mask scanlines have no gap between them and the size of
    6239           the XOR mask is: <tt>cXor = width * 4 * height</tt>.
    6240 
    6241           <note>
    6242             If @a shape is 0, only the pointer visibility is changed.
    6243           </note>
    6244         </desc>
    6245       </param>
    6246     </method>
    6247 
    6248     <method name="onMouseCapabilityChange">
    6249       <desc>
    6250         Notification when the mouse capabilities reported by the
    6251         guest have changed. The new capabilities are passed.
    6252         <result name="VBOX_E_DONT_CALL_AGAIN">
    6253           Do not call again, this method is a NOP.
    6254         </result>
    6255       </desc>
    6256       <param name="supportsAbsolute" type="boolean" dir="in"/>
    6257       <param name="supportsRelative" type="boolean" dir="in"/>
    6258       <param name="needsHostCursor" type="boolean" dir="in"/>
    6259     </method>
    6260 
    6261     <method name="onKeyboardLedsChange">
    6262       <desc>
    6263         Notification when the guest OS executes the KBD_CMD_SET_LEDS command
    6264         to alter the state of the keyboard LEDs.
    6265         <result name="VBOX_E_DONT_CALL_AGAIN">
    6266           Do not call again, this method is a NOP.
    6267         </result>
    6268       </desc>
    6269       <param name="numLock" type="boolean" dir="in"/>
    6270       <param name="capsLock" type="boolean" dir="in"/>
    6271       <param name="scrollLock" type="boolean" dir="in"/>
    6272     </method>
    6273 
    6274     <method name="onStateChange">
    6275       <desc>
    6276         Notification when the execution state of the machine has changed.
    6277         The new state will be given.
    6278         <result name="VBOX_E_DONT_CALL_AGAIN">
    6279           Do not call again, this method is a NOP.
    6280         </result>
    6281       </desc>
    6282       <param name="state" type="MachineState" dir="in"/>
    6283     </method>
    6284 
    6285     <method name="onAdditionsStateChange">
    6286       <desc>
    6287         Notification when a Guest Additions property changes.
    6288         Interested callees should query IGuest attributes to
    6289         find out what has changed.
    6290       </desc>
    6291     </method>
    6292 
    6293     <method name="onNetworkAdapterChange">
    6294       <desc>
    6295         Notification when a property of one of the
    6296         virtual <link to="IMachine::getNetworkAdapter">network adapters</link>
    6297         changes.  Interested callees should use INetworkAdapter methods and
    6298         attributes to find out what has changed.
    6299         <result name="VBOX_E_DONT_CALL_AGAIN">
    6300           Do not call again, this method is a NOP.
    6301         </result>
    6302       </desc>
    6303       <param name="networkAdapter" type="INetworkAdapter" dir="in">
    6304         <desc>Network adapter that is subject to change.</desc>
    6305       </param>
    6306     </method>
    6307 
    6308     <method name="onSerialPortChange">
    6309       <desc>
    6310         Notification when a property of one of the
    6311         virtual <link to="IMachine::getSerialPort">serial ports</link> changes.
    6312         Interested callees should use ISerialPort methods and attributes
    6313         to find out what has changed.
    6314         <result name="VBOX_E_DONT_CALL_AGAIN">
    6315           Do not call again, this method is a NOP.
    6316         </result>
    6317       </desc>
    6318       <param name="serialPort" type="ISerialPort" dir="in">
    6319         <desc>Serial port that is subject to change.</desc>
    6320       </param>
    6321     </method>
    6322 
    6323     <method name="onParallelPortChange">
    6324       <desc>
    6325         Notification when a property of one of the
    6326         virtual <link to="IMachine::getParallelPort">parallel ports</link>
    6327         changes.  Interested callees should use ISerialPort methods and
    6328         attributes to find out what has changed.
    6329         <result name="VBOX_E_DONT_CALL_AGAIN">
    6330           Do not call again, this method is a NOP.
    6331         </result>
    6332       </desc>
    6333       <param name="parallelPort" type="IParallelPort" dir="in">
    6334         <desc>Parallel port that is subject to change.</desc>
    6335       </param>
    6336     </method>
    6337 
    6338     <method name="onStorageControllerChange">
    6339       <desc>
    6340         Notification when a property of one of the
    6341         virtual <link to="IMachine::storageControllers">storage controllers</link>
    6342         changes. Interested callees should query the corresponding collections
    6343         to find out what has changed.
    6344         <result name="VBOX_E_DONT_CALL_AGAIN">
    6345           Do not call again, this method is a NOP.
    6346         </result>
    6347       </desc>
    6348     </method>
    6349 
    6350     <method name="onMediumChange">
    6351       <desc>
    6352         Notification when a
    6353         <link to="IMachine::mediumAttachments">medium attachment</link>
    6354         changes.
    6355         <result name="VBOX_E_DONT_CALL_AGAIN">
    6356           Do not call again, this method is a NOP.
    6357         </result>
    6358       </desc>
    6359       <param name="mediumAttachment" type="IMediumAttachment" dir="in">
    6360         <desc>Medium attachment that is subject to change.</desc>
    6361       </param>
    6362     </method>
    6363 
    6364     <method name="onCPUChange">
    6365       <desc>
    6366         Notification when a CPU changes.
    6367         <result name="VBOX_E_DONT_CALL_AGAIN">
    6368           Do not call again, this method is a NOP.
    6369         </result>
    6370       </desc>
    6371       <param name="cpu" type="unsigned long" dir="in">
    6372         <desc>The CPU which changed</desc>
    6373       </param>
    6374       <param name="add" type="boolean" dir="in">
    6375         <desc>Flag whether the CPU was added or removed</desc>
    6376       </param>
    6377     </method>
    6378 
    6379     <method name="onVRDPServerChange">
    6380       <desc>
    6381         Notification when a property of the
    6382         <link to="IMachine::VRDPServer">VRDP server</link> changes.
    6383         Interested callees should use IVRDPServer methods and attributes to
    6384         find out what has changed.
    6385         <result name="VBOX_E_DONT_CALL_AGAIN">
    6386           Do not call again, this method is a NOP.
    6387         </result>
    6388       </desc>
    6389     </method>
    6390 
    6391     <method name="onRemoteDisplayInfoChange">
    6392       <desc>
    6393         Notification when the status of the VRDP server changes. Interested callees
    6394         should use <link to="IConsole::RemoteDisplayInfo">IRemoteDisplayInfo</link>
    6395         attributes to find out what is the current status.
    6396         <result name="VBOX_E_DONT_CALL_AGAIN">
    6397           Do not call again, this method is a NOP.
    6398         </result>
    6399       </desc>
    6400     </method>
    6401 
    6402     <method name="onUSBControllerChange">
    6403       <desc>
    6404         Notification when a property of the virtual
    6405         <link to="IMachine::USBController">USB controller</link> changes.
    6406         Interested callees should use IUSBController methods and attributes to
    6407         find out what has changed.
    6408         <result name="VBOX_E_DONT_CALL_AGAIN">
    6409           Do not call again, this method is a NOP.
    6410         </result>
    6411       </desc>
    6412     </method>
    6413 
    6414     <method name="onUSBDeviceStateChange">
    6415       <desc>
    6416         Notification when a USB device is attached to or detached from
    6417         the virtual USB controller.
    6418 
    6419         This notification is sent as a result of the indirect
    6420         request to attach the device because it matches one of the
    6421         machine USB filters, or as a result of the direct request
    6422         issued by <link to="IConsole::attachUSBDevice"/> or
    6423         <link to="IConsole::detachUSBDevice"/>.
    6424         This notification is sent in case of both a succeeded and a
    6425         failed request completion. When the request succeeds, the
    6426         @a error parameter is @c null, and the given device has been
    6427         already added to (when @a attached is @c true) or removed from
    6428         (when @a attached is @c false) the collection represented by
    6429         <link to="IConsole::USBDevices"/>. On failure, the collection
    6430         doesn't change and the @a error parameter represents the error
    6431         message describing the failure.
    6432 
    6433         <result name="VBOX_E_DONT_CALL_AGAIN">
    6434           Do not call again, this method is a NOP.
    6435         </result>
    6436       </desc>
    6437       <param name="device" type="IUSBDevice" dir="in">
    6438         <desc>Device that is subject to state change.</desc>
    6439       </param>
    6440       <param name="attached" type="boolean" dir="in">
    6441         <desc>
    6442           @c true if the device was attached and @c false otherwise.
    6443         </desc>
    6444       </param>
    6445       <param name="error" type="IVirtualBoxErrorInfo" dir="in">
    6446         <desc>
    6447           @c null on success or an error message object on failure.
    6448         </desc>
    6449       </param>
    6450     </method>
    6451 
    6452     <method name="onSharedFolderChange">
    6453       <desc>
    6454         Notification when a shared folder is added or removed.
    6455         The @a scope argument defines one of three scopes:
    6456         <link to="IVirtualBox::sharedFolders">global shared folders</link>
    6457         (<link to="Scope_Global">Global</link>),
    6458         <link to="IMachine::sharedFolders">permanent shared folders</link> of
    6459         the machine (<link to="Scope_Machine">Machine</link>) or <link
    6460         to="IConsole::sharedFolders">transient shared folders</link> of the
    6461         machine (<link to="Scope_Session">Session</link>). Interested callees
    6462         should use query the corresponding collections to find out what has
    6463         changed.
    6464         <result name="VBOX_E_DONT_CALL_AGAIN">
    6465           Do not call again, this method is a NOP.
    6466         </result>
    6467       </desc>
    6468       <param name="scope" type="Scope" dir="in">
    6469         <desc>Scope of the notification.</desc>
    6470       </param>
    6471     </method>
    6472 
    6473     <method name="onRuntimeError">
    6474       <desc>
    6475         Notification when an error happens during the virtual
    6476         machine execution.
    6477 
    6478         There are three kinds of runtime errors:
    6479         <ul>
    6480           <li><i>fatal</i></li>
    6481           <li><i>non-fatal with retry</i></li>
    6482           <li><i>non-fatal warnings</i></li>
    6483         </ul>
    6484 
    6485         <b>Fatal</b> errors are indicated by the @a fatal parameter set
    6486         to @c true. In case of fatal errors, the virtual machine
    6487         execution is always paused before calling this notification, and
    6488         the notification handler is supposed either to immediately save
    6489         the virtual machine state using <link to="IConsole::saveState"/>
    6490         or power it off using <link to="IConsole::powerDown"/>.
    6491         Resuming the execution can lead to unpredictable results.
    6492 
    6493         <b>Non-fatal</b> errors and warnings are indicated by the
    6494         @a fatal parameter set to @c false. If the virtual machine
    6495         is in the Paused state by the time the error notification is
    6496         received, it means that the user can <i>try to resume</i> the machine
    6497         execution after attempting to solve the problem that caused the
    6498         error. In this case, the notification handler is supposed
    6499         to show an appropriate message to the user (depending on the
    6500         value of the @a id parameter) that offers several actions such
    6501         as <i>Retry</i>, <i>Save</i> or <i>Power Off</i>. If the user
    6502         wants to retry, the notification handler should continue
    6503         the machine execution using the <link to="IConsole::resume"/>
    6504         call. If the machine execution is not Paused during this
    6505         notification, then it means this notification is a <i>warning</i>
    6506         (for example, about a fatal condition that can happen very soon);
    6507         no immediate action is required from the user, the machine
    6508         continues its normal execution.
    6509 
    6510         Note that in either case the notification handler
    6511         <b>must not</b> perform any action directly on a thread
    6512         where this notification is called. Everything it is allowed to
    6513         do is to post a message to another thread that will then talk
    6514         to the user and take the corresponding action.
    6515 
    6516         Currently, the following error identifiers are known:
    6517         <ul>
    6518           <li><tt>"HostMemoryLow"</tt></li>
    6519           <li><tt>"HostAudioNotResponding"</tt></li>
    6520           <li><tt>"VDIStorageFull"</tt></li>
    6521           <li><tt>"3DSupportIncompatibleAdditions"</tt></li>
    6522         </ul>
    6523 
    6524         <note>
    6525           This notification is not designed to be implemented by
    6526           more than one callback at a time. If you have multiple
    6527           IConsoleCallback instances registered on the given
    6528           IConsole object, make sure you simply do nothing but
    6529           return @c S_OK from all but one of them that does actual
    6530           user notification and performs necessary actions.
    6531         </note>
    6532 
    6533         <result name="VBOX_E_DONT_CALL_AGAIN">
    6534           Do not call again, this method is a NOP.
    6535         </result>
    6536       </desc>
    6537       <param name="fatal" type="boolean" dir="in">
    6538         <desc>Whether the error is fatal or not</desc>
    6539       </param>
    6540       <param name="id" type="wstring" dir="in">
    6541         <desc>Error identifier</desc>
    6542       </param>
    6543       <param name="message" type="wstring" dir="in">
    6544         <desc>Optional error message</desc>
    6545       </param>
    6546     </method>
    6547 
    6548     <method name="onCanShowWindow">
    6549       <desc>
    6550         Notification when a call to
    6551         <link to="IMachine::canShowConsoleWindow"/> is made by a
    6552         front-end to check if a subsequent call to
    6553         <link to="IMachine::showConsoleWindow"/> can succeed.
    6554 
    6555         The callee should give an answer appropriate to the current
    6556         machine state in the @a canShow argument. This answer must
    6557         remain valid at least until the next
    6558         <link to="IConsole::state">machine state</link> change.
    6559 
    6560         <note>
    6561           This notification is not designed to be implemented by
    6562           more than one callback at a time. If you have multiple
    6563           IConsoleCallback instances registered on the given
    6564           IConsole object, make sure you simply do nothing but
    6565           return @c true and @c S_OK from all but one of them that
    6566           actually manages console window activation.
    6567         </note>
    6568 
    6569         <result name="VBOX_E_DONT_CALL_AGAIN">
    6570           Do not call again, this method is a NOP.
    6571         </result>
    6572       </desc>
    6573       <param name="canShow" type="boolean" dir="return">
    6574         <desc>
    6575           @c true if the console window can be shown and @c false otherwise.
    6576         </desc>
    6577       </param>
    6578     </method>
    6579 
    6580     <method name="onShowWindow">
    6581       <desc>
    6582         Notification when a call to
    6583         <link to="IMachine::showConsoleWindow"/>
    6584         requests the console window to be activated and brought to
    6585         foreground on the desktop of the host PC.
    6586 
    6587         This notification should cause the VM console process to
    6588         perform the requested action as described above. If it is
    6589         impossible to do it at a time of this notification, this
    6590         method should return a failure.
    6591 
    6592         Note that many modern window managers on many platforms
    6593         implement some sort of focus stealing prevention logic, so
    6594         that it may be impossible to activate a window without the
    6595         help of the currently active application (which is supposedly
    6596         an initiator of this notification). In this case, this method
    6597         must return a non-zero identifier that represents the
    6598         top-level window of the VM console process. The caller, if it
    6599         represents a currently active process, is responsible to use
    6600         this identifier (in a platform-dependent manner) to perform
    6601         actual window activation.
    6602 
    6603         This method must set @a winId to zero if it has performed all
    6604         actions necessary to complete the request and the console
    6605         window is now active and in foreground, to indicate that no
    6606         further action is required on the caller's side.
    6607 
    6608         <note>
    6609           This notification is not designed to be implemented by
    6610           more than one callback at a time. If you have multiple
    6611           IConsoleCallback instances registered on the given
    6612           IConsole object, make sure you simply do nothing but
    6613           return @c S_OK from all but one of them that actually
    6614           manages console window activation.
    6615         </note>
    6616 
    6617         <result name="VBOX_E_DONT_CALL_AGAIN">
    6618           Do not call again, this method is a NOP.
    6619         </result>
    6620       </desc>
    6621       <param name="winId" type="unsigned long long" dir="return">
    6622         <desc>
    6623           Platform-dependent identifier of the top-level VM console
    6624           window, or zero if this method has performed all actions
    6625           necessary to implement the <i>show window</i> semantics for
    6626           the given platform and/or this VirtualBox front-end.
    6627         </desc>
    6628       </param>
    6629     </method>
    6630 
    6631   </interface>
    6632 
    6633   <interface
    66345826     name="IRemoteDisplayInfo" extends="$unknown"
    66355827     uuid="b3741084-806f-4c3b-8c42-ebad1a81e45a"
     
    74546646    </method>
    74556647
    7456     <method name="registerCallback">
    7457       <desc>
    7458         Registers a new console callback on this instance. The methods of the
    7459         callback interface will be called by this instance when the appropriate
    7460         event occurs.
    7461       </desc>
    7462       <param name="callback" type="IConsoleCallback" dir="in"/>
    7463     </method>
    7464 
    7465     <method name="unregisterCallback">
    7466       <desc>
    7467         Unregisters the console callback previously registered using
    7468         <link to="#registerCallback"/>.
    7469         <result name="E_INVALIDARG">
    7470           Given @a callback handler is not registered.
    7471         </result>
    7472       </desc>
    7473       <param name="callback" type="IConsoleCallback" dir="in"/>
    7474     </method>
    74756648  </interface>
    74766649
     
    1104210215        or not.
    1104310216        <note>
    11044           You can use the <link to="IConsoleCallback::onMouseCapabilityChange"/>
    11045           callback to be instantly informed about changes of this attribute
     10217          You can use the <link to="IMouseCapabilityChangedEvent"/>
     10218          event to be instantly informed about changes of this attribute
    1104610219          during virtual machine execution.
    1104710220        </note>
     
    1105510228        or not.
    1105610229        <note>
    11057           You can use the <link to="IConsoleCallback::onMouseCapabilityChange"/>
    11058           callback to be instantly informed about changes of this attribute
     10230          You can use the <link to="IMouseCapabilityChangedEvent"/>
     10231          event to be instantly informed about changes of this attribute
    1105910232          during virtual machine execution.
    1106010233        </note>
     
    1106810241        cursor on demand.
    1106910242        <note>
    11070           You can use the <link to="IConsoleCallback::onMouseCapabilityChange"/>
    11071           callback to be instantly informed about changes of this attribute
     10243          You can use the <link to="IMouseCapabilityChangedEvent"/>
     10244          event to be instantly informed about changes of this attribute
    1107210245          during virtual machine execution.
    1107310246        </note>
     
    1344212615        Called by <link to="IMachine::canShowConsoleWindow"/> and by
    1344312616        <link to="IMachine::showConsoleWindow"/> in order to notify
    13444         console callbacks
    13445         <link to="IConsoleCallback::onCanShowWindow"/>
    13446         and <link to="IConsoleCallback::onShowWindow"/>.
     12617        console listeners
     12618        <link to="ICanShowWindowEvent"/>
     12619        and <link to="IShowWindowEvent"/>.
    1344712620
    1344812621        <result name="VBOX_E_INVALID_OBJECT_STATE">
     
    1461813791    <const name="OnMachineStateChange" value="32">
    1461913792      <desc>
    14620         <see>IMachineStateChangeEvent</see>
     13793        <see>IMachineStateChangedEvent</see>
    1462113794      </desc>
    1462213795    </const>
    1462313796    <const name="OnMachineDataChange" value="33">
    1462413797      <desc>
    14625         <see>IMachineDataChangeEvent</see>
     13798        <see>IMachineDataChangedEvent</see>
    1462613799      </desc>
    1462713800    </const>
    1462813801    <const name="OnExtraDataChange" value="34">
    1462913802      <desc>
    14630         <see>IExtraDataChangeEvent</see>
     13803        <see>IExtraDataChangedEvent</see>
    1463113804      </desc>
    1463213805    </const>
     
    1464813821    <const name="OnSessionStateChange" value="38">
    1464913822      <desc>
    14650         <see>ISessionStateChangeEvent</see>
     13823        <see>ISessionStateChangedEvent</see>
    1465113824      </desc>
    1465213825    </const>
     
    1466313836    <const name="OnSnapshotChange" value="41">
    1466413837      <desc>
    14665         <see>ISnapshotChangeEvent</see>
     13838        <see>ISnapshotChangedEvent</see>
    1466613839      </desc>
    1466713840    </const>
    1466813841    <const name="OnGuestPropertyChange" value="42">
    1466913842      <desc>
    14670         <see>IGuestPropertyChangeEvent</see>
     13843        <see>IGuestPropertyChangedEvent</see>
    1467113844      </desc>
    1467213845    </const>
     
    1467413847    <const name="OnMousePointerShapeChange" value="43">
    1467513848      <desc>
    14676         <see>IMousePointerShapeChangeEvent</see>
     13849        <see>IMousePointerShapeChangedEvent</see>
    1467713850      </desc>
    1467813851    </const>
    1467913852    <const name="OnMouseCapabilityChange" value="44">
    1468013853      <desc>
    14681         <see>IMouseCapabilityChangeEvent</see>
     13854        <see>IMouseCapabilityChangedEvent</see>
    1468213855      </desc>
    1468313856    </const>
    1468413857    <const name="OnKeyboardLedsChange" value="45">
    1468513858      <desc>
    14686         <see>IKeyboardLedsChangeEvent</see>
     13859        <see>IKeyboardLedsChangedEvent</see>
    1468713860      </desc>
    1468813861    </const>
    1468913862    <const name="OnStateChange" value="46">
    1469013863      <desc>
    14691         <see>IStateChangeEvent</see>
     13864        <see>IStateChangedEvent</see>
    1469213865      </desc>
    1469313866    </const>
    1469413867    <const name="OnAdditionsStateChange" value="47">
    1469513868      <desc>
    14696         <see>IAdditionsStateChangeEvent</see>
     13869        <see>IAdditionsStateChangedEvent</see>
    1469713870      </desc>
    1469813871    </const>
    1469913872    <const name="OnNetworkAdapterChange" value="48">
    1470013873      <desc>
    14701         <see>INetworkAdapterChangeEvent</see>
     13874        <see>INetworkAdapterChangedEvent</see>
    1470213875      </desc>
    1470313876    </const>
    1470413877    <const name="OnSerialPortChange" value="49">
    1470513878      <desc>
    14706         <see>ISerialPortChangeEvent</see>
     13879        <see>ISerialPortChangedEvent</see>
    1470713880      </desc>
    1470813881    </const>
    1470913882    <const name="OnParallelPortChange" value="50">
    1471013883      <desc>
    14711         <see>IParallelPortChangeEvent</see>
     13884        <see>IParallelPortChangedEvent</see>
    1471213885      </desc>
    1471313886    </const>
    1471413887    <const name="OnStorageControllerChange" value="51">
    1471513888      <desc>
    14716         <see>IStorageControllerChangeEvent</see>
     13889        <see>IStorageControllerChangedEvent</see>
    1471713890      </desc>
    1471813891    </const>
    1471913892    <const name="OnMediumChange" value="52">
    1472013893      <desc>
    14721         <see>IMediumChangeEvent</see>
     13894        <see>IMediumChangedEvent</see>
    1472213895      </desc>
    1472313896    </const>
    1472413897    <const name="OnVRDPServerChange" value="53">
    1472513898      <desc>
    14726         <see>IVRDPServerChangeEvent</see>
     13899        <see>IVRDPServerChangedEvent</see>
    1472713900      </desc>
    1472813901    </const>
    1472913902    <const name="OnUSBControllerChange" value="54">
    1473013903      <desc>
    14731         <see>IUSBControllerChangeEvent</see>
     13904        <see>IUSBControllerChangedEvent</see>
    1473213905      </desc>
    1473313906    </const>
    1473413907    <const name="OnUSBDeviceStateChange" value="55">
    1473513908      <desc>
    14736         <see>IUSBDeviceStateChangeEvent</see>
     13909        <see>IUSBDeviceStateChangedEvent</see>
    1473713910      </desc>
    1473813911    </const>
    1473913912    <const name="OnSharedFolderChange" value="56">
    1474013913      <desc>
    14741         <see>ISharedFolderChangeEvent</see>
     13914        <see>ISharedFolderChangedEvent</see>
    1474213915      </desc>
    1474313916    </const>
     
    1475913932    <const name="OnCPUChange" value="60">
    1476013933      <desc>
    14761         <see>ICPUChangeEvent</see>
     13934        <see>ICPUChangedEvent</see>
    1476213935      </desc>
    1476313936    </const>
    1476413937    <const name="OnRemoteDisplayInfoChange" value="61">
    1476513938      <desc>
    14766         <see>IRemoteDisplayInfoChangeEvent</see>
     13939        <see>IRemoteDisplayInfoChangedEvent</see>
    1476713940      </desc>
    1476813941    </const>
    1476913942    <const name="OnEventSourceChange" value="62">
    1477013943      <desc>
    14771         <see>IEventSourceChangeEvent</see>
     13944        <see>IEventSourceChangedEvent</see>
    1477213945      </desc>
    1477313946    </const>
     
    1497714150
    1497814151  <interface
    14979       name="IMachineStateChangeEvent" extends="IMachineEvent"
     14152      name="IMachineStateChangedEvent" extends="IMachineEvent"
    1498014153      uuid="5748F794-48DF-438D-85EB-98FFD70D18C9"
    1498114154      wsmap="managed" autogen="VBoxEvent" id="OnMachineStateChange"
     
    1498914162
    1499014163  <interface
    14991       name="IMachineDataChangeEvent" extends="IMachineEvent"
     14164      name="IMachineDataChangedEvent" extends="IMachineEvent"
    1499214165      uuid="6AA70A6C-0DCA-4810-8C5C-457B278E3D49"
    1499314166      wsmap="managed" autogen="VBoxEvent" id="OnMachineDataChange"
     
    1501714190
    1501814191  <interface
    15019       name="ISessionStateChangeEvent" extends="IMachineEvent"
     14192      name="ISessionStateChangedEvent" extends="IMachineEvent"
    1502014193      uuid="714a3eef-799a-4489-86cd-fe8e45b2ff8e"
    1502114194      wsmap="managed" autogen="VBoxEvent" id="OnSessionStateChange"
     
    1503414207
    1503514208  <interface
    15036       name="IGuestPropertyChangeEvent" extends="IMachineEvent"
     14209      name="IGuestPropertyChangedEvent" extends="IMachineEvent"
    1503714210      uuid="3f63597a-26f1-4edb-8dd2-6bddd0912368"
    1503814211      wsmap="managed" autogen="VBoxEvent" id="OnGuestPropertyChange"
     
    1510514278
    1510614279  <interface
    15107      name="ISnapshotChangeEvent" extends="ISnapshotEvent"
     14280     name="ISnapshotChangedEvent" extends="ISnapshotEvent"
    1510814281     uuid="07541941-8079-447a-a33e-47a69c7980db"
    1510914282     wsmap="managed" autogen="VBoxEvent" id="OnSnapshotChange"
     
    1511614289
    1511714290  <interface
    15118      name="IMousePointerShapeChangeEvent" extends="IEvent"
     14291     name="IMousePointerShapeChangedEvent" extends="IEvent"
    1511914292     uuid="a6dcf6e8-416b-4181-8c4a-45ec95177aef"
    1512014293     wsmap="managed" autogen="VBoxEvent" id="OnMousePointerShapeChange"
     
    1518914362
    1519014363  <interface
    15191      name="IMouseCapabilityChangeEvent" extends="IEvent"
     14364     name="IMouseCapabilityChangedEvent" extends="IEvent"
    1519214365     uuid="d633ad48-820c-4207-b46c-6bd3596640d5"
    1519314366     wsmap="managed" autogen="VBoxEvent" id="OnMouseCapabilityChange"
     
    1521514388
    1521614389  <interface
    15217      name="IKeyboardLedsChangeEvent" extends="IEvent"
     14390     name="IKeyboardLedsChangedEvent" extends="IEvent"
    1521814391     uuid="6DDEF35E-4737-457B-99FC-BC52C851A44F"
    1521914392     wsmap="managed" autogen="VBoxEvent" id="OnKeyboardLedsChange"
     
    1524114414
    1524214415  <interface
    15243      name="IStateChangeEvent" extends="IEvent"
     14416     name="IStateChangedEvent" extends="IEvent"
    1524414417     uuid="4376693C-CF37-453B-9289-3B0F521CAF27"
    1524514418     wsmap="managed" autogen="VBoxEvent" id="OnStateChange"
     
    1525714430
    1525814431  <interface
    15259      name="IAdditionsStateChangeEvent" extends="IEvent"
     14432     name="IAdditionsStateChangedEvent" extends="IEvent"
    1526014433     uuid="D70F7915-DA7C-44C8-A7AC-9F173490446A"
    1526114434     wsmap="managed" autogen="VBoxEvent" id="OnAdditionsStateChange"
     
    1526914442
    1527014443  <interface
    15271      name="INetworkAdapterChangeEvent" extends="IEvent"
     14444     name="INetworkAdapterChangedEvent" extends="IEvent"
    1527214445     uuid="08889892-1EC6-4883-801D-77F56CFD0103"
    1527314446     wsmap="managed" autogen="VBoxEvent" id="OnNetworkAdapterChange"
     
    1528714460
    1528814461  <interface
    15289      name="ISerialPortChangeEvent" extends="IEvent"
     14462     name="ISerialPortChangedEvent" extends="IEvent"
    1529014463     uuid="3BA329DC-659C-488B-835C-4ECA7AE71C6C"
    1529114464     wsmap="managed" autogen="VBoxEvent" id="OnSerialPortChange"
     
    1530514478
    1530614479  <interface
    15307      name="IParallelPortChangeEvent" extends="IEvent"
     14480     name="IParallelPortChangedEvent" extends="IEvent"
    1530814481     uuid="813C99FC-9849-4F47-813E-24A75DC85615"
    1530914482     wsmap="managed" autogen="VBoxEvent" id="OnParallelPortChange"
     
    1532314496
    1532414497  <interface
    15325      name="IStorageControllerChangeEvent" extends="IEvent"
     14498     name="IStorageControllerChangedEvent" extends="IEvent"
    1532614499     uuid="715212BF-DA59-426E-8230-3831FAA52C56"
    1532714500     wsmap="managed" autogen="VBoxEvent" id="OnStorageControllerChange"
     
    1533514508
    1533614509  <interface
    15337      name="IMediumChangeEvent" extends="IEvent"
     14510     name="IMediumChangedEvent" extends="IEvent"
    1533814511     uuid="0FE2DA40-5637-472A-9736-72019EABD7DE"
    1533914512     wsmap="managed" autogen="VBoxEvent" id="OnMediumChange"
     
    1535214525
    1535314526   <interface
    15354      name="ICPUChangeEvent" extends="IEvent"
     14527     name="ICPUChangedEvent" extends="IEvent"
    1535514528     uuid="D0F0BECC-EE17-4D17-A8CC-383B0EB55E9D"
    1535614529     wsmap="managed" autogen="VBoxEvent" id="OnCPUChange"
     
    1537214545
    1537314546  <interface
    15374      name="IVRDPServerChangeEvent" extends="IEvent"
     14547     name="IVRDPServerChangedEvent" extends="IEvent"
    1537514548     uuid="726038B6-6279-4A7A-8037-D041693D1915"
    1537614549     wsmap="managed" autogen="VBoxEvent" id="OnVRDPServerChange"
     
    1538514558
    1538614559   <interface
    15387      name="IRemoteDisplayInfoChangeEvent" extends="IEvent"
     14560     name="IRemoteDisplayInfoChangedEvent" extends="IEvent"
    1538814561     uuid="65B556C5-2A99-47D8-B311-FC177F0914CD"
    1538914562     wsmap="managed" autogen="VBoxEvent" id="OnRemoteDisplayInfoChange"
     
    1539714570
    1539814571  <interface
    15399      name="IUSBControllerChangeEvent" extends="IEvent"
     14572     name="IUSBControllerChangedEvent" extends="IEvent"
    1540014573     uuid="93BADC0C-61D9-4940-A084-E6BB29AF3D83"
    1540114574     wsmap="managed" autogen="VBoxEvent" id="OnUSBControllerChange"
     
    1541014583
    1541114584  <interface
    15412      name="IUSBDeviceStateChangeEvent" extends="IEvent"
     14585     name="IUSBDeviceStateChangedEvent" extends="IEvent"
    1541314586     uuid="806da61b-6679-422a-b629-51b06b0c6d93"
    1541414587     wsmap="managed" autogen="VBoxEvent" id="OnUSBDeviceStateChange"
     
    1545114624
    1545214625   <interface
    15453      name="ISharedFolderChangeEvent" extends="IEvent"
     14626     name="ISharedFolderChangedEvent" extends="IEvent"
    1545414627     uuid="B66349B5-3534-4239-B2DE-8E1535D94C0B"
    1545514628     wsmap="managed" autogen="VBoxEvent" id="OnSharedFolderChange"
     
    1554814721
    1554914722   <interface
    15550      name="IEventSourceChangeEvent" extends="IEvent"
     14723     name="IEventSourceChangedEvent" extends="IEvent"
    1555114724     uuid="e7932cb8-f6d4-4ab6-9cbf-558eb8959a6a"
    1555214725     waitable="yes"
     
    1557114744
    1557214745  <interface
    15573       name="IExtraDataChangeEvent" extends="IEvent"
     14746      name="IExtraDataChangedEvent" extends="IEvent"
    1557414747      uuid="024F00CE-6E0B-492A-A8D0-968472A94DC7"
    1557514748      wsmap="managed" autogen="VBoxEvent" id="OnExtraDataChange"
     
    1573414907           namespace="virtualbox.org">
    1573514908      <interface name="IVirtualBox" default="yes"/>
    15736       <eventsink name="IVirtualBoxCallback" default="yes"/>
    1573714909    </class>
    1573814910  </module>
     
    1574714919           namespace="virtualbox.org">
    1574814920      <interface name="IConsole" default="yes"/>
    15749       <eventsink name="IConsoleCallback" default="yes"/>
    15750     </class>
    15751 
    15752     <class name="CallbackWrapper" uuid="0AD9C4CE-3C33-4C2D-AC7B-B008196787A0"
    15753            namespace="virtualbox.org">
    15754       <interface name="ILocalOwner" default="yes"/>
    15755       <interface name="IVirtualBoxCallback"/>
    15756       <interface name="IConsoleCallback"/>
    1575714921    </class>
    1575814922  </module>
  • trunk/src/VBox/Main/idl/midl.xsl

    r29874 r30825  
    838838
    839839</xsl:stylesheet>
    840 
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r30764 r30825  
    3636class AudioSniffer;
    3737class ConsoleVRDPServer;
    38 class ConsoleCallbackRegistration;      /* See ConsoleImpl.cpp. */
    3938class VMMDev;
    4039class Progress;
     
    8483#ifdef RT_OS_WINDOWS
    8584    , public CComCoClass<Console, &CLSID_Console>
    86     , public IConnectionPointContainerImpl<Console>
    87     , public IConnectionPointImpl<Console, &IID_IConsoleCallback, CComDynamicUnkArray>
    8885#endif
    8986{
     
    104101        COM_INTERFACE_ENTRY(IConnectionPointContainer)
    105102    END_COM_MAP()
    106 
    107 #ifdef RT_OS_WINDOWS
    108     BEGIN_CONNECTION_POINT_MAP(Console)
    109          CONNECTION_POINT_ENTRY(IID_IConsoleCallback)
    110     END_CONNECTION_POINT_MAP()
    111 #endif
    112 
    113103
    114104    Console();
     
    163153    STDMETHOD(RestoreSnapshot)(ISnapshot *aSnapshot, IProgress **aProgress);
    164154    STDMETHOD(Teleport)(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress);
    165     STDMETHOD(RegisterCallback)(IConsoleCallback *aCallback);
    166     STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback);
    167155
    168156    // public methods for internal purposes only
     
    682670    ComObjPtr<Progress> mptrCancelableProgress;
    683671
    684     typedef std::list<ConsoleCallbackRegistration> CallbackList;
    685     CallbackList mCallbacks;
    686 
    687672    struct
    688673    {
     
    733718    mCallbackData;
    734719
    735 #ifdef RT_OS_WINDOWS
    736     ComEventsHelper                     mComEvHelper;
    737 #endif
    738 
    739720    friend struct VMTask;
    740721};
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r30764 r30825  
    6161#ifdef RT_OS_WINDOWS
    6262    , public CComCoClass<VirtualBox, &CLSID_VirtualBox>
    63     , public IConnectionPointContainerImpl<VirtualBox>
    64     , public IConnectionPointImpl<VirtualBox, &IID_IVirtualBoxCallback, CComDynamicUnkArray>
    6563#endif
    6664{
     
    6866public:
    6967
    70     typedef std::list< VirtualBoxCallbackRegistration > CallbackList;
    7168    typedef std::list< ComPtr<IInternalSessionControl> > InternalControlList;
    7269
     
    8986        COM_INTERFACE_ENTRY(IConnectionPointContainer)
    9087    END_COM_MAP()
    91 
    92 #ifdef RT_OS_WINDOWS
    93     BEGIN_CONNECTION_POINT_MAP(VirtualBox)
    94          CONNECTION_POINT_ENTRY(IID_IVirtualBoxCallback)
    95     END_CONNECTION_POINT_MAP()
    96 
    97     typedef CComDynamicUnkArray EventListenersList;
    98 #endif
    9988
    10089    // to postpone generation of the default ctor/dtor
     
    174163    STDMETHOD(OpenExistingSession) (ISession *aSession, IN_BSTR aMachineId);
    175164
    176     STDMETHOD(RegisterCallback) (IVirtualBoxCallback *aCallback);
    177     STDMETHOD(UnregisterCallback) (IVirtualBoxCallback *aCallback);
    178 
    179165    STDMETHOD(WaitForPropertyChange) (IN_BSTR aWhat, ULONG aTimeout,
    180166                                      BSTR *aChanged, BSTR *aValues);
     
    217203    void updateClientWatcher();
    218204
    219     void removeDeadCallback(const ComPtr<IVirtualBoxCallback> &aCallback);
    220 
    221205    void onMachineStateChange(const Guid &aId, MachineState_T aState);
    222206    void onMachineDataChange(const Guid &aId);
  • trunk/src/VBox/Main/xpcom/module.cpp

    r30627 r30825  
    4545#include "ConsoleImpl.h"
    4646#include "ConsoleVRDPServer.h"
    47 #include "VirtualBoxCallbackImpl.h"
    4847
    4948#include "Logging.h"
     
    7877NS_DECL_CLASSINFO(Console)
    7978NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
    80 NS_DECL_CLASSINFO(CallbackWrapper)
    81 NS_IMPL_THREADSAFE_ISUPPORTS3_CI(CallbackWrapper, IVirtualBoxCallback, IConsoleCallback, ILocalOwner)
    8279
    8380/**
     
    135132NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC (Session)
    136133
    137 NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC (CallbackWrapper)
    138 
    139 
    140134/**
    141135 *  Component definition table.
     
    157151        &NS_CLASSINFO_NAME(Session) // global class info & flags
    158152    },
    159     {
    160         "CallbackWrapper component", // description
    161         NS_CALLBACKWRAPPER_CID, NS_CALLBACKWRAPPER_CONTRACTID, // CID/ContractID
    162         CallbackWrapperConstructor, // constructor function
    163         NULL, // registration function
    164         NULL, // deregistration function
    165         NULL, // destructor function
    166         NS_CI_INTERFACE_GETTER_NAME(CallbackWrapper), // interfaces function
    167         NULL, // language helper
    168         &NS_CLASSINFO_NAME(CallbackWrapper) // global class info & flags
    169     }
    170 
    171153};
    172154
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