Revert "workspace: Use existing focus_window when asked to focus default window"

This reverts commit d0de671c1d.

The change introduced a regression when focusing java/swing windows.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5395
Reopens: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5162
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2402>
This commit is contained in:
Sebastian Keller 2022-05-04 23:29:39 +02:00
parent 3d3c88f960
commit c3210b0ab2

View File

@ -1332,22 +1332,10 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
MetaWindow *not_this_one, MetaWindow *not_this_one,
guint32 timestamp) guint32 timestamp)
{ {
MetaWindow *current_focus;
if (timestamp == META_CURRENT_TIME) if (timestamp == META_CURRENT_TIME)
meta_warning ("META_CURRENT_TIME used to choose focus window; " meta_warning ("META_CURRENT_TIME used to choose focus window; "
"focus window may not be correct."); "focus window may not be correct.");
current_focus = workspace->display->focus_window;
if (current_focus &&
current_focus != not_this_one &&
meta_window_located_on_workspace (current_focus, workspace))
{
meta_window_focus (current_focus, timestamp);
return;
}
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK || if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK ||
!workspace->display->mouse_mode) !workspace->display->mouse_mode)
focus_ancestor_or_top_window (workspace, not_this_one, timestamp); focus_ancestor_or_top_window (workspace, not_this_one, timestamp);