Changeset 31572 in vbox
- Timestamp:
- Aug 11, 2010 2:08:41 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/EventImpl.cpp
r31269 r31572 684 684 case VBoxEventType_Any: 685 685 return TRUE; 686 case VBoxEventType_Vetoable: 687 return (what == VBoxEventType_OnExtraDataCanChange) 688 || (what == VBoxEventType_OnCanShowWindow); 686 689 case VBoxEventType_MachineEvent: 687 690 return (what == VBoxEventType_OnMachineStateChanged) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r31568 r31572 13671 13671 <const name="Any" value="1"> 13672 13672 <desc> 13673 Wildcard for all events. Events of this type are never delivered, and only used in 13673 Wildcard for all events. 13674 Events of this type are never delivered, and only used in 13674 13675 registerListener() call to simplify registration. 13675 13676 </desc> 13676 13677 </const> 13677 13678 13678 <const name="MachineEvent" value="2"> 13679 <const name="Vetoable" value="2"> 13680 <desc> 13681 Wildcard for all vetoable events. Events of this type are never delivered, and only 13682 used in registerListener() call to simplify registration. 13683 </desc> 13684 </const> 13685 13686 <const name="MachineEvent" value="3"> 13679 13687 <desc> 13680 13688 Wildcard for all machine events. Events of this type are never delivered, and only used in … … 13683 13691 </const> 13684 13692 13685 <const name="SnapshotEvent" value=" 3">13693 <const name="SnapshotEvent" value="4"> 13686 13694 <desc> 13687 13695 Wildcard for all snapshot events. Events of this type are never delivered, and only used in … … 13690 13698 </const> 13691 13699 13692 <const name="InputEvent" value=" 4">13700 <const name="InputEvent" value="5"> 13693 13701 <desc> 13694 13702 Wildcard for all input device (keyboard, mouse) events. -
trunk/src/VBox/Main/idl/comimpl.xsl
r31501 r31572 240 240 <xsl:choose> 241 241 <xsl:when test="$extends='IEvent'"> 242 </xsl:when> 243 <xsl:when test="$extends='IReusableEvent'"> 242 244 </xsl:when> 243 245 <xsl:when test="//interface[@name=$extends]"> … … 428 430 <xsl:value-of select=" ' // skipping IEvent attributes '" /> 429 431 </xsl:when> 432 <xsl:when test="$extends='IReusableEvent'"> 433 <xsl:value-of select=" ' // skipping IReusableEvent attributes '" /> 434 </xsl:when> 435 <xsl:when test="$extends='IVetoEvent'"> 436 <xsl:value-of select=" ' // skipping IVetoEvent attributes '" /> 437 </xsl:when> 430 438 <xsl:when test="//interface[@name=$extends]"> 431 439 <xsl:call-template name="genAttrCode"> … … 446 454 <xsl:param name="implName" /> 447 455 <xsl:param name="isVeto" /> 456 <xsl:param name="isReusable" /> 448 457 449 458 <xsl:value-of select="concat('class ATL_NO_VTABLE ',$implName, … … 519 528 ]]></xsl:text> 520 529 </xsl:when> 530 <xsl:when test="$isReusable='yes'"> 531 <xsl:text> 532 <![CDATA[ 533 HRESULT init(IEventSource* aSource, VBoxEventType_T aType, BOOL aWaitable = FALSE) 534 { 535 mGeneration = 1; 536 return mEvent->init(aSource, aType, aWaitable); 537 } 538 STDMETHOD(COMGETTER(Generation)) (ULONG *aGeneration) 539 { 540 *aGeneration = mGeneration; 541 return S_OK; 542 } 543 STDMETHOD(Reuse) () 544 { 545 ASMAtomicIncU32(&mGeneration); 546 return S_OK; 547 } 548 private: 549 volatile ULONG mGeneration; 550 ComObjPtr<VBoxEvent> mEvent; 551 ]]></xsl:text> 552 </xsl:when> 521 553 <xsl:otherwise> 522 554 <xsl:text><![CDATA[ … … 548 580 <xsl:template name="genSwitchCase"> 549 581 <xsl:param name="implName" /> 582 <xsl:param name="reinit" /> 550 583 <xsl:variable name="waitable"> 551 584 <xsl:choose> … … 560 593 <xsl:value-of select="concat(' case VBoxEventType_', @id, ': ')"/> 561 594 <xsl:value-of select=" ' { '"/> 562 <xsl:value-of select="concat(' ComObjPtr<', $implName, '> obj; ')"/> 563 <xsl:value-of select=" ' obj.createObject(); '"/> 564 <xsl:value-of select="concat(' obj->init(aSource, aType, ', $waitable, '); ')"/> 595 <xsl:choose> 596 <xsl:when test="$reinit='yes'"> 597 <xsl:value-of select="concat(' ComPtr<', $implName, '> obj; ')"/> 598 <xsl:value-of select=" ' obj = mEvent; '"/> 599 <xsl:value-of select=" ' Assert(obj); '"/> 600 <xsl:value-of select=" ' obj->Reuse(); '"/> 601 </xsl:when> 602 <xsl:otherwise> 603 <xsl:value-of select="concat(' ComObjPtr<', $implName, '> obj; ')"/> 604 <xsl:value-of select=" ' obj.createObject(); '"/> 605 <xsl:value-of select="concat(' obj->init(aSource, aType, ', $waitable, '); ')"/> 606 </xsl:otherwise> 607 </xsl:choose> 565 608 <xsl:call-template name="genAttrInitCode"> 566 609 <xsl:with-param name="name" select="@name" /> 567 610 <xsl:with-param name="obj" select="'obj'" /> 568 611 </xsl:call-template> 569 <xsl:value-of select=" ' obj.queryInterfaceTo(mEvent.asOutParam()); '"/> 612 <xsl:if test="not($reinit='yes')"> 613 <xsl:value-of select=" ' obj.queryInterfaceTo(mEvent.asOutParam()); '"/> 614 </xsl:if> 570 615 <xsl:value-of select=" ' break; '"/> 571 616 <xsl:value-of select=" ' } '"/> … … 590 635 <xsl:call-template name="genSwitchCase"> 591 636 <xsl:with-param name="implName" select="$implName" /> 637 <xsl:with-param name="reinit" select="'no'" /> 592 638 </xsl:call-template> 593 639 </xsl:for-each> … … 595 641 <xsl:text><![CDATA[ 596 642 default: 597 if (1) AssertFailed(); 643 AssertFailed(); 644 } 645 va_end(args); 646 647 return S_OK; 648 } 649 ]]></xsl:text> 650 651 <xsl:text><![CDATA[ 652 HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...) 653 { 654 va_list args; 655 656 va_start(args, aType); 657 switch (aType) 658 { 659 ]]></xsl:text> 660 661 <xsl:for-each select="//interface[@autogen=$G_kind and @extends='IReusableEvent']"> 662 <xsl:variable name="implName"> 663 <xsl:value-of select="substring(@name, 2)" /> 664 </xsl:variable> 665 <xsl:call-template name="genSwitchCase"> 666 <xsl:with-param name="implName" select="$implName" /> 667 <xsl:with-param name="reinit" select="'yes'" /> 668 </xsl:call-template> 669 </xsl:for-each> 670 671 <xsl:text><![CDATA[ 672 default: 673 AssertFailed(); 598 674 } 599 675 va_end(args); … … 613 689 <xsl:text><![CDATA[ 614 690 #include <VBox/com/array.h> 691 #include <iprt/asm.h> 615 692 #include "EventImpl.h" 616 693 ]]></xsl:text> … … 631 708 </xsl:if> 632 709 </xsl:variable> 710 <xsl:variable name="isReusable"> 711 <xsl:if test="@extends='IReusableEvent'"> 712 <xsl:value-of select="'yes'" /> 713 </xsl:if> 714 </xsl:variable> 633 715 <xsl:call-template name="genEventImpl"> 634 716 <xsl:with-param name="implName" select="$implName" /> 635 717 <xsl:with-param name="isVeto" select="$isVeto" /> 718 <xsl:with-param name="isReusable" select="$isReusable" /> 636 719 </xsl:call-template> 637 720 </xsl:when> -
trunk/src/VBox/Main/include/EventImpl.h
r30739 r31572 180 180 public: 181 181 VBoxEventDesc() 182 : mEvent(0) 182 : mEvent(0), mEventSource(0) 183 183 {} 184 184 ~VBoxEventDesc() … … 191 191 */ 192 192 HRESULT init(IEventSource* aSource, VBoxEventType_T aType, ...); 193 194 /** 195 * Function similar to the above, but assumes that init() for this type already called once, 196 * so no need to allocate memory, and only reinit fields. Assumes event is subtype of 197 * IReusableEvent, asserts otherwise. 198 */ 199 HRESULT reinit(VBoxEventType_T aType, ...); 200 193 201 194 202 void getEvent(IEvent ** aEvent)
Note:
See TracChangeset
for help on using the changeset viewer.