Changeset 30825 in vbox
- Timestamp:
- Jul 14, 2010 12:44:14 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 20 edited
-
include/VBox/com/VirtualBox.h (modified) (1 diff)
-
src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp (modified) (4 diffs)
-
src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp (modified) (1 diff)
-
src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp (modified) (5 diffs)
-
src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp (modified) (13 diffs)
-
src/VBox/Frontends/VirtualBox/src/runtime/UISession.h (modified) (3 diffs)
-
src/VBox/Main/ConsoleImpl.cpp (modified) (12 diffs)
-
src/VBox/Main/ConsoleVRDPServer.cpp (modified) (3 diffs)
-
src/VBox/Main/DisplayImpl.cpp (modified) (1 diff)
-
src/VBox/Main/EventImpl.cpp (modified) (1 diff)
-
src/VBox/Main/Global.cpp (modified) (2 diffs)
-
src/VBox/Main/Makefile.kmk (modified) (2 diffs)
-
src/VBox/Main/VirtualBoxCallbackImpl.cpp (deleted)
-
src/VBox/Main/VirtualBoxImpl.cpp (modified) (19 diffs)
-
src/VBox/Main/glue/tests/TestVBox.java (modified) (4 diffs)
-
src/VBox/Main/glue/vboxapi.py (modified) (6 diffs)
-
src/VBox/Main/idl/VirtualBox.xidl (modified) (45 diffs)
-
src/VBox/Main/idl/midl.xsl (modified) (1 diff)
-
src/VBox/Main/include/ConsoleImpl.h (modified) (6 diffs)
-
src/VBox/Main/include/VirtualBoxCallbackImpl.h (deleted)
-
src/VBox/Main/include/VirtualBoxImpl.h (modified) (5 diffs)
-
src/VBox/Main/xpcom/module.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/VirtualBox.h
r29388 r30825 53 53 #include "VBox/com/ptr.h" 54 54 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 #else65 HRESULT rc = ptr.createInprocObject(CLSID_CallbackWrapper);66 55 #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 155 155 case VBoxEventType_OnGuestPropertyChange: 156 156 { 157 ComPtr<IGuestPropertyChange Event> gpcev = aEvent;157 ComPtr<IGuestPropertyChangedEvent> gpcev = aEvent; 158 158 Assert(gpcev); 159 159 … … 289 289 { 290 290 291 ComPtr<IMouseCapabilityChange Event> mccev = aEvent;291 ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent; 292 292 Assert(mccev); 293 293 … … 313 313 case VBoxEventType_OnStateChange: 314 314 { 315 ComPtr<IStateChange Event> scev = aEvent;315 ComPtr<IStateChangedEvent> scev = aEvent; 316 316 Assert(scev); 317 317 … … 324 324 case VBoxEventType_OnRemoteDisplayInfoChange: 325 325 { 326 ComPtr<IRemoteDisplayInfoChange Event> rdicev = aEvent;326 ComPtr<IRemoteDisplayInfoChangedEvent> rdicev = aEvent; 327 327 Assert(rdicev); 328 328 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp
r30806 r30825 338 338 case VBoxEventType_OnGuestPropertyChange: 339 339 { 340 ComPtr<IGuestPropertyChange Event> gpcev = ev;340 ComPtr<IGuestPropertyChangedEvent> gpcev = ev; 341 341 Assert(gpcev); 342 342 Bstr aNextStrGuid; -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r30681 r30825 276 276 { 277 277 #ifdef VBOX_SECURELABEL 278 ComPtr<IExtraDataChange Event> edcev = aEvent;278 ComPtr<IExtraDataChangedEvent> edcev = aEvent; 279 279 Assert(edcev); 280 280 Bstr key, machineId; … … 366 366 case VBoxEventType_OnMousePointerShapeChange: 367 367 { 368 ComPtr<IMousePointerShapeChange Event> mpscev = aEvent;368 ComPtr<IMousePointerShapeChangedEvent> mpscev = aEvent; 369 369 Assert(mpscev); 370 370 PointerShapeChangeData *data; … … 399 399 case VBoxEventType_OnMouseCapabilityChange: 400 400 { 401 ComPtr<IMouseCapabilityChange Event> mccev = aEvent;401 ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent; 402 402 Assert(mccev); 403 403 mccev->COMGETTER(SupportsAbsolute)(&gfAbsoluteMouseGuest); … … 413 413 case VBoxEventType_OnKeyboardLedsChange: 414 414 { 415 ComPtr<IKeyboardLedsChange Event> klcev = aEvent;415 ComPtr<IKeyboardLedsChangedEvent> klcev = aEvent; 416 416 Assert(klcev); 417 417 BOOL fNumLock, fCapsLock, fScrollLock; … … 432 432 case VBoxEventType_OnStateChange: 433 433 { 434 ComPtr<IStateChange Event> scev = aEvent;434 ComPtr<IStateChangedEvent> scev = aEvent; 435 435 Assert(scev); 436 436 MachineState_T machineState; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
r30699 r30825 66 66 case KVBoxEventType_OnMachineStateChange: 67 67 { 68 CMachineStateChange Event es(event);68 CMachineStateChangedEvent es(event); 69 69 emit sigMachineStateChange(es.GetMachineId(), es.GetState()); 70 70 break; … … 72 72 case KVBoxEventType_OnMachineDataChange: 73 73 { 74 CMachineDataChange Event es(event);74 CMachineDataChangedEvent es(event); 75 75 emit sigMachineDataChange(es.GetMachineId()); 76 76 break; … … 89 89 case KVBoxEventType_OnExtraDataChange: 90 90 { 91 CExtraDataChange Event es(event);91 CExtraDataChangedEvent es(event); 92 92 emit sigExtraDataChange(es.GetMachineId(), es.GetKey(), es.GetValue()); 93 93 break; … … 104 104 case KVBoxEventType_OnSessionStateChange: 105 105 { 106 CSessionStateChange Event es(event);106 CSessionStateChangedEvent es(event); 107 107 emit sigSessionStateChange(es.GetMachineId(), es.GetState()); 108 108 break; … … 114 114 case KVBoxEventType_OnSnapshotChange: 115 115 { 116 CSnapshotChange Event es(event);116 CSnapshotChangedEvent es(event); 117 117 emit sigSnapshotChange(es.GetMachineId(), es.GetSnapshotId()); 118 118 break; … … 126 126 case KVBoxEventType_OnMousePointerShapeChange: 127 127 { 128 CMousePointerShapeChange Event es(event);128 CMousePointerShapeChangedEvent es(event); 129 129 emit sigMousePointerShapeChange(es.GetVisible(), es.GetAlpha(), QPoint(es.GetXhot(), es.GetYhot()), QSize(es.GetWidth(), es.GetHeight()), es.GetShape()); 130 130 break; … … 132 132 case KVBoxEventType_OnMouseCapabilityChange: 133 133 { 134 CMouseCapabilityChange Event es(event);134 CMouseCapabilityChangedEvent es(event); 135 135 emit sigMouseCapabilityChange(es.GetSupportsAbsolute(), es.GetSupportsRelative(), es.GetNeedsHostCursor()); 136 136 break; … … 138 138 case KVBoxEventType_OnKeyboardLedsChange: 139 139 { 140 CKeyboardLedsChange Event es(event);140 CKeyboardLedsChangedEvent es(event); 141 141 emit sigKeyboardLedsChangeEvent(es.GetNumLock(), es.GetCapsLock(), es.GetScrollLock()); 142 142 break; … … 144 144 case KVBoxEventType_OnStateChange: 145 145 { 146 CStateChange Event es(event);146 CStateChangedEvent es(event); 147 147 emit sigStateChange(es.GetState()); 148 148 break; … … 155 155 case KVBoxEventType_OnNetworkAdapterChange: 156 156 { 157 CNetworkAdapterChange Event es(event);157 CNetworkAdapterChangedEvent es(event); 158 158 emit sigNetworkAdapterChange(es.GetNetworkAdapter()); 159 159 break; … … 166 166 case KVBoxEventType_OnMediumChange: 167 167 { 168 CMediumChange Event es(event);168 CMediumChangedEvent es(event); 169 169 emit sigMediumChange(es.GetMediumAttachment()); 170 170 break; … … 182 182 case KVBoxEventType_OnUSBDeviceStateChange: 183 183 { 184 CUSBDeviceStateChange Event es(event);184 CUSBDeviceStateChangedEvent es(event); 185 185 emit sigUSBDeviceStateChange(es.GetDevice(), es.GetAttached(), es.GetError()); 186 186 break; … … 188 188 case KVBoxEventType_OnSharedFolderChange: 189 189 { 190 CSharedFolderChange Event es(event);190 CSharedFolderChangedEvent es(event); 191 191 emit sigSharedFolderChange(); 192 192 break; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r30696 r30825 34 34 /* Local forwards */ 35 35 class UIActionsPool; 36 class UIConsoleCallback;37 36 class UIFrameBuffer; 38 37 class UIMachine; … … 209 208 UIMachine *m_pMachine; 210 209 CSession &m_session; 211 const CConsoleCallback m_callback;212 210 213 211 UIMachineMenuBar *m_pMenuPool; … … 261 259 262 260 #endif // !___UIConsole_h___ 263 -
trunk/src/VBox/Main/ConsoleImpl.cpp
r30804 r30825 255 255 { 256 256 public: 257 ComPtr<IConsoleCallback> ptrICb;258 /** Bitmap of disabled callback methods, that is methods that has return259 * VBOX_E_DONT_CALL_AGAIN. */260 uint32_t bmDisabled;261 257 /** Callback bit indexes (for bmDisabled). */ 262 258 typedef enum … … 283 279 } CallbackBit; 284 280 285 ConsoleCallbackRegistration(IConsoleCallback *pIConsoleCallback) 286 : ptrICb(pIConsoleCallback), bmDisabled(0) 281 ConsoleCallbackRegistration() 287 282 { 288 283 /* nothing */ … … 292 287 { 293 288 /* nothing */ 294 }295 296 /** Equal operator for std::find. */297 bool operator==(const ConsoleCallbackRegistration &rThat) const298 {299 return this->ptrICb == rThat.ptrICb;300 }301 302 /**303 * Checks if the callback is wanted, i.e. if the method hasn't yet returned304 * 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) const309 {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;337 289 } 338 290 }; … … 349 301 #define PREP_ARGS8(a1,a2,a3,a4,a5,a6,a7,a8) a1, a2, a3, a4, a5, a6, a7, a8 350 302 351 #ifdef RT_OS_WINDOWS352 353 303 /** 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. 431 305 * 432 306 * @param CallbackMethod The callback method, like OnKeyboardLedsChange. … … 435 309 * @param Args Number of callback arguments 436 310 */ 437 #define CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, Arg c, Args, PrepComArgs, MaybeComma) \311 #define CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, Args, MaybeComma) \ 438 312 do \ 439 313 { \ 440 CONSOLE_COM_EVENTS_START(CallbackMethod,Argc); \441 PrepComArgs; \442 CONSOLE_COM_EVENTS_END(); \443 314 VBoxEventDesc evDesc; \ 444 315 evDesc.init(mEventSource, VBoxEventType_##CallbackMethod MaybeComma Args); \ 445 316 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 } \461 317 } while (0) 462 318 … … 465 321 /* Actual invocation macroses for different number of parameters */ 466 322 #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) 468 324 #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) 470 326 #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) 472 328 #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) 474 330 #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) 476 332 #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) 478 334 #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) 480 336 481 337 // constructor / destructor … … 546 402 unconst(mControl) = aControl; 547 403 548 mCallbackData.clear();549 550 404 /* Cache essential properties and objects */ 551 405 … … 606 460 unconst(mAudioSniffer) = new AudioSniffer(this); 607 461 AssertReturn(mAudioSniffer, E_FAIL); 608 609 #ifdef RT_OS_WINDOWS610 if (SUCCEEDED(rc))611 rc = mComEvHelper.init(IID_IConsoleCallback);612 #endif613 462 614 463 /* Confirm a successful initialization when it's the case */ … … 727 576 // we don't perform uninit() as it's possible that some pending event refers to this source 728 577 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 to733 * unregister a non-registered callback. */734 mCallbacks.clear();735 578 736 579 /* dynamically allocated members of mCallbackData are uninitialized … … 3106 2949 3107 2950 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 caller3119 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 new3131 * callback must know the current mouse capabilities and the pointer3132 * 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 the3155 * machine state is a) not actually changed on callback registration3156 * 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);3181 2951 return S_OK; 3182 2952 } … … 4965 4735 4966 4736 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 4967 CallbackList::iterator it = mCallbacks.begin();4968 4737 VBoxEventDesc evDesc; 4969 4738 4970 4739 if (aCheck) 4971 4740 { 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 }4990 4741 evDesc.init(mEventSource, VBoxEventType_OnCanShowWindow); 4991 4742 BOOL fDelivered = evDesc.fire(5000); /* Wait up to 5 secs for delivery */ … … 5014 4765 else 5015 4766 { 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 }5039 4767 evDesc.init(mEventSource, VBoxEventType_OnShowWindow, UINT64_C(0)); 5040 4768 BOOL fDelivered = evDesc.fire(5000); /* Wait up to 5 secs for delivery */ -
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r30764 r30825 91 91 case VBoxEventType_OnMousePointerShapeChange: 92 92 { 93 ComPtr<IMousePointerShapeChange Event> mpscev = aEvent;93 ComPtr<IMousePointerShapeChangedEvent> mpscev = aEvent; 94 94 Assert(mpscev); 95 95 BOOL visible, alpha; … … 110 110 case VBoxEventType_OnMouseCapabilityChange: 111 111 { 112 ComPtr<IMouseCapabilityChange Event> mccev = aEvent;112 ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent; 113 113 Assert(mccev); 114 114 if (m_server) … … 122 122 case VBoxEventType_OnKeyboardLedsChange: 123 123 { 124 ComPtr<IKeyboardLedsChange Event> klcev = aEvent;124 ComPtr<IKeyboardLedsChangedEvent> klcev = aEvent; 125 125 Assert(klcev); 126 126 -
trunk/src/VBox/Main/DisplayImpl.cpp
r30681 r30825 747 747 case VBoxEventType_OnStateChange: 748 748 { 749 ComPtr<IStateChange Event> scev = aEvent;749 ComPtr<IStateChangedEvent> scev = aEvent; 750 750 Assert(scev); 751 751 MachineState_T machineState; -
trunk/src/VBox/Main/EventImpl.cpp
r30770 r30825 371 371 ListenerRecord* mRef; /* must be weak reference */ 372 372 int32_t mRefCnt; 373 373 374 374 public: 375 375 EventMapRecord(ListenerRecord* aRef) -
trunk/src/VBox/Main/Global.cpp
r29815 r30825 434 434 case VBOX_E_INVALID_SESSION_STATE: return VERR_COM_INVALID_SESSION_STATE; 435 435 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;437 436 438 437 default: … … 480 479 case VERR_COM_INVALID_SESSION_STATE: return VBOX_E_INVALID_SESSION_STATE; 481 480 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;483 481 484 482 /* Other errors. */ -
trunk/src/VBox/Main/Makefile.kmk
r30739 r30825 639 639 SharedFolderImpl.cpp \ 640 640 SessionImpl.cpp \ 641 VirtualBoxCallbackImpl.cpp \642 641 ConsoleImpl.cpp \ 643 642 ConsoleImpl2.cpp \ … … 659 658 win/dllmain.cpp \ 660 659 win/VBoxC.def \ 661 win/VBoxC.rc \ 662 win/VBoxComEvents.cpp 660 win/VBoxC.rc 663 661 664 662 -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r30777 r30825 118 118 { 119 119 public: 120 ComPtr<IVirtualBoxCallback> ptrICb;121 /** Bitmap of disabled callback methods, that is methods that has return122 * VBOX_E_DONT_CALL_AGAIN. */123 uint32_t bmDisabled;124 120 /** Callback bit indexes (for bmDisabled). */ 125 121 typedef enum … … 138 134 } CallbackBit; 139 135 140 VirtualBoxCallbackRegistration(IVirtualBoxCallback *pIVirtualBoxCallback) 141 : ptrICb(pIVirtualBoxCallback), bmDisabled(0) 136 VirtualBoxCallbackRegistration() 142 137 { 143 138 /* nothing */ … … 147 142 { 148 143 /* nothing */ 149 }150 151 /** Equal operator for std::find. */152 bool operator==(const VirtualBoxCallbackRegistration &rThat) const153 {154 return this->ptrICb == rThat.ptrICb;155 }156 157 /**158 * Checks if the callback is wanted, i.e. if the method hasn't yet returned159 * 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) const164 {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);175 144 } 176 145 }; … … 204 173 void *handler(); 205 174 206 virtual HRESULT handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback) = 0;207 175 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) = 0; 208 209 #ifdef RT_OS_WINDOWS210 virtual HRESULT prepareComEventDesc(ComEventDesc& aEvDesc) = 0;211 #endif212 176 213 177 private: … … 218 182 */ 219 183 VirtualBox *mVirtualBox; 220 221 184 protected: 222 /** The callback being called, used for handling VBOX_E_DONT_CALL_AGAIN. */223 185 VirtualBoxCallbackRegistration::CallbackBit mWhat; 224 186 }; … … 343 305 RWLockHandle mtxProgressOperations; 344 306 ProgressMap mapProgressOperations; 345 CallbackList llCallbacks;346 307 347 308 // the following are data for the client watcher thread … … 600 561 } 601 562 602 #ifdef RT_OS_WINDOWS603 if (SUCCEEDED(rc))604 rc = m->mComEvHelper.init(IID_IVirtualBoxCallback);605 #endif606 563 /* Confirm a successful initialization when it's the case */ 607 564 if (SUCCEEDED(rc)) … … 753 710 } 754 711 #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 }764 712 765 713 LogFlowThisFunc(("Terminating the async event handler...\n")); … … 2113 2061 } 2114 2062 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 caller2128 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 else2163 m->llCallbacks.erase(it);2164 2165 LogFlowThisFunc(("aCallback=%p, rc=%08X\n", aCallback, rc));2166 return rc;2167 }2168 2169 2170 2063 STDMETHODIMP VirtualBox::WaitForPropertyChange(IN_BSTR /* aWhat */, 2171 2064 ULONG /* aTimeout */, … … 2572 2465 } 2573 2466 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 2592 2467 /** Event for onMachineStateChange(), onMachineDataChange(), onMachineRegistered() */ 2593 2468 struct MachineEvent : public VirtualBox::CallbackEvent … … 2607 2482 {} 2608 2483 2609 HRESULT handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback)2484 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 2610 2485 { 2611 2486 switch (mWhat) 2612 2487 { 2613 2488 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; 2616 2491 2617 2492 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; 2621 2495 2622 2496 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); 2649 2498 break; 2650 2499 … … 2654 2503 return S_OK; 2655 2504 } 2656 #endif2657 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 }2678 2505 2679 2506 Bstr id; … … 2710 2537 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 2711 2538 2712 CallbackList list;2713 {2714 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);2715 list = m->llCallbacks;2716 }2717 2718 2539 BOOL allowChange = TRUE; 2719 CallbackList::iterator it = list.begin();2720 2540 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., because2745 * the other side is dead), we ensure allowChange stays true2746 * (MS COM RPC implementation seems to zero all output vars before2747 * issuing an IPC call or after a failure, so it's essential2748 * there) */2749 allowChange = TRUE;2750 }2751 }2752 ++it;2753 }2754 2541 2755 2542 VBoxEventDesc evDesc; … … 2791 2578 {} 2792 2579 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_WINDOWS2800 HRESULT prepareComEventDesc(ComEventDesc& aEvDesc)2801 {2802 aEvDesc.init("OnExtraDataChange", 3);2803 aEvDesc.add(machineId).add(key).add(val);2804 return S_OK;2805 }2806 #endif2807 2580 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 2808 2581 { … … 2837 2610 {} 2838 2611 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_WINDOWS2847 HRESULT prepareComEventDesc(ComEventDesc& aEvDesc)2848 {2849 aEvDesc.init("OnSessionStateChange", 2);2850 aEvDesc.add(machineId).add((int)sessionState);2851 return S_OK;2852 }2853 #endif2854 2612 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 2855 2613 { … … 2877 2635 {} 2878 2636 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_WINDOWS2907 HRESULT prepareComEventDesc(ComEventDesc& aEvDesc)2908 {2909 aEvDesc.init("OnSnapshotTaken", 2);2910 aEvDesc.add(machineId.toUtf16()).add(snapshotId.toUtf16());2911 return S_OK;2912 }2913 #endif2914 2637 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 2915 2638 { … … 2961 2684 {} 2962 2685 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_WINDOWS2971 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 #endif2978 2686 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 2979 2687 { … … 4669 4377 } 4670 4378 4671 CallbackList callbacks;4672 #ifdef RT_OS_WINDOWS4673 EventListenersList listeners;4674 #endif4675 {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_WINDOWS4680 IUnknown** pp;4681 for (pp = mVirtualBox->m_vec.begin(); pp < mVirtualBox->m_vec.end(); pp++)4682 {4683 listeners.Add(*pp);4684 }4685 #endif4686 }4687 4688 4689 #ifdef RT_OS_WINDOWS4690 {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 our4709 * 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 #endif4720 4379 4721 4380 { … … 4724 4383 4725 4384 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 }4749 4385 } 4750 4386 -
trunk/src/VBox/Main/glue/tests/TestVBox.java
r30591 r30825 16 16 import java.math.BigInteger; 17 17 18 class VBoxCallbacks extends VBoxObjectBase implements IVirtualBoxCallback19 {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 IConsoleCallback68 {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 157 18 public class TestVBox 158 19 { 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 190 20 static void processEvent(IEvent ev) 191 21 { … … 198 28 { 199 29 case OnMachineStateChange: 200 IMachineStateChange Event mcse = IMachineStateChangeEvent.queryInterface(ev);30 IMachineStateChangedEvent mcse = IMachineStateChangedEvent.queryInterface(ev); 201 31 if (mcse == null) 202 32 System.out.println("Cannot query an interface"); … … 223 53 { 224 54 // 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 226 56 // recommended 227 57 IEventListener listener = active ? mgr.createListener(new EventHandler()) : es.createListener(); … … 285 115 testEnumeration(mgr, vbox); 286 116 testStart(mgr, vbox); 287 //testCallbacks(mgr, vbox);288 117 testEvents(mgr, vbox.getEventSource(), false); 289 118 -
trunk/src/VBox/Main/glue/vboxapi.py
r30533 r30825 217 217 win32com.client.gencache.EnsureDispatch('VirtualBox.Session') 218 218 win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox') 219 win32com.client.gencache.EnsureDispatch('VirtualBox.CallbackWrapper')220 219 221 220 def getSessionObject(self, vbox): … … 245 244 import pythoncom 246 245 pythoncom.CoUninitialize() 247 248 def createCallback(self, iface, impl, arg):249 d = {}250 d['BaseClass'] = impl251 d['arg'] = arg252 d['tlb_guid'] = PlatformMSCOM.VBOX_TLB_GUID253 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 here263 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 up267 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']276 246 277 247 def createListener(self, impl, arg): … … 292 262 str += " _reg_policy_spec_ = 'win32com.server.policy.EventHandlerPolicy'\n" 293 263 294 # capitalized version of callbackmethod264 # capitalized version of listener method 295 265 str += " HandleEvent=BaseClass.handleEvent\n" 296 266 str += " def __init__(self): BaseClass.__init__(self, arg)\n" … … 370 340 import xpcom 371 341 xpcom._xpcom.DetachThread() 372 373 def createCallback(self, iface, impl, arg):374 d = {}375 d['BaseClass'] = impl376 d['arg'] = arg377 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']386 342 387 343 def createListener(self, impl, arg): … … 478 434 pass 479 435 480 def createCallback(self, iface, impl, arg):481 raise Exception("no callbacks for webservices")482 483 436 def createListener(self, impl, arg): 484 437 raise Exception("no active listeners for webservices") … … 581 534 self.platform.deinitPerThread() 582 535 583 def createCallback(self, iface, impl, arg):584 return self.platform.createCallback(iface, impl, arg)585 586 536 def createListener(self, impl, arg = None): 587 537 return self.platform.createListener(impl, arg) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r30714 r30825 372 372 </result> 373 373 374 <result name="VBOX_E_DONT_CALL_AGAIN" value="0x80BB000D">375 <desc>376 Returned by callback methods which does not need to be called again377 because the client does not actually make use of them.378 </desc>379 </result>380 381 374 <!-- 382 375 Note that src/VBox/Runtime/common/err/errmsgvboxcom.xsl will ignore … … 1205 1198 </interface> 1206 1199 1207 <interface1208 name="ILocalOwner" extends="$unknown"1209 uuid="308FF42A-DC45-49D4-A950-B1EEE5E00BB5" wsmap="suppress"1210 >1211 <desc>1212 The ILocalOwner interface allows to register local objects1213 (created without COM calls, but with new()).1214 Once registered, calls to methods of such objects can be made1215 from remote COM processes.1216 The main usecase is the event callback implementation where1217 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 1230 1200 <!-- 1231 1201 // IVirtualBox 1232 1202 ///////////////////////////////////////////////////////////////////////// 1233 1203 --> 1234 1235 <interface1236 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 for1272 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 to1281 (@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 the1297 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 data1311 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 unregistered1337 within this VirtualBox installation.1338 1339 The @a mediumType parameter describes what type of1340 medium the specified @a mediumId refers to. Possible1341 values are:1342 1343 <ul>1344 <li><link to="DeviceType_HardDisk"/>: the medium is a hard disk1345 that, if registered, can be obtained using the1346 <link to="IVirtualBox::getHardDisk"/> call.</li>1347 <li><link to="DeviceType_DVD"/>: the medium is a CD/DVD image1348 that, if registered, can be obtained using the1349 <link to="IVirtualBox::getDVDImage"/> call.</li>1350 <li><link to="DeviceType_Floppy"/>: the medium is a Floppy image1351 that, if registered, can be obtained using the1352 <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 the1357 unregistered medium. It is supposed that the1358 application will do required cleanup based on the1359 @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 was1374 unregistered.1375 </desc>1376 </param>1377 </method>1378 1379 <method name="onMachineRegistered">1380 <desc>1381 The given machine was registered or unregistered1382 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 was1393 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 snapshot1436 object has been uninitialized on the server (so that any1437 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 machine1452 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>1503 1204 1504 1205 <interface … … 1959 1660 <link to="#openMachine"/> within this VirtualBox installation. After 1960 1661 successful method invocation, the 1961 <link to="IVirtualBoxCallback::onMachineRegistered"/> signal is sent 1962 to all registered callbacks. 1662 <link to="IMachineRegisteredEvent"/> event is fired. 1963 1663 1964 1664 <note> … … 2013 1713 Unregisters the machine previously registered using 2014 1714 <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. 2017 1716 2018 1717 <note> … … 2571 2270 <note> 2572 2271 Before performing the actual data change, this method will ask all 2573 registered callbacksusing the2574 <link to="I VirtualBoxCallback::onExtraDataCanChange"/>2575 notification for a permission. If one of the callbacks refuses the2272 registered event listener using the 2273 <link to="IExtraDataCanChangeEvent"/> 2274 notification for a permission. If one of the listeners refuses the 2576 2275 new value, the change will not be performed. 2577 2276 </note> 2578 2277 <note> 2579 2278 On success, the 2580 <link to="I VirtualBoxCallback::onExtraDataChange"/> notification2581 is called to inform all registered callbacks about a successful data2279 <link to="IExtraDataChanged"/> notification 2280 is called to inform all registered listeners about a successful data 2582 2281 change. 2583 2282 </note> … … 2854 2553 <param name="machineId" type="uuid" mod="string" dir="in"> 2855 2554 <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 given2862 callback object will be called by VirtualBox when an appropriate2863 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>2886 2555 </param> 2887 2556 </method> … … 4725 4394 A comma-separated list of simple glob patterns. Changes to guest 4726 4395 properties whose name matches one of the patterns will generate an 4727 <link to="I VirtualBoxCallback::onGuestPropertyChange"/> signal.4396 <link to="IGuestPropertyChangedEvent"/> signal. 4728 4397 </desc> 4729 4398 </attribute> … … 5289 4958 <note> 5290 4959 Before performing the actual data change, this method will ask all 5291 registered callbacks using the5292 <link to="I VirtualBoxCallback::onExtraDataCanChange"/>5293 notification for a permission. If one of the callbacks refuses the4960 registered listeners using the 4961 <link to="IExtraDataCanChangeEvent"/> 4962 notification for a permission. If one of the listeners refuses the 5294 4963 new value, the change will not be performed. 5295 4964 </note> 5296 4965 <note> 5297 4966 On success, the 5298 <link to="I VirtualBoxCallback::onExtraDataChange"/> notification5299 is called to inform all registered callbacks about a successful data4967 <link to="IExtraDataChangedEvent"/> notification 4968 is called to inform all registered listeners about a successful data 5300 4969 change. 5301 4970 </note> … … 5525 5194 method. 5526 5195 <note> 5527 The method sends <link to="I VirtualBoxCallback::onMachineDataChange"/>5196 The method sends <link to="IMachineDataChangedEvent"/> 5528 5197 notification event after the configuration has been successfully 5529 5198 saved (only for registered machines). … … 6155 5824 6156 5825 <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 to6164 be notified of events. For example, a graphical user interface6165 can use this to learn about machine state changes so they can6166 update the list of virtual machines without having to rely6167 on polling.6168 6169 Whenever relevant events occur in VirtualBox, the callbacks in6170 objects of this interface are called. In order for this to be6171 useful, a client needs to create its own subclass that implements6172 this interface in which the methods for the relevant callbacks6173 are overridden. An instance of this subclass interface can then6174 be passed to <link to="IConsole::registerCallback" />.6175 </desc>6176 6177 <method name="onMousePointerShapeChange">6178 <desc>6179 Notification when the guest mouse pointer shape has6180 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 mask6220 followed by a 32-bpp XOR (color) mask.6221 6222 For pointers without alpha channel the XOR mask pixels are 326223 bit values: (lsb)BGR0(msb). For pointers with alpha channel6224 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 the6227 callback does not support alpha, the pointer could be6228 displayed as a normal color pointer.6229 6230 The AND mask is a 1-bpp bitmap with byte aligned scanlines. The6231 size of the AND mask therefore is <tt>cbAnd = (width + 7) / 8 *6232 height</tt>. The padding bits at the end of each scanline are6233 undefined.6234 6235 The XOR mask follows the AND mask on the next 4-byte aligned6236 offset: <tt>uint8_t *pXor = pAnd + (cbAnd + 3) & ~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 of6239 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 the6251 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 command6264 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 to6289 find out what has changed.6290 </desc>6291 </method>6292 6293 <method name="onNetworkAdapterChange">6294 <desc>6295 Notification when a property of one of the6296 virtual <link to="IMachine::getNetworkAdapter">network adapters</link>6297 changes. Interested callees should use INetworkAdapter methods and6298 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 the6311 virtual <link to="IMachine::getSerialPort">serial ports</link> changes.6312 Interested callees should use ISerialPort methods and attributes6313 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 the6326 virtual <link to="IMachine::getParallelPort">parallel ports</link>6327 changes. Interested callees should use ISerialPort methods and6328 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 the6341 virtual <link to="IMachine::storageControllers">storage controllers</link>6342 changes. Interested callees should query the corresponding collections6343 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 a6353 <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 the6382 <link to="IMachine::VRDPServer">VRDP server</link> changes.6383 Interested callees should use IVRDPServer methods and attributes to6384 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 callees6394 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 virtual6405 <link to="IMachine::USBController">USB controller</link> changes.6406 Interested callees should use IUSBController methods and attributes to6407 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 from6417 the virtual USB controller.6418 6419 This notification is sent as a result of the indirect6420 request to attach the device because it matches one of the6421 machine USB filters, or as a result of the direct request6422 issued by <link to="IConsole::attachUSBDevice"/> or6423 <link to="IConsole::detachUSBDevice"/>.6424 This notification is sent in case of both a succeeded and a6425 failed request completion. When the request succeeds, the6426 @a error parameter is @c null, and the given device has been6427 already added to (when @a attached is @c true) or removed from6428 (when @a attached is @c false) the collection represented by6429 <link to="IConsole::USBDevices"/>. On failure, the collection6430 doesn't change and the @a error parameter represents the error6431 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> of6459 the machine (<link to="Scope_Machine">Machine</link>) or <link6460 to="IConsole::sharedFolders">transient shared folders</link> of the6461 machine (<link to="Scope_Session">Session</link>). Interested callees6462 should use query the corresponding collections to find out what has6463 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 virtual6476 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 set6486 to @c true. In case of fatal errors, the virtual machine6487 execution is always paused before calling this notification, and6488 the notification handler is supposed either to immediately save6489 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 the6494 @a fatal parameter set to @c false. If the virtual machine6495 is in the Paused state by the time the error notification is6496 received, it means that the user can <i>try to resume</i> the machine6497 execution after attempting to solve the problem that caused the6498 error. In this case, the notification handler is supposed6499 to show an appropriate message to the user (depending on the6500 value of the @a id parameter) that offers several actions such6501 as <i>Retry</i>, <i>Save</i> or <i>Power Off</i>. If the user6502 wants to retry, the notification handler should continue6503 the machine execution using the <link to="IConsole::resume"/>6504 call. If the machine execution is not Paused during this6505 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 machine6508 continues its normal execution.6509 6510 Note that in either case the notification handler6511 <b>must not</b> perform any action directly on a thread6512 where this notification is called. Everything it is allowed to6513 do is to post a message to another thread that will then talk6514 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 by6526 more than one callback at a time. If you have multiple6527 IConsoleCallback instances registered on the given6528 IConsole object, make sure you simply do nothing but6529 return @c S_OK from all but one of them that does actual6530 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 to6551 <link to="IMachine::canShowConsoleWindow"/> is made by a6552 front-end to check if a subsequent call to6553 <link to="IMachine::showConsoleWindow"/> can succeed.6554 6555 The callee should give an answer appropriate to the current6556 machine state in the @a canShow argument. This answer must6557 remain valid at least until the next6558 <link to="IConsole::state">machine state</link> change.6559 6560 <note>6561 This notification is not designed to be implemented by6562 more than one callback at a time. If you have multiple6563 IConsoleCallback instances registered on the given6564 IConsole object, make sure you simply do nothing but6565 return @c true and @c S_OK from all but one of them that6566 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 to6583 <link to="IMachine::showConsoleWindow"/>6584 requests the console window to be activated and brought to6585 foreground on the desktop of the host PC.6586 6587 This notification should cause the VM console process to6588 perform the requested action as described above. If it is6589 impossible to do it at a time of this notification, this6590 method should return a failure.6591 6592 Note that many modern window managers on many platforms6593 implement some sort of focus stealing prevention logic, so6594 that it may be impossible to activate a window without the6595 help of the currently active application (which is supposedly6596 an initiator of this notification). In this case, this method6597 must return a non-zero identifier that represents the6598 top-level window of the VM console process. The caller, if it6599 represents a currently active process, is responsible to use6600 this identifier (in a platform-dependent manner) to perform6601 actual window activation.6602 6603 This method must set @a winId to zero if it has performed all6604 actions necessary to complete the request and the console6605 window is now active and in foreground, to indicate that no6606 further action is required on the caller's side.6607 6608 <note>6609 This notification is not designed to be implemented by6610 more than one callback at a time. If you have multiple6611 IConsoleCallback instances registered on the given6612 IConsole object, make sure you simply do nothing but6613 return @c S_OK from all but one of them that actually6614 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 console6624 window, or zero if this method has performed all actions6625 necessary to implement the <i>show window</i> semantics for6626 the given platform and/or this VirtualBox front-end.6627 </desc>6628 </param>6629 </method>6630 6631 </interface>6632 6633 <interface6634 5826 name="IRemoteDisplayInfo" extends="$unknown" 6635 5827 uuid="b3741084-806f-4c3b-8c42-ebad1a81e45a" … … 7454 6646 </method> 7455 6647 7456 <method name="registerCallback">7457 <desc>7458 Registers a new console callback on this instance. The methods of the7459 callback interface will be called by this instance when the appropriate7460 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 using7468 <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>7475 6648 </interface> 7476 6649 … … 11042 10215 or not. 11043 10216 <note> 11044 You can use the <link to="I ConsoleCallback::onMouseCapabilityChange"/>11045 callbackto be instantly informed about changes of this attribute10217 You can use the <link to="IMouseCapabilityChangedEvent"/> 10218 event to be instantly informed about changes of this attribute 11046 10219 during virtual machine execution. 11047 10220 </note> … … 11055 10228 or not. 11056 10229 <note> 11057 You can use the <link to="I ConsoleCallback::onMouseCapabilityChange"/>11058 callbackto be instantly informed about changes of this attribute10230 You can use the <link to="IMouseCapabilityChangedEvent"/> 10231 event to be instantly informed about changes of this attribute 11059 10232 during virtual machine execution. 11060 10233 </note> … … 11068 10241 cursor on demand. 11069 10242 <note> 11070 You can use the <link to="I ConsoleCallback::onMouseCapabilityChange"/>11071 callbackto be instantly informed about changes of this attribute10243 You can use the <link to="IMouseCapabilityChangedEvent"/> 10244 event to be instantly informed about changes of this attribute 11072 10245 during virtual machine execution. 11073 10246 </note> … … 13442 12615 Called by <link to="IMachine::canShowConsoleWindow"/> and by 13443 12616 <link to="IMachine::showConsoleWindow"/> in order to notify 13444 console callbacks13445 <link to="IC onsoleCallback::onCanShowWindow"/>13446 and <link to="I ConsoleCallback::onShowWindow"/>.12617 console listeners 12618 <link to="ICanShowWindowEvent"/> 12619 and <link to="IShowWindowEvent"/>. 13447 12620 13448 12621 <result name="VBOX_E_INVALID_OBJECT_STATE"> … … 14618 13791 <const name="OnMachineStateChange" value="32"> 14619 13792 <desc> 14620 <see>IMachineStateChange Event</see>13793 <see>IMachineStateChangedEvent</see> 14621 13794 </desc> 14622 13795 </const> 14623 13796 <const name="OnMachineDataChange" value="33"> 14624 13797 <desc> 14625 <see>IMachineDataChange Event</see>13798 <see>IMachineDataChangedEvent</see> 14626 13799 </desc> 14627 13800 </const> 14628 13801 <const name="OnExtraDataChange" value="34"> 14629 13802 <desc> 14630 <see>IExtraDataChange Event</see>13803 <see>IExtraDataChangedEvent</see> 14631 13804 </desc> 14632 13805 </const> … … 14648 13821 <const name="OnSessionStateChange" value="38"> 14649 13822 <desc> 14650 <see>ISessionStateChange Event</see>13823 <see>ISessionStateChangedEvent</see> 14651 13824 </desc> 14652 13825 </const> … … 14663 13836 <const name="OnSnapshotChange" value="41"> 14664 13837 <desc> 14665 <see>ISnapshotChange Event</see>13838 <see>ISnapshotChangedEvent</see> 14666 13839 </desc> 14667 13840 </const> 14668 13841 <const name="OnGuestPropertyChange" value="42"> 14669 13842 <desc> 14670 <see>IGuestPropertyChange Event</see>13843 <see>IGuestPropertyChangedEvent</see> 14671 13844 </desc> 14672 13845 </const> … … 14674 13847 <const name="OnMousePointerShapeChange" value="43"> 14675 13848 <desc> 14676 <see>IMousePointerShapeChange Event</see>13849 <see>IMousePointerShapeChangedEvent</see> 14677 13850 </desc> 14678 13851 </const> 14679 13852 <const name="OnMouseCapabilityChange" value="44"> 14680 13853 <desc> 14681 <see>IMouseCapabilityChange Event</see>13854 <see>IMouseCapabilityChangedEvent</see> 14682 13855 </desc> 14683 13856 </const> 14684 13857 <const name="OnKeyboardLedsChange" value="45"> 14685 13858 <desc> 14686 <see>IKeyboardLedsChange Event</see>13859 <see>IKeyboardLedsChangedEvent</see> 14687 13860 </desc> 14688 13861 </const> 14689 13862 <const name="OnStateChange" value="46"> 14690 13863 <desc> 14691 <see>IStateChange Event</see>13864 <see>IStateChangedEvent</see> 14692 13865 </desc> 14693 13866 </const> 14694 13867 <const name="OnAdditionsStateChange" value="47"> 14695 13868 <desc> 14696 <see>IAdditionsStateChange Event</see>13869 <see>IAdditionsStateChangedEvent</see> 14697 13870 </desc> 14698 13871 </const> 14699 13872 <const name="OnNetworkAdapterChange" value="48"> 14700 13873 <desc> 14701 <see>INetworkAdapterChange Event</see>13874 <see>INetworkAdapterChangedEvent</see> 14702 13875 </desc> 14703 13876 </const> 14704 13877 <const name="OnSerialPortChange" value="49"> 14705 13878 <desc> 14706 <see>ISerialPortChange Event</see>13879 <see>ISerialPortChangedEvent</see> 14707 13880 </desc> 14708 13881 </const> 14709 13882 <const name="OnParallelPortChange" value="50"> 14710 13883 <desc> 14711 <see>IParallelPortChange Event</see>13884 <see>IParallelPortChangedEvent</see> 14712 13885 </desc> 14713 13886 </const> 14714 13887 <const name="OnStorageControllerChange" value="51"> 14715 13888 <desc> 14716 <see>IStorageControllerChange Event</see>13889 <see>IStorageControllerChangedEvent</see> 14717 13890 </desc> 14718 13891 </const> 14719 13892 <const name="OnMediumChange" value="52"> 14720 13893 <desc> 14721 <see>IMediumChange Event</see>13894 <see>IMediumChangedEvent</see> 14722 13895 </desc> 14723 13896 </const> 14724 13897 <const name="OnVRDPServerChange" value="53"> 14725 13898 <desc> 14726 <see>IVRDPServerChange Event</see>13899 <see>IVRDPServerChangedEvent</see> 14727 13900 </desc> 14728 13901 </const> 14729 13902 <const name="OnUSBControllerChange" value="54"> 14730 13903 <desc> 14731 <see>IUSBControllerChange Event</see>13904 <see>IUSBControllerChangedEvent</see> 14732 13905 </desc> 14733 13906 </const> 14734 13907 <const name="OnUSBDeviceStateChange" value="55"> 14735 13908 <desc> 14736 <see>IUSBDeviceStateChange Event</see>13909 <see>IUSBDeviceStateChangedEvent</see> 14737 13910 </desc> 14738 13911 </const> 14739 13912 <const name="OnSharedFolderChange" value="56"> 14740 13913 <desc> 14741 <see>ISharedFolderChange Event</see>13914 <see>ISharedFolderChangedEvent</see> 14742 13915 </desc> 14743 13916 </const> … … 14759 13932 <const name="OnCPUChange" value="60"> 14760 13933 <desc> 14761 <see>ICPUChange Event</see>13934 <see>ICPUChangedEvent</see> 14762 13935 </desc> 14763 13936 </const> 14764 13937 <const name="OnRemoteDisplayInfoChange" value="61"> 14765 13938 <desc> 14766 <see>IRemoteDisplayInfoChange Event</see>13939 <see>IRemoteDisplayInfoChangedEvent</see> 14767 13940 </desc> 14768 13941 </const> 14769 13942 <const name="OnEventSourceChange" value="62"> 14770 13943 <desc> 14771 <see>IEventSourceChange Event</see>13944 <see>IEventSourceChangedEvent</see> 14772 13945 </desc> 14773 13946 </const> … … 14977 14150 14978 14151 <interface 14979 name="IMachineStateChange Event" extends="IMachineEvent"14152 name="IMachineStateChangedEvent" extends="IMachineEvent" 14980 14153 uuid="5748F794-48DF-438D-85EB-98FFD70D18C9" 14981 14154 wsmap="managed" autogen="VBoxEvent" id="OnMachineStateChange" … … 14989 14162 14990 14163 <interface 14991 name="IMachineDataChange Event" extends="IMachineEvent"14164 name="IMachineDataChangedEvent" extends="IMachineEvent" 14992 14165 uuid="6AA70A6C-0DCA-4810-8C5C-457B278E3D49" 14993 14166 wsmap="managed" autogen="VBoxEvent" id="OnMachineDataChange" … … 15017 14190 15018 14191 <interface 15019 name="ISessionStateChange Event" extends="IMachineEvent"14192 name="ISessionStateChangedEvent" extends="IMachineEvent" 15020 14193 uuid="714a3eef-799a-4489-86cd-fe8e45b2ff8e" 15021 14194 wsmap="managed" autogen="VBoxEvent" id="OnSessionStateChange" … … 15034 14207 15035 14208 <interface 15036 name="IGuestPropertyChange Event" extends="IMachineEvent"14209 name="IGuestPropertyChangedEvent" extends="IMachineEvent" 15037 14210 uuid="3f63597a-26f1-4edb-8dd2-6bddd0912368" 15038 14211 wsmap="managed" autogen="VBoxEvent" id="OnGuestPropertyChange" … … 15105 14278 15106 14279 <interface 15107 name="ISnapshotChange Event" extends="ISnapshotEvent"14280 name="ISnapshotChangedEvent" extends="ISnapshotEvent" 15108 14281 uuid="07541941-8079-447a-a33e-47a69c7980db" 15109 14282 wsmap="managed" autogen="VBoxEvent" id="OnSnapshotChange" … … 15116 14289 15117 14290 <interface 15118 name="IMousePointerShapeChange Event" extends="IEvent"14291 name="IMousePointerShapeChangedEvent" extends="IEvent" 15119 14292 uuid="a6dcf6e8-416b-4181-8c4a-45ec95177aef" 15120 14293 wsmap="managed" autogen="VBoxEvent" id="OnMousePointerShapeChange" … … 15189 14362 15190 14363 <interface 15191 name="IMouseCapabilityChange Event" extends="IEvent"14364 name="IMouseCapabilityChangedEvent" extends="IEvent" 15192 14365 uuid="d633ad48-820c-4207-b46c-6bd3596640d5" 15193 14366 wsmap="managed" autogen="VBoxEvent" id="OnMouseCapabilityChange" … … 15215 14388 15216 14389 <interface 15217 name="IKeyboardLedsChange Event" extends="IEvent"14390 name="IKeyboardLedsChangedEvent" extends="IEvent" 15218 14391 uuid="6DDEF35E-4737-457B-99FC-BC52C851A44F" 15219 14392 wsmap="managed" autogen="VBoxEvent" id="OnKeyboardLedsChange" … … 15241 14414 15242 14415 <interface 15243 name="IStateChange Event" extends="IEvent"14416 name="IStateChangedEvent" extends="IEvent" 15244 14417 uuid="4376693C-CF37-453B-9289-3B0F521CAF27" 15245 14418 wsmap="managed" autogen="VBoxEvent" id="OnStateChange" … … 15257 14430 15258 14431 <interface 15259 name="IAdditionsStateChange Event" extends="IEvent"14432 name="IAdditionsStateChangedEvent" extends="IEvent" 15260 14433 uuid="D70F7915-DA7C-44C8-A7AC-9F173490446A" 15261 14434 wsmap="managed" autogen="VBoxEvent" id="OnAdditionsStateChange" … … 15269 14442 15270 14443 <interface 15271 name="INetworkAdapterChange Event" extends="IEvent"14444 name="INetworkAdapterChangedEvent" extends="IEvent" 15272 14445 uuid="08889892-1EC6-4883-801D-77F56CFD0103" 15273 14446 wsmap="managed" autogen="VBoxEvent" id="OnNetworkAdapterChange" … … 15287 14460 15288 14461 <interface 15289 name="ISerialPortChange Event" extends="IEvent"14462 name="ISerialPortChangedEvent" extends="IEvent" 15290 14463 uuid="3BA329DC-659C-488B-835C-4ECA7AE71C6C" 15291 14464 wsmap="managed" autogen="VBoxEvent" id="OnSerialPortChange" … … 15305 14478 15306 14479 <interface 15307 name="IParallelPortChange Event" extends="IEvent"14480 name="IParallelPortChangedEvent" extends="IEvent" 15308 14481 uuid="813C99FC-9849-4F47-813E-24A75DC85615" 15309 14482 wsmap="managed" autogen="VBoxEvent" id="OnParallelPortChange" … … 15323 14496 15324 14497 <interface 15325 name="IStorageControllerChange Event" extends="IEvent"14498 name="IStorageControllerChangedEvent" extends="IEvent" 15326 14499 uuid="715212BF-DA59-426E-8230-3831FAA52C56" 15327 14500 wsmap="managed" autogen="VBoxEvent" id="OnStorageControllerChange" … … 15335 14508 15336 14509 <interface 15337 name="IMediumChange Event" extends="IEvent"14510 name="IMediumChangedEvent" extends="IEvent" 15338 14511 uuid="0FE2DA40-5637-472A-9736-72019EABD7DE" 15339 14512 wsmap="managed" autogen="VBoxEvent" id="OnMediumChange" … … 15352 14525 15353 14526 <interface 15354 name="ICPUChange Event" extends="IEvent"14527 name="ICPUChangedEvent" extends="IEvent" 15355 14528 uuid="D0F0BECC-EE17-4D17-A8CC-383B0EB55E9D" 15356 14529 wsmap="managed" autogen="VBoxEvent" id="OnCPUChange" … … 15372 14545 15373 14546 <interface 15374 name="IVRDPServerChange Event" extends="IEvent"14547 name="IVRDPServerChangedEvent" extends="IEvent" 15375 14548 uuid="726038B6-6279-4A7A-8037-D041693D1915" 15376 14549 wsmap="managed" autogen="VBoxEvent" id="OnVRDPServerChange" … … 15385 14558 15386 14559 <interface 15387 name="IRemoteDisplayInfoChange Event" extends="IEvent"14560 name="IRemoteDisplayInfoChangedEvent" extends="IEvent" 15388 14561 uuid="65B556C5-2A99-47D8-B311-FC177F0914CD" 15389 14562 wsmap="managed" autogen="VBoxEvent" id="OnRemoteDisplayInfoChange" … … 15397 14570 15398 14571 <interface 15399 name="IUSBControllerChange Event" extends="IEvent"14572 name="IUSBControllerChangedEvent" extends="IEvent" 15400 14573 uuid="93BADC0C-61D9-4940-A084-E6BB29AF3D83" 15401 14574 wsmap="managed" autogen="VBoxEvent" id="OnUSBControllerChange" … … 15410 14583 15411 14584 <interface 15412 name="IUSBDeviceStateChange Event" extends="IEvent"14585 name="IUSBDeviceStateChangedEvent" extends="IEvent" 15413 14586 uuid="806da61b-6679-422a-b629-51b06b0c6d93" 15414 14587 wsmap="managed" autogen="VBoxEvent" id="OnUSBDeviceStateChange" … … 15451 14624 15452 14625 <interface 15453 name="ISharedFolderChange Event" extends="IEvent"14626 name="ISharedFolderChangedEvent" extends="IEvent" 15454 14627 uuid="B66349B5-3534-4239-B2DE-8E1535D94C0B" 15455 14628 wsmap="managed" autogen="VBoxEvent" id="OnSharedFolderChange" … … 15548 14721 15549 14722 <interface 15550 name="IEventSourceChange Event" extends="IEvent"14723 name="IEventSourceChangedEvent" extends="IEvent" 15551 14724 uuid="e7932cb8-f6d4-4ab6-9cbf-558eb8959a6a" 15552 14725 waitable="yes" … … 15571 14744 15572 14745 <interface 15573 name="IExtraDataChange Event" extends="IEvent"14746 name="IExtraDataChangedEvent" extends="IEvent" 15574 14747 uuid="024F00CE-6E0B-492A-A8D0-968472A94DC7" 15575 14748 wsmap="managed" autogen="VBoxEvent" id="OnExtraDataChange" … … 15734 14907 namespace="virtualbox.org"> 15735 14908 <interface name="IVirtualBox" default="yes"/> 15736 <eventsink name="IVirtualBoxCallback" default="yes"/>15737 14909 </class> 15738 14910 </module> … … 15747 14919 namespace="virtualbox.org"> 15748 14920 <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"/>15757 14921 </class> 15758 14922 </module> -
trunk/src/VBox/Main/idl/midl.xsl
r29874 r30825 838 838 839 839 </xsl:stylesheet> 840 -
trunk/src/VBox/Main/include/ConsoleImpl.h
r30764 r30825 36 36 class AudioSniffer; 37 37 class ConsoleVRDPServer; 38 class ConsoleCallbackRegistration; /* See ConsoleImpl.cpp. */39 38 class VMMDev; 40 39 class Progress; … … 84 83 #ifdef RT_OS_WINDOWS 85 84 , public CComCoClass<Console, &CLSID_Console> 86 , public IConnectionPointContainerImpl<Console>87 , public IConnectionPointImpl<Console, &IID_IConsoleCallback, CComDynamicUnkArray>88 85 #endif 89 86 { … … 104 101 COM_INTERFACE_ENTRY(IConnectionPointContainer) 105 102 END_COM_MAP() 106 107 #ifdef RT_OS_WINDOWS108 BEGIN_CONNECTION_POINT_MAP(Console)109 CONNECTION_POINT_ENTRY(IID_IConsoleCallback)110 END_CONNECTION_POINT_MAP()111 #endif112 113 103 114 104 Console(); … … 163 153 STDMETHOD(RestoreSnapshot)(ISnapshot *aSnapshot, IProgress **aProgress); 164 154 STDMETHOD(Teleport)(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress); 165 STDMETHOD(RegisterCallback)(IConsoleCallback *aCallback);166 STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback);167 155 168 156 // public methods for internal purposes only … … 682 670 ComObjPtr<Progress> mptrCancelableProgress; 683 671 684 typedef std::list<ConsoleCallbackRegistration> CallbackList;685 CallbackList mCallbacks;686 687 672 struct 688 673 { … … 733 718 mCallbackData; 734 719 735 #ifdef RT_OS_WINDOWS736 ComEventsHelper mComEvHelper;737 #endif738 739 720 friend struct VMTask; 740 721 }; -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r30764 r30825 61 61 #ifdef RT_OS_WINDOWS 62 62 , public CComCoClass<VirtualBox, &CLSID_VirtualBox> 63 , public IConnectionPointContainerImpl<VirtualBox>64 , public IConnectionPointImpl<VirtualBox, &IID_IVirtualBoxCallback, CComDynamicUnkArray>65 63 #endif 66 64 { … … 68 66 public: 69 67 70 typedef std::list< VirtualBoxCallbackRegistration > CallbackList;71 68 typedef std::list< ComPtr<IInternalSessionControl> > InternalControlList; 72 69 … … 89 86 COM_INTERFACE_ENTRY(IConnectionPointContainer) 90 87 END_COM_MAP() 91 92 #ifdef RT_OS_WINDOWS93 BEGIN_CONNECTION_POINT_MAP(VirtualBox)94 CONNECTION_POINT_ENTRY(IID_IVirtualBoxCallback)95 END_CONNECTION_POINT_MAP()96 97 typedef CComDynamicUnkArray EventListenersList;98 #endif99 88 100 89 // to postpone generation of the default ctor/dtor … … 174 163 STDMETHOD(OpenExistingSession) (ISession *aSession, IN_BSTR aMachineId); 175 164 176 STDMETHOD(RegisterCallback) (IVirtualBoxCallback *aCallback);177 STDMETHOD(UnregisterCallback) (IVirtualBoxCallback *aCallback);178 179 165 STDMETHOD(WaitForPropertyChange) (IN_BSTR aWhat, ULONG aTimeout, 180 166 BSTR *aChanged, BSTR *aValues); … … 217 203 void updateClientWatcher(); 218 204 219 void removeDeadCallback(const ComPtr<IVirtualBoxCallback> &aCallback);220 221 205 void onMachineStateChange(const Guid &aId, MachineState_T aState); 222 206 void onMachineDataChange(const Guid &aId); -
trunk/src/VBox/Main/xpcom/module.cpp
r30627 r30825 45 45 #include "ConsoleImpl.h" 46 46 #include "ConsoleVRDPServer.h" 47 #include "VirtualBoxCallbackImpl.h"48 47 49 48 #include "Logging.h" … … 78 77 NS_DECL_CLASSINFO(Console) 79 78 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole) 80 NS_DECL_CLASSINFO(CallbackWrapper)81 NS_IMPL_THREADSAFE_ISUPPORTS3_CI(CallbackWrapper, IVirtualBoxCallback, IConsoleCallback, ILocalOwner)82 79 83 80 /** … … 135 132 NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC (Session) 136 133 137 NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC (CallbackWrapper)138 139 140 134 /** 141 135 * Component definition table. … … 157 151 &NS_CLASSINFO_NAME(Session) // global class info & flags 158 152 }, 159 {160 "CallbackWrapper component", // description161 NS_CALLBACKWRAPPER_CID, NS_CALLBACKWRAPPER_CONTRACTID, // CID/ContractID162 CallbackWrapperConstructor, // constructor function163 NULL, // registration function164 NULL, // deregistration function165 NULL, // destructor function166 NS_CI_INTERFACE_GETTER_NAME(CallbackWrapper), // interfaces function167 NULL, // language helper168 &NS_CLASSINFO_NAME(CallbackWrapper) // global class info & flags169 }170 171 153 }; 172 154
Note:
See TracChangeset
for help on using the changeset viewer.

