Skip to content
  • Vlad Zahorodnii's avatar
    Make pointer focus handling less error prone · 8e304963
    Vlad Zahorodnii authored
    Currently, if the pointer surface has to change between two surfaces,
    the compositor must do the following
    
        seat->setFocusedPointerSurface(nullptr);
        seat->notifyPointerMotion(newPos);
        seat->setFocusedPointerSurface(focus);
    
    The pointer motion is needed so the enter event has correct position,
    setFocusedPointerSurface(nullptr) is needed to avoid sending a bad
    motion event before the leave event.
    
    This change makes the pointer focus api less error prone by splitting
    setFocusedPointerSurface() in two functions - notifyPointerEnter() and
    notifyPointerLeave().
    
    notifyPointerEnter() takes new focus surface as well as the position
    where the pointer has entered the surface so the focus update can be
    atomic and without any corner cases.
    
    notifyPointerLeave() is used to clear pointer focus.
    8e304963