Example #1
0
void
nsXMLEventsManager::ContentRemoved(nsIDocument* aDocument, 
                                   nsIContent* aContainer,
                                   nsIContent* aChild,
                                   PRInt32 aIndexInContainer)
{
  if (!aChild || !aChild->IsNodeOfType(nsINode::eELEMENT))
    return;
  //Note, we can't use IDs here, the observer may not always have an ID.
  //And to remember: the same observer can be referenced by many 
  //XMLEventsListeners

  //If the content was an XML Events observer or handler
  mListeners.Enumerate(EnumAndSetIncomplete, aChild);

  //If the content was an XML Events attributes container
  if (RemoveListener(aChild)) {
    //for aContainer.appendChild(aContainer.removeChild(aChild));
    AddXMLEventsContent(aChild);
  }

  PRUint32 count = aChild->GetChildCount();
  for (PRUint32 i = 0; i < count; ++i) {
    ContentRemoved(aDocument, aChild, aChild->GetChildAt(i), i);
  }
}
Example #2
0
void CTrayIcon::AddListener( ITrayIconListener *const pListener)
{
	if(!pListener)
		return;
	RemoveListener(pListener);
	m_listeners.push_front(pListener);
}
Example #3
0
void CResultSet::Action(const CDbapiEvent& e)
{
    _TRACE(GetIdent() << " " << (void*)this
              << ": '" << e.GetName()
              << "' received from " << e.GetSource()->GetIdent());

    if(dynamic_cast<const CDbapiClosedEvent*>(&e) != 0 ) {
        if( dynamic_cast<CStatement*>(e.GetSource()) != 0
            || dynamic_cast<CCallableStatement*>(e.GetSource()) != 0 ) {
            if( m_rs != 0 ) {
                _TRACE("Discarding old CDB_Result " << (void*)m_rs);
                Invalidate();
            }
        }
    }
    else if(dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {

        RemoveListener(e.GetSource());

        if(dynamic_cast<CStatement*>(e.GetSource()) != 0
           || dynamic_cast<CCursor*>(e.GetSource()) != 0
           || dynamic_cast<CCallableStatement*>(e.GetSource()) != 0 ) {
            _TRACE("Deleting " << GetIdent() << " " << (void*)this);
            delete this;
        }
    }
}
Example #4
0
NS_IMETHODIMP
VibrateWindowListener::HandleEvent(nsIDOMEvent* aEvent)
{
  nsCOMPtr<nsIDOMEventTarget> target;
  aEvent->GetTarget(getter_AddRefs(target));
  nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(target);

  bool hidden = true;
  if (doc) {
    doc->GetMozHidden(&hidden);
  }

  if (hidden) {
    // It's important that we call CancelVibrate(), not Vibrate() with an
    // empty list, because Vibrate() will fail if we're no longer focused, but
    // CancelVibrate() will succeed, so long as nobody else has started a new
    // vibration pattern.
    nsCOMPtr<nsIDOMWindow> window = do_QueryReferent(mWindow);
    hal::CancelVibrate(window);
    RemoveListener();
    gVibrateWindowListener = NULL;
    // Careful: The line above might have deleted |this|!
  }

  return NS_OK;
}
Example #5
0
void CStatement::Action(const CDbapiEvent& e)
{
    _TRACE(GetIdent() << " " << (void*)this << ": '" << e.GetName()
           << "' received from " << e.GetSource()->GetIdent());

    CResultSet *rs;

    if (dynamic_cast<const CDbapiFetchCompletedEvent*>(&e) != 0 ) {
        if( m_irs != 0 && (rs = dynamic_cast<CResultSet*>(e.GetSource())) != 0 ) {
            if( rs == m_irs ) {
                m_rowCount = rs->GetTotalRows();
                _TRACE("Rowcount from the last resultset: " << m_rowCount);
            }
        }
    }

    if (dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
        RemoveListener(e.GetSource());
        if(dynamic_cast<CConnection*>(e.GetSource()) != 0 ) {
            _TRACE("Deleting " << GetIdent() << " " << (void*)this);
            delete this;
        }
        else if( m_irs != 0 && (rs = dynamic_cast<CResultSet*>(e.GetSource())) != 0 ) {
            if( rs == m_irs ) {
                _TRACE("Clearing cached CResultSet " << (void*)m_irs);
                m_irs = 0;
            }
        }
    }
}
Example #6
0
	void Reset()
	{
		if (m_weapId != 0)
		{
			RemoveListener(m_weapId, this);
			m_weapId = 0;
		}
		m_active = false;
	}
Example #7
0
void CConnection::Action(const CDbapiEvent& e)
{
    _TRACE(GetIdent() << " " << (void*)this << ": '" << e.GetName()
        << "' received from " << e.GetSource()->GetIdent() << " " << (void*)e.GetSource());

    if(dynamic_cast<const CDbapiClosedEvent*>(&e) != 0 ) {
/*
        CStatement *stmt;
        CCallableStatement *cstmt;
        CCursor *cursor;
        CDBAPIBulkInsert *bulkInsert;
        if( (cstmt = dynamic_cast<CCallableStatement*>(e.GetSource())) != 0 ) {
            if( cstmt == m_cstmt ) {
                _TRACE("CConnection: Clearing cached callable statement " << (void*)m_cstmt);
                m_cstmt = 0;
            }
        }
        else if( (stmt = dynamic_cast<CStatement*>(e.GetSource())) != 0 ) {
            if( stmt == m_stmt ) {
                _TRACE("CConnection: Clearing cached statement " << (void*)m_stmt);
                m_stmt = 0;
            }
        }
        else if( (cursor = dynamic_cast<CCursor*>(e.GetSource())) != 0 ) {
            if( cursor == m_cursor ) {
                _TRACE("CConnection: Clearing cached cursor " << (void*)m_cursor);
                m_cursor = 0;
            }
        }
        else if( (bulkInsert = dynamic_cast<CDBAPIBulkInsert*>(e.GetSource())) != 0 ) {
            if( bulkInsert == m_bulkInsert ) {
                _TRACE("CConnection: Clearing cached bulkinsert " << (void*)m_bulkInsert);
                m_bulkInsert = 0;
            }
        }
*/
        if( m_connCounter == 1 )
            m_connUsed = false;
    }
    else if(dynamic_cast<const CDbapiAuxDeletedEvent*>(&e) != 0 ) {
        if( m_connCounter > 1 ) {
            --m_connCounter;
            _TRACE("Server: " << GetCDB_Connection()->ServerName()
                   <<", connections left: " << m_connCounter);
        }
        else
            m_connUsed = false;
    }
    else if(dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
        RemoveListener(e.GetSource());
        if(dynamic_cast<CDataSource*>(e.GetSource()) != 0 ) {
            if( m_ownership == eNoOwnership ) {
                delete this;
            }
        }
    }
}
NS_IMETHODIMP
nsSliderFrame::RemoveFrame(nsIAtom*        aListName,
                           nsIFrame*       aOldFrame)
{
  nsresult rv = nsBoxFrame::RemoveFrame(aListName, aOldFrame);
  if (mFrames.IsEmpty())
    RemoveListener();

  return rv;
}
Example #9
0
void
nsXMLEventsManager::AttributeChanged(nsIDocument* aDocument,
                                     nsIContent* aContent,
                                     PRInt32 aNameSpaceID,
                                     nsIAtom* aAttribute,
                                     PRInt32 aModType,
                                     PRUint32 aStateMask)
{
  if (aNameSpaceID == kNameSpaceID_XMLEvents &&
      (aAttribute == nsGkAtoms::event ||
       aAttribute == nsGkAtoms::handler ||
       aAttribute == nsGkAtoms::target ||
       aAttribute == nsGkAtoms::observer ||
       aAttribute == nsGkAtoms::phase ||
       aAttribute == nsGkAtoms::propagate)) {
    RemoveListener(aContent);
    AddXMLEventsContent(aContent);
    nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aContent);
  }
  else {
    if (aContent->NodeInfo()->Equals(nsGkAtoms::listener,
                                     kNameSpaceID_XMLEvents)) {
      RemoveListener(aContent);
      AddXMLEventsContent(aContent);
      nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aContent);
    }
    else if (aContent->GetIDAttributeName() == aAttribute) {
      if (aModType == nsIDOMMutationEvent::REMOVAL)
        mListeners.Enumerate(EnumAndSetIncomplete, aContent);
      else if (aModType == nsIDOMMutationEvent::MODIFICATION) {
        //Remove possible listener
        mListeners.Enumerate(EnumAndSetIncomplete, aContent);
        //Add new listeners
        AddListeners(aDocument);
      }
      else {
        //If we are adding the ID attribute, we must check whether we can 
        //add new listeners
        AddListeners(aDocument);
      }
    }
  }
}
Example #10
0
EndPoint::~EndPoint()
{
	if ( listener )
		RemoveListener( listener );

	delete d->callTimer;
#ifdef ENTERPRISE
	delete d->ldap;
#endif
	delete d;

	endPoint = 0;
}
Example #11
0
void CDBAPIBulkInsert::Action(const CDbapiEvent& e) 
{
    _TRACE(GetIdent() << " " << (void*)this << ": '" << e.GetName() 
           << "' from " << e.GetSource()->GetIdent());

    if(dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
	RemoveListener(e.GetSource());
        if(dynamic_cast<CConnection*>(e.GetSource()) != 0 ) {
            _TRACE("Deleting " << GetIdent() << " " << (void*)this); 
            delete this;
        }
    }
}
Example #12
0
void Node::RemoveComponent(Vector<SharedPtr<Component> >::Iterator i)
{
    WeakPtr<Component> componentWeak(*i);
    
    RemoveListener(*i);
    if (scene_)
        scene_->ComponentRemoved(*i);
    components_.Erase(i);
    
    // If the component is still referenced elsewhere, reset its node pointer now
    if (componentWeak)
        componentWeak->SetNode(0);
}
Example #13
0
void PlacesObservers::RemoveListener(
    const nsTArray<PlacesEventType>& aEventTypes,
    places::INativePlacesEventCallback* aCallback) {
  uint32_t flags = GetFlagsForEventTypes(aEventTypes);
  if (gCallingListeners) {
    FlaggedArray<WeakPtr<places::INativePlacesEventCallback>>* listeners =
        WeakNativeListeners::GetListenersToRemove();
    Flagged<WeakPtr<places::INativePlacesEventCallback>> pair(flags, aCallback);
    listeners->AppendElement(pair);
  } else {
    RemoveListener(flags, aCallback);
  }
}
Example #14
0
void EventManager::_UnlockListeners() {
    mListenersLocked = false;

    while(mListenerRemoveQueue.size() > 0) {
        RemoveListener(mListenerRemoveQueue.back());
        mListenerRemoveQueue.pop_back();
    }

    while(mListenerAddQueue.size() > 0) {
        AddListener(mListenerAddQueue.back());
        mListenerAddQueue.pop_back();
    }
}
Example #15
0
void PlacesObservers::RemoveListener(
    GlobalObject& aGlobal, const nsTArray<PlacesEventType>& aEventTypes,
    PlacesEventCallback& aCallback, ErrorResult& rv) {
  uint32_t flags = GetFlagsForEventTypes(aEventTypes);
  if (gCallingListeners) {
    FlaggedArray<RefPtr<PlacesEventCallback>>* listeners =
        JSListeners::GetListenersToRemove();
    Flagged<RefPtr<PlacesEventCallback>> pair(flags, &aCallback);
    listeners->AppendElement(pair);
  } else {
    RemoveListener(flags, aCallback);
  }
}
Example #16
0
//============================================================================
//		NBroadcaster::RemoveListeners : Remove all listeners.
//----------------------------------------------------------------------------
void NBroadcaster::RemoveListeners(void)
{	NListener		*theListener;
	NListenerMap	theList;



	// Stop broadcasting to our listeners
	while (!mListeners.empty())
		{
		theListener = mListeners.begin()->first;
		RemoveListener(theListener);
		}
}
Example #17
0
void PlacesObservers::RemoveListener(
    GlobalObject& aGlobal, const nsTArray<PlacesEventType>& aEventTypes,
    PlacesWeakCallbackWrapper& aCallback, ErrorResult& rv) {
  uint32_t flags = GetFlagsForEventTypes(aEventTypes);
  if (gCallingListeners) {
    FlaggedArray<WeakPtr<PlacesWeakCallbackWrapper>>* listeners =
        WeakJSListeners::GetListenersToRemove();
    WeakPtr<PlacesWeakCallbackWrapper> weakCb(&aCallback);
    MOZ_ASSERT(weakCb.get());
    Flagged<WeakPtr<PlacesWeakCallbackWrapper>> flagged(flags,
                                                        std::move(weakCb));
    listeners->AppendElement(flagged);
  } else {
    RemoveListener(flags, aCallback);
  }
}
//----------------------------------------------------------------------------------------------------------------------------------------
// listener affectation
//----------------------------------------------------------------------------------------------------------------------------------------
bool CSocketServer::AssignListener (const CObjectListener *inListener)
{
	CObjectListener *oldListener = RemoveListener();
	if (oldListener != NULL) delete oldListener;
	if (inListener != NULL)
	{
		if (inListener -> ClassIs (ListenerMustBe()))
		{
			if (!CSocket::AssignListener (inListener)) return false;
			int res; if ((res = ::pthread_create (&m_ListenTh, NULL, CSocketServer::m_ListenCallBack, this)) != 0)
				return false;
		}
		else return false;
	}
	return true;
}
nsresult
nsSplitterFrameInner::MouseMove(nsIDOMEvent* aMouseEvent)
{  
  NS_ENSURE_TRUE(mOuter, NS_OK);
  if (!mPressed)
    return NS_OK;

  if (mDragging)
    return NS_OK;

  nsCOMPtr<nsIDOMMouseListener> kungfuDeathGrip(this);
  mOuter->mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::state, NS_LITERAL_STRING("dragging"), PR_TRUE);

  RemoveListener();
  mDragging = PR_TRUE;

  return NS_OK;
}
Example #20
0
bool
Opal::Sip::EndPoint::set_listen_port (unsigned port)
{
  unsigned udp_min, udp_max;

  listen_iface.protocol = "udp";
  listen_iface.voip_protocol = "sip";
  listen_iface.id = "*";

  manager.get_udp_ports (udp_min, udp_max);

  if (port > 0) {

    std::stringstream str;
    RemoveListener (NULL);

    str << "udp$*:" << port;
    if (!StartListeners (PStringArray (str.str ()))) {

      port = udp_min;
      str << "udp$*:" << port;
      while (port <= udp_max) {

        if (StartListeners (PStringArray (str.str ()))) {

          listen_iface.port = port;
	  PTRACE (4, "Opal::Sip::EndPoint\tSet listen port to " << port);
          return true;
        }

        port++;
      }
    }
    else {
      listen_iface.port = port;
      PTRACE (4, "Opal::Sip::EndPoint\tSet listen port to " << port);
      return true;
    }
  }

  return false;
}
NS_IMETHODIMP
VibrateWindowListener::HandleEvent(nsIDOMEvent* aEvent)
{
  nsCOMPtr<nsIDocument> doc =
    do_QueryInterface(aEvent->InternalDOMEvent()->GetTarget());

  if (!doc || doc->Hidden()) {
    // It's important that we call CancelVibrate(), not Vibrate() with an
    // empty list, because Vibrate() will fail if we're no longer focused, but
    // CancelVibrate() will succeed, so long as nobody else has started a new
    // vibration pattern.
    nsCOMPtr<nsIDOMWindow> window = do_QueryReferent(mWindow);
    hal::CancelVibrate(window);
    RemoveListener();
    gVibrateWindowListener = nullptr;
    // Careful: The line above might have deleted |this|!
  }

  return NS_OK;
}
Example #22
0
void IPTVFeederRTP::AddListener(TSDataListener *item)
{
    VERBOSE(VB_RECORD, LOC + "AddListener("<<item<<") -- begin");
    if (!item)
    {
        VERBOSE(VB_RECORD, LOC + "AddListener("<<item<<") -- end");
        return;
    }

    // avoid duplicates
    RemoveListener(item);

    // add to local list
    QMutexLocker locker(&_lock);
    _listeners.push_back(item);

    if (_sink)
        _sink->AddListener(item);

    VERBOSE(VB_RECORD, LOC + "AddListener("<<item<<") -- end");
}
Example #23
0
bool
Opal::Sip::EndPoint::StartListener (unsigned port)
{
  unsigned udp_min = GetManager ().GetUDPPortBase ();
  unsigned udp_max = GetManager ().GetUDPPortMax ();
  unsigned tcp_min = GetManager ().GetTCPPortBase ();
  unsigned tcp_max = GetManager ().GetTCPPortMax ();

  const std::string protocols[] = { "udp", "tcp", "" };
  const unsigned ports[][2] = { { udp_min, udp_max }, { tcp_min, tcp_max } };

  if (port > 0) {

    RemoveListener (NULL);
    for (int i = 0 ; !protocols[i].empty () ; i++) {

      std::stringstream str;
      str << protocols[i] << "$*:" << port;
      if (!StartListeners (PStringArray (str.str ()))) {

        port = ports[i][0];
        while (port <= ports[i][1]) {
          str << protocols[i] << "$*:" << port;
          if (StartListeners (PStringArray (str.str ()))) {
            PTRACE (4, "Opal::Sip::EndPoint\tSet listen port to " << port << " (" << protocols[i] << ")");
            break;
          }

          port++;
        }
      }
      else
        PTRACE (4, "Opal::Sip::EndPoint\tSet listen port to " << port << " (" << protocols[i] << ")");
    }
  }

  return false;
}
Example #24
0
void IPTVFeederRTP::AddListener(TSDataListener *item)
{
    LOG(VB_RECORD, LOG_INFO, LOC + QString("AddListener(0x%1) -- begin")
                       .arg((uint64_t)item,0,16));
    if (!item)
    {
        LOG(VB_RECORD, LOG_INFO, LOC + QString("AddListener(0x%1) -- end")
                           .arg((uint64_t)item,0,16));
        return;
    }

    // avoid duplicates
    RemoveListener(item);

    // add to local list
    QMutexLocker locker(&_lock);
    _listeners.push_back(item);

    if (_sink)
        _sink->AddListener(item);

    LOG(VB_RECORD, LOG_INFO, LOC + QString("AddListener(0x%1) -- end")
                       .arg((uint64_t)item,0,16));
}
Example #25
0
void csMovable::AddListener (iMovableListener *listener)
{
  RemoveListener (listener);
  listeners.Push (listener);
}
	~SafeAreaResizer()
	{
		SAFE_HARDWARE_MOUSE_FUNC(RemoveListener(this));
		g_pGameActions->FilterNoMouse()->Enable(false);
	}
