nsEventStatus
AccessibleCaretEventHub::HandleEvent(WidgetEvent* aEvent)
{
  nsEventStatus status = nsEventStatus_eIgnore;

  if (!mInitialized) {
    return status;
  }

  MOZ_ASSERT(mRefCnt.get() > 1, "Expect caller holds us as well!");

  switch (aEvent->mClass) {
    case eMouseEventClass:
      status = HandleMouseEvent(aEvent->AsMouseEvent());
      break;

    case eTouchEventClass:
      status = HandleTouchEvent(aEvent->AsTouchEvent());
      break;

    case eKeyboardEventClass:
      status = HandleKeyboardEvent(aEvent->AsKeyboardEvent());
      break;

    default:
      break;
  }

  return status;
}
nsEventStatus
AccessibleCaretEventHub::HandleEvent(WidgetEvent* aEvent)
{
  nsEventStatus status = nsEventStatus_eIgnore;

  if (!mInitialized) {
    return status;
  }

  switch (aEvent->mClass) {
  case eMouseEventClass:
    status = HandleMouseEvent(aEvent->AsMouseEvent());
    break;

  case eWheelEventClass:
    status = HandleWheelEvent(aEvent->AsWheelEvent());
    break;

  case eTouchEventClass:
    status = HandleTouchEvent(aEvent->AsTouchEvent());
    break;

  case eKeyboardEventClass:
    status = HandleKeyboardEvent(aEvent->AsKeyboardEvent());
    break;

  default:
    break;
  }

  return status;
}
Exemple #3
0
 void Game::HandleEvent(Event* aEvent)
 {
     switch (aEvent->GetEventCode())
     {
         case TOUCH_EVENT:
             HandleTouchEvent((TouchEvent*)aEvent);
             break;
     
         default:
             break;
     }
 }
static void
HandleMotionEvent(MirMotionEvent const motion, SDL_Window* sdl_window)
{
    int cord_index;
    for (cord_index = 0; cord_index < motion.pointer_count; cord_index++) {
        if (motion.pointer_coordinates[cord_index].tool_type == mir_motion_tool_type_finger) {
            HandleTouchEvent(motion, cord_index, sdl_window);
        }
        else {
            HandleMouseEvent(motion, cord_index, sdl_window);
        }
    }
}
Exemple #5
0
static void
HandleInput(MirInputEvent const* input_event, SDL_Window* window)
{
    switch (MIR_mir_input_event_get_type(input_event)) {
        case (mir_input_event_type_key):
            HandleKeyEvent(MIR_mir_input_event_get_keyboard_event(input_event), window);
            break;
        case (mir_input_event_type_pointer):
            HandleMouseEvent(MIR_mir_input_event_get_pointer_event(input_event), window);
            break;
        case (mir_input_event_type_touch):
            HandleTouchEvent(MIR_mir_input_event_get_touch_event(input_event),
                             MIR_mir_input_event_get_device_id(input_event),
                             window);
            break;
        default:
            break;
    }
}
bool CControl::OnTouchEvent( CTouchEvent* event )
{
    bool bRet = false;
    for ( auto child : GetChildren() )
    {
        if ( child->IsVisible() && child->OnTouchEvent(event) )
        {
            bRet = true;
            break;
        }
    }
    if ( !bRet )
    {
        bRet = HandleTouchEvent( event );
    }
    if ( bRet )
    {
        event->StopPropagation();
    }
    return bRet;
}
Exemple #7
0
/**
 * @function GUI_DrawObjects
 * @brief handle all object (user event, refresh)
 * @param none
 * @return none
 */
void GUI_DrawObjects(void) {

  g_obj_st *ptr = NULL;
  coord_t newX, newY;

  /*reset signal & read touch screen; only once for all object*/
  signal = 0;
  TouchScreenRead(&newX, &newY);

  /*small hysteresis to compensate touchscreen noise*/
  #define TOUCH_THRES_HYS 2
  if(newX < 0 || newY < 0) {
    x = y = -1;
  }
  else {

    if(x < 0 || y < 0) {
      x = newX;
      y = newY;
    }
    else if(P2D_Abs(newX - x) > TOUCH_THRES_HYS || P2D_Abs(newY - y) > TOUCH_THRES_HYS) {
      x = newX;
      y = newY;
    }
  }


  /*get the object list, according to the active layer*/
  ptr = GetObjectList();

  /*process notification blink*/
  if(IsTimerElapsed(tmrBlink)) {
    bBlink = !bBlink;
    tmrBlink = GetPeriodicTimeout(500);
    while(ptr != NULL) {
      GUI_ObjSetBlink(ptr, bBlink);
      ptr = ptr->next;
    }
  }

  /*process each generic object of the current layer*/
  while(ptr != NULL) {

    /*handle user interaction*/
    HandleTouchEvent(x, y, ptr);

    /*handle object signals*/
    HandleSignal(ptr);

    if(ptr->obj != NULL) {

      /*launch the object task, if any*/
      if(ptr->task != NULL) ptr->task(ptr, ptr->obj);

      /*redraw the object, only if needed*/
      if(GUI_ObjIsNeedRefresh(ptr) && ptr->draw != NULL) {
        P2D_SetClip(&(ptr->rec));
        ptr->draw(ptr, ptr->obj);
        GUI_ObjSetNeedRefresh(ptr, false);
      }
    }

    /*next object*/
    ptr = ptr->next;
  }

  /**
   * execute, if any, the top layer task
   * pInternalTask may close the top layer and return a signal;
   * when closing the top layer, pInternalTask becomes NULL
   * this signal will be given to the user at end of GUI_DrawObjects()
   */
  if(pInternalTask != NULL) signal = pInternalTask(signal);
  
  /**
   * Save the last non null signal (for slave remote)
   */
  if(signal != 0 && pInternalTask == NULL) {
    lastSignal = signal;
  }
  
  /**
   * execute the user task, if no internal task is running
   * DO NOT concate this condition with the previous one in a if/else statement !
   */
  if(pInternalTask == NULL) {
    if(pUserTask != NULL) pUserTask(signal);
  }
}