Beispiel #1
0
void
raiseMovementEvent(
  wxWindow &Control,
  std::shared_ptr<StateAccessToken> &Access,
  std::function<seec::cm::MovementResult (seec::cm::ProcessState &State)> Mover)
{
  auto const Handler = Control.GetEventHandler();
  if (!Handler) {
    wxLogDebug("raiseMovementEvent: wxWindow does not have an event handler.");
    return;
  }
  
  if (!Access) {
    wxLogDebug("raiseMovementEvent: no access provided.");
    return;
  }
  
  auto LockAccess = Access->getAccess();
  if (!LockAccess) { // Token is out of date.
    wxLogDebug("raiseMovementEvent: access token is outdated.");
    return;
  }
  
  ProcessMoveEvent Ev {
    SEEC_EV_PROCESS_MOVE,
    Control.GetId(),
    std::move(Mover)
  };
  
  Ev.SetEventObject(&Control);
  
  LockAccess.release();
  
  Handler->AddPendingEvent(Ev);
}
Beispiel #2
0
void wxJoystickThread::SendEvent(wxEventType type, long ts, int change)
{
    wxJoystickEvent jwx_event(type, m_buttons, m_joystick, change);

    jwx_event.SetTimestamp(ts);
    jwx_event.SetPosition(m_lastposition);
    jwx_event.SetZPosition(m_axe[wxJS_AXIS_Z]);
    jwx_event.SetEventObject(m_catchwin);

    if (m_catchwin)
        m_catchwin->GetEventHandler()->AddPendingEvent(jwx_event);
}