Skip to content
  • Jasper St. Pierre's avatar
    display: Ensure that we ignore our own focus events for focus predictions · 7fdfbad6
    Jasper St. Pierre authored
    When we set the input focus, we first set the predicted window,
    and then try to process focus events. But as XI_FocusOut on the
    existing window comes before XI_FocusIn on the new window, we'll
    see the focus out on the old window and think the focus is going
    to nothing, which makes mutter think the prediction failed.
    
    This didn't really matter as nothing paid attention to the focus
    window changing, but with gnome-shell's focus rework, we'll try
    and drop keyboard focus in events like these.
    
    Fix this by making sure that we ignore focus window changes of our
    own cause when updating the focus window field, by ignoring all
    focus events that have a serial the same as the focus request or
    lower. Note that if mutter doens't make any requests after the
    focus request, this could be racy, as another client could steal
    the focus, but mutter would ignore it as the serial was the same.
    Bump the serial by making a dummy ChangeProperty request to a
    mutter-controlled window in this case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701017
    7fdfbad6