x11: Simplify handling of focus-follows-mouse

Focus follows mouse is meant to avoid focusing windows that happened
to pop up under the pointer, e.g. due to mapping, workspace changes,
etc... On X11, this has been done since ancient times through a
moderately complex synchronization mechanism, so mutter would know
to ignore crossing events caused on those situations.

This mechanism is much prior to XInput 2 though, where we may know
this in a more straightforward way: If the sourceid of the crossing
event is a logical pointer (i.e. equals deviceid), the crossing event
was triggered logically, and not through user input.

Perform this simpler check, and drop the existing mechanism to
ignore logically induced crossing events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3267>
This commit is contained in:
Carlos Garnacho
2023-09-06 15:00:33 +02:00
committed by Marge Bot
parent f23876e99e
commit 8b0da940cf
5 changed files with 1 additions and 87 deletions

View File

@ -2203,7 +2203,6 @@ meta_window_show (MetaWindow *window)
gboolean needs_stacking_adjustment;
MetaWindow *focus_window;
gboolean notify_demands_attention = FALSE;
MetaDisplay *display = window->display;
meta_topic (META_DEBUG_WINDOW_STATE,
"Showing window %s, iconic: %d placed: %d",
@ -2373,16 +2372,6 @@ meta_window_show (MetaWindow *window)
else
meta_display_queue_focus (window->display, window);
}
else if (display->x11_display)
{
/* Prevent EnterNotify events in sloppy/mouse focus from
* erroneously focusing the window that had been denied
* focus. FIXME: This introduces a race; I have a couple
* ideas for a better way to accomplish the same thing, but
* they're more involved so do it this way for now.
*/
meta_x11_display_increment_focus_sentinel (display->x11_display);
}
}
set_net_wm_state (window);