Example #27
0
void OpSpeedDialView::OnDeleted()
{
	RemoveListener(this);
	g_main_message_handler->UnsetCallBacks(this);
	OpWidget::OnDeleted();
}
Example #28
0
	~CFlowNode_WeaponListener()
	{
		RemoveListener(m_weapId, this);    
	}
Example #29
0
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{     
		IWeapon* pWeapon = GetWeapon(pActInfo);

		if (!pWeapon) 
			return;
			
		switch (event)
		{
			case eFE_Initialize:
			{
				m_isFiring = false;   
				m_numShots = GetPortInt( pActInfo, IN_NUMBEROFSHOTS );
				m_actInfo = *pActInfo;
				m_numShotsDone = 0;

				pWeapon->StopFire();

				if (pActInfo->pEntity->GetId() != m_weapId)
					RemoveListener(m_weapId, this);

				m_weapId = pActInfo->pEntity->GetId();
				pWeapon->AddEventListener(this, __FUNCTION__);

#ifdef DEBUG_NODEFIREWEAPON
				pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
#endif
				break;
			}
		
			case eFE_Activate:
			{ 
				m_actInfo = *pActInfo;
				if (IsPortActive(pActInfo, IN_NUMBEROFSHOTS))
					m_numShots = GetPortBool( pActInfo, IN_NUMBEROFSHOTS );
				
				if (IsPortActive(pActInfo, IN_STOPFIRE))
				{
					StopFiring( pActInfo, pWeapon );
				}
				if (IsPortActive(pActInfo, IN_STARTFIRE))
				{
					m_numShotsDone = 0;
					ReplenishAmmo( pWeapon );
					pWeapon->StopFire();
					StartFiring( pActInfo, pWeapon );
				}
				break;
			}
			
			case eFE_Update:
			{
				// this fixes the problem when the entity is being externally moved/rotated, in the interval of time between when the weapon is aimed an the actual shot happens
				if (m_isFiring && GetPortBool( pActInfo, IN_ALIGNTOTARGET ))
					if (pActInfo->pEntity->GetWorldPos()!=m_lastPos || pActInfo->pEntity->GetWorldRotation()!=m_lastRotation)
						CalcFiringPosition( pActInfo, pWeapon );
			
#ifdef DEBUG_NODEFIREWEAPON
				ColorB colorRed( 255,0,0 );
				ColorB colorGreen( 0,255,0 );
				gEnv->pRenderer->GetIRenderAuxGeom()->DrawLine( posOrig, colorRed, posTarget, colorRed );
				gEnv->pRenderer->GetIRenderAuxGeom()->DrawLine( posTarget, colorGreen, posShot, colorGreen );
#endif
				break;
			}
		}
	}
Example #30
0
	~CFlowNode_FireWeapon()
	{ 
		RemoveListener(m_weapId, this);
	}