Make pointer focus handling less error prone
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.
Edited by Vlad Zahorodnii