In the XInput 2 event dispatching code, we propagate focus out events starting from the child's parent up to (but excluding) the ancestor window (see DeviceFocusOutEvents). However, NotifyPointer focus out events should also be sent to the window containing the pointer (the child itself), as performed by the core input event system.
This surfaced as a bug in Firefox/GTK3 that caused focus handing to fail due to a missing FocusOut (detail=NotifyPointer) event when focus was moved from PointerRoot to another toplevel after a window's destruction. As a GTK window's focus is changed when a NotifyPointer event occurs on a window, this was causing the window to permanently retain focus (according to GTK, at least). This does not occur on the core/non-xi2 backend, which does send NotifyPointer focus out events to the pointer window.
The events that should occur when moving from PointerRoot to another window are detailed quite well here;
Patch at https://lists.x.org/archives/xorg-devel/2015-December/048389.html
Author: Andrew Comminos <firstname.lastname@example.org>
Date: Tue Dec 29 23:41:27 2015 -0800
Input: Send XI2 FocusOut NotifyPointer events to the pointer window.