Changeset 30698 in vbox
- Timestamp:
- Jul 7, 2010 9:47:45 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 63459
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r30627 r30698 310 310 psev = ctx['global'].queryInterface(ev, 'IMousePointerShapeChangeEvent') 311 311 if psev: 312 print "pointer shape event: w=%d h=%d" %(psev.width, psev.height)313 312 shape = ctx['global'].getArray(psev, 'shape') 314 313 if shape is None: -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
r30680 r30698 50 50 } 51 51 52 53 /** 54 * @todo: instead of double wrapping of events into signals maybe it 55 * make sense to use passive listeners, and peek up events in main thread. 56 */ 52 57 STDMETHODIMP UIMainEventListener::HandleEvent(IEvent *pEvent) 53 58 { … … 217 222 return S_OK; 218 223 } 219 -
trunk/src/VBox/Main/EventImpl.cpp
r30591 r30698 14 14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 15 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 */ 17 18 /** 19 * Theory of operations. 20 * 21 * This code implements easily extensible event mechanism, letting us 22 * to make any VirtualBox object an event source (by aggregating an EventSource instance). 23 * Another entity could subscribe to the event source for events it is interested in. 24 * If an event is waitable, it's possible to wait until all listeners 25 * registered at the moment of firing event as ones interested in this 26 * event acknowledged that they finished event processing (thus allowing 27 * vetoable events). 28 * 29 * Listeners can be registered as active or passive ones, defining policy of delivery. 30 * For *active* listeners, their HandleEvent() method is invoked when event is fired by 31 * the event source (pretty much callbacks). 32 * For *passive* listeners, it's up to an event consumer to perform GetEvent() operation 33 * with given listener, and then perform desired operation with returned event, if any. 34 * For passive listeners case, listener instance serves as merely a key referring to 35 * particular event consumer, thus HandleEvent() implementation isn't that important. 36 * IEventSource's CreateListener() could be used to create such a listener. 37 * Passive mode is designed for transports not allowing callbacks, such as webservices 38 * running on top of HTTP, and for situations where consumer wants exact control on 39 * context where event handler is executed (such as GUI thread for some toolkits). 40 * 41 * Internal EventSource data structures are optimized for fast event delivery, while 42 * listener registration/unregistration operations are expected being pretty rare. 43 * Passive mode listeners keep an internal event queue for all events they receive, 44 * and all waitable events are addded to the pending events map. This map keeps track 45 * of how many listeners are still not acknowledged their event, and once this counter 46 * reach zero, element is removed from pending events map, and event is marked as processed. 47 * Thus if passive listener's user forgets to call IEventSource's EventProcessed() 48 * waiters may never know that event processing finished. 16 49 */ 17 50 … … 191 224 } 192 225 226 /* @todo: maybe while loop for spurious wakeups? */ 193 227 int vrc = ::RTSemEventWait(m->mWaitEvent, aTimeout); 194 228 AssertMsg(RT_SUCCESS(vrc) || vrc == VERR_TIMEOUT || vrc == VERR_INTERRUPTED, … … 498 532 if (!mActive) 499 533 { 534 // at this moment nobody could add elements to our queue, so we can safely 535 // clean it up, otherwise there will be pending events map elements 536 PendingEventsMap* aPem = &mOwner->m->mPendingMap; 537 while (true) 538 { 539 ComPtr<IEvent> aEvent; 540 541 if (mQueue.empty()) 542 break; 543 544 mQueue.front().queryInterfaceTo(aEvent.asOutParam()); 545 mQueue.pop_front(); 546 547 BOOL aWaitable = FALSE; 548 aEvent->COMGETTER(Waitable)(&aWaitable); 549 if (aWaitable) 550 { 551 PendingEventsMap::iterator pit = aPem->find(aEvent); 552 if (pit != aPem->end()) 553 eventProcessed(aEvent, pit); 554 } 555 } 556 500 557 ::RTCritSectDelete(&mcsQLock); 501 558 ::RTSemEventDestroy(mQEvent); … … 847 904 * This class serves as feasible listener implementation 848 905 * which could be used by clients not able to create local 849 * COM objects, but still willing to rec ieve event906 * COM objects, but still willing to receive event 850 907 * notifications in passive mode, such as webservices. 851 908 */ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r30633 r30698 14619 14619 <const name="OnMachineStateChange" value="32"> 14620 14620 <desc> 14621 <see>I VirtualBoxCallback::onMachineStateChange</see>14621 <see>IMachineStateChangeEvent</see> 14622 14622 </desc> 14623 14623 </const> 14624 14624 <const name="OnMachineDataChange" value="33"> 14625 14625 <desc> 14626 <see>I VirtualBoxCallback::onMachineDataChange</see>14626 <see>IMachineDataChangeEvent</see> 14627 14627 </desc> 14628 14628 </const> 14629 14629 <const name="OnExtraDataChange" value="34"> 14630 14630 <desc> 14631 <see>I VirtualBoxCallback::onExtraDataChange</see>14631 <see>IExtraDataChangeEvent</see> 14632 14632 </desc> 14633 14633 </const> 14634 14634 <const name="OnExtraDataCanChange" value="35"> 14635 14635 <desc> 14636 <see>I VirtualBoxCallback::onExtraDataChange</see>14636 <see>IExtraDataCanChangeEvent</see> 14637 14637 </desc> 14638 14638 </const> 14639 14639 <const name="OnMediumRegistered" value="36"> 14640 14640 <desc> 14641 <see>I VirtualBoxCallback::onMediumRegistered</see>14641 <see>IMediumRegistered</see> 14642 14642 </desc> 14643 14643 </const> 14644 14644 <const name="OnMachineRegistered" value="37"> 14645 14645 <desc> 14646 <see>I VirtualBoxCallback::onMachineRegistered</see>14646 <see>IMachineRegisteredEvent</see> 14647 14647 </desc> 14648 14648 </const> 14649 14649 <const name="OnSessionStateChange" value="38"> 14650 14650 <desc> 14651 <see>I VirtualBoxCallback::onSessionStateChange</see>14651 <see>ISessionStateChangeEvent</see> 14652 14652 </desc> 14653 14653 </const> 14654 14654 <const name="OnSnapshotTaken" value="39"> 14655 14655 <desc> 14656 <see>I VirtualBoxCallback::onSnapshotTaken</see>14656 <see>ISnapshotTakenEvent</see> 14657 14657 </desc> 14658 14658 </const> 14659 14659 <const name="OnSnapshotDeleted" value="40"> 14660 14660 <desc> 14661 <see>I VirtualBoxCallback::onSnapshotDeleted</see>14661 <see>ISnapshotDeletedEvent</see> 14662 14662 </desc> 14663 14663 </const> 14664 14664 <const name="OnSnapshotChange" value="41"> 14665 14665 <desc> 14666 <see>I VirtualBoxCallback::onSnapshotChange</see>14666 <see>ISnapshotChangeEvent</see> 14667 14667 </desc> 14668 14668 </const> 14669 14669 <const name="OnGuestPropertyChange" value="42"> 14670 14670 <desc> 14671 <see>I VirtualBoxCallback::onGuestPropertyChange</see>14671 <see>IGuestPropertyChangeEvent</see> 14672 14672 </desc> 14673 14673 </const> … … 14675 14675 <const name="OnMousePointerShapeChange" value="43"> 14676 14676 <desc> 14677 <see>I ConsoleCallback::onMousePointerShapeChange</see>14677 <see>IMousePointerShapeChangeEvent</see> 14678 14678 </desc> 14679 14679 </const> 14680 14680 <const name="OnMouseCapabilityChange" value="44"> 14681 14681 <desc> 14682 <see>I ConsoleCallback::onMouseCapabilityChange</see>14682 <see>IMouseCapabilityChangeEvent</see> 14683 14683 </desc> 14684 14684 </const> 14685 14685 <const name="OnKeyboardLedsChange" value="45"> 14686 14686 <desc> 14687 <see>I ConsoleCallback::onKeyboardLedsChange</see>14687 <see>IKeyboardLedsChangeEvent</see> 14688 14688 </desc> 14689 14689 </const> 14690 14690 <const name="OnStateChange" value="46"> 14691 14691 <desc> 14692 <see>I ConsoleCallback::onStateChange</see>14692 <see>IStateChangeEvent</see> 14693 14693 </desc> 14694 14694 </const> 14695 14695 <const name="OnAdditionsStateChange" value="47"> 14696 14696 <desc> 14697 <see>I ConsoleCallback::onAdditionsStateChange</see>14697 <see>IAdditionsStateChangeEvent</see> 14698 14698 </desc> 14699 14699 </const> 14700 14700 <const name="OnNetworkAdapterChange" value="48"> 14701 14701 <desc> 14702 <see>I ConsoleCallback::onNetworkAdapterChange</see>14702 <see>INetworkAdapterChangeEvent</see> 14703 14703 </desc> 14704 14704 </const> 14705 14705 <const name="OnSerialPortChange" value="49"> 14706 14706 <desc> 14707 <see>I ConsoleCallback::onSerialPortChange</see>14707 <see>ISerialPortChangeEvent</see> 14708 14708 </desc> 14709 14709 </const> 14710 14710 <const name="OnParallelPortChange" value="50"> 14711 14711 <desc> 14712 <see>I ConsoleCallback::onParallelPortChange</see>14712 <see>IParallelPortChangeEvent</see> 14713 14713 </desc> 14714 14714 </const> 14715 14715 <const name="OnStorageControllerChange" value="51"> 14716 14716 <desc> 14717 <see>I ConsoleCallback::onStorageControllerChange</see>14717 <see>IStorageControllerChangeEvent</see> 14718 14718 </desc> 14719 14719 </const> 14720 14720 <const name="OnMediumChange" value="52"> 14721 14721 <desc> 14722 <see>I ConsoleCallback::onMediumChange</see>14722 <see>IMediumChangeEvent</see> 14723 14723 </desc> 14724 14724 </const> 14725 14725 <const name="OnVRDPServerChange" value="53"> 14726 14726 <desc> 14727 <see>I ConsoleCallback::onVRDPServerChange</see>14727 <see>IVRDPServerChangeEvent</see> 14728 14728 </desc> 14729 14729 </const> 14730 14730 <const name="OnUSBControllerChange" value="54"> 14731 14731 <desc> 14732 <see>I ConsoleCallback::onUSBControllerChange</see>14732 <see>IUSBControllerChangeEvent</see> 14733 14733 </desc> 14734 14734 </const> 14735 14735 <const name="OnUSBDeviceStateChange" value="55"> 14736 14736 <desc> 14737 <see>I ConsoleCallback::onUSBDeviceStateChange</see>14737 <see>IUSBDeviceStateChangeEvent</see> 14738 14738 </desc> 14739 14739 </const> 14740 14740 <const name="OnSharedFolderChange" value="56"> 14741 14741 <desc> 14742 <see>I ConsoleCallback::onSharedFolderChange</see>14742 <see>ISharedFolderChangeEvent</see> 14743 14743 </desc> 14744 14744 </const> 14745 14745 <const name="OnRuntimeError" value="57"> 14746 14746 <desc> 14747 <see>I ConsoleCallback::onRuntimeError</see>14747 <see>IRuntimeErrorEvent</see> 14748 14748 </desc> 14749 14749 </const> 14750 14750 <const name="OnCanShowWindow" value="58"> 14751 14751 <desc> 14752 <see>IC onsoleCallback::onCanShowWindow</see>14752 <see>ICanShowWindowEvent</see> 14753 14753 </desc> 14754 14754 </const> 14755 14755 <const name="OnShowWindow" value="59"> 14756 14756 <desc> 14757 <see>I ConsoleCallback::onShowWindow</see>14757 <see>IShowWindowEvent</see> 14758 14758 </desc> 14759 14759 </const> 14760 14760 <const name="OnCPUChange" value="60"> 14761 14761 <desc> 14762 <see>IC onsoleCallback::onCPUChange</see>14762 <see>ICPUChangeEvent</see> 14763 14763 </desc> 14764 14764 </const> 14765 14765 <const name="OnRemoteDisplayInfoChange" value="61"> 14766 14766 <desc> 14767 <see>I ConsoleCallback::onRemoteDisplayInfoChange</see>14767 <see>IRemoteDisplayInfoChangeEvent</see> 14768 14768 </desc> 14769 14769 </const> … … 14894 14894 <method name="handleEvent"> 14895 14895 <desc> 14896 Handle event callback (called directly by IEventSource in active mode, or by event processor thread14897 in passive mode).14896 Handle event callback (called directly by IEventSource in active mode, or could be 14897 called by event processor thread in passive mode). 14898 14898 </desc> 14899 14899 <param name="event" type="IEvent" dir="in"> … … 14909 14909 wsmap="managed" 14910 14910 > 14911 <desc>Generic event, aiming to replace callbacks mechanism.</desc> 14911 <desc> 14912 Generic event. Usually events implements some of IEvent subinterfaces, so 14913 standard use pattern is to check 'type' attribute and downcast (with QueryInterface()) 14914 appropraitely. 14915 </desc> 14912 14916 14913 14917 <attribute name="type" readonly="yes" type="VBoxEventType">
Note:
See TracChangeset
for help on using the changeset viewer.