Changeset 30627 in vbox for trunk/src/VBox/Main/DisplayImpl.cpp
- Timestamp:
- Jul 5, 2010 5:08:55 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 63362
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/DisplayImpl.cpp
r30032 r30627 647 647 } 648 648 649 mParent->RegisterCallback (this); 649 { 650 // register listener for state change events 651 ComPtr<IEventSource> es; 652 mParent->COMGETTER(EventSource)(es.asOutParam()); 653 com::SafeArray <VBoxEventType_T> eventTypes; 654 eventTypes.push_back(VBoxEventType_OnStateChange); 655 es->RegisterListener(this, ComSafeArrayAsInParam(eventTypes), true); 656 } 650 657 651 658 /* Confirm a successful initialization */ … … 673 680 674 681 if (mParent) 675 mParent->UnregisterCallback (this); 682 { 683 ComPtr<IEventSource> es; 684 mParent->COMGETTER(EventSource)(es.asOutParam()); 685 es->UnregisterListener(this); 686 } 676 687 677 688 unconst(mParent) = NULL; … … 725 736 } 726 737 727 // IConsoleCallback method 728 STDMETHODIMP Display::OnStateChange(MachineState_T machineState) 729 { 730 if ( machineState == MachineState_Running 731 || machineState == MachineState_Teleporting 732 || machineState == MachineState_LiveSnapshotting 733 ) 734 { 735 LogFlowFunc(("Machine is running.\n")); 736 737 mfMachineRunning = true; 738 } 739 else 740 mfMachineRunning = false; 738 // IEventListener method 739 STDMETHODIMP Display::HandleEvent(IEvent * aEvent) 740 { 741 VBoxEventType_T aType = VBoxEventType_Invalid; 742 743 aEvent->COMGETTER(Type)(&aType); 744 switch (aType) 745 { 746 case VBoxEventType_OnStateChange: 747 { 748 ComPtr<IStateChangeEvent> scev = aEvent; 749 Assert(scev); 750 MachineState_T machineState; 751 scev->COMGETTER(State)(&machineState); 752 if ( machineState == MachineState_Running 753 || machineState == MachineState_Teleporting 754 || machineState == MachineState_LiveSnapshotting 755 ) 756 { 757 LogFlowFunc(("Machine is running.\n")); 758 759 mfMachineRunning = true; 760 } 761 else 762 mfMachineRunning = false; 763 break; 764 } 765 default: 766 AssertFailed(); 767 } 741 768 742 769 return S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.