diff --unified --recursive --text --new-file --color mutter-43.3+4.old/src/core/events.c mutter-43.3+4.new/src/core/events.c --- mutter-43.3+4.old/src/core/events.c 2023-03-13 16:20:18.953566837 +0800 +++ mutter-43.3+4.new/src/core/events.c 2023-03-13 16:21:25.375564893 +0800 @@ -34,7 +34,6 @@ #include "core/display-private.h" #include "core/window-private.h" #include "meta/meta-backend.h" -#include "x11/meta-x11-display-private.h" #ifdef HAVE_NATIVE_BACKEND #include "backends/native/meta-backend-native.h" @@ -261,9 +260,6 @@ display->grabbed_in_clutter = FALSE; meta_compositor_grab_end (compositor); } - - if (display->x11_display) - meta_x11_display_sync_input_focus (display->x11_display); } device = clutter_event_get_device (event); diff --unified --recursive --text --new-file --color mutter-43.3+4.old/src/core/window.c mutter-43.3+4.new/src/core/window.c --- mutter-43.3+4.old/src/core/window.c 2023-03-13 16:20:18.956900099 +0800 +++ mutter-43.3+4.new/src/core/window.c 2023-03-13 16:21:25.382231433 +0800 @@ -1988,6 +1988,15 @@ return; } + /* Do not focus window on map if input is already taken by the + * compositor. + */ + if (!meta_display_windows_are_interactable (window->display)) + { + *takes_focus = FALSE; + return; + } + /* Terminal usage may be different; some users intend to launch * many apps in quick succession or to just view things in the new * window while still interacting with the terminal. In that case, diff --unified --recursive --text --new-file --color mutter-43.3+4.old/src/x11/events.c mutter-43.3+4.new/src/x11/events.c --- mutter-43.3+4.old/src/x11/events.c 2023-03-13 16:20:18.990232717 +0800 +++ mutter-43.3+4.new/src/x11/events.c 2023-03-13 16:21:25.382231433 +0800 @@ -1009,9 +1009,6 @@ break; case XI_FocusIn: case XI_FocusOut: - if (clutter_stage_get_grab_actor (stage) != NULL) - break; - if (handle_window_focus_event (x11_display, window, enter_event, serial) && enter_event->event == enter_event->root) { @@ -1933,8 +1930,7 @@ event->xany.serial > x11_display->focus_serial && display->focus_window && display->focus_window->client_type == META_WINDOW_CLIENT_TYPE_X11 && - !window_has_xwindow (display->focus_window, x11_display->server_focus_window) && - meta_display_windows_are_interactable (display)) + !window_has_xwindow (display->focus_window, x11_display->server_focus_window)) { meta_topic (META_DEBUG_FOCUS, "Earlier attempt to focus %s failed", display->focus_window->desc); diff --unified --recursive --text --new-file --color mutter-43.3+4.old/src/x11/meta-x11-display.c mutter-43.3+4.new/src/x11/meta-x11-display.c --- mutter-43.3+4.old/src/x11/meta-x11-display.c 2023-03-13 16:20:18.990232717 +0800 +++ mutter-43.3+4.new/src/x11/meta-x11-display.c 2023-03-13 16:21:25.375564893 +0800 @@ -1944,10 +1944,6 @@ Window xwindow, uint32_t timestamp) { - if (xwindow != None && - !meta_display_windows_are_interactable (x11_display->display)) - return; - meta_x11_error_trap_push (x11_display); /* In order for mutter to know that the focus request succeeded, we track @@ -2020,22 +2016,6 @@ x11_display->display->last_focus_time = timestamp; } -void -meta_x11_display_sync_input_focus (MetaX11Display *x11_display) -{ - guint timestamp; - - if (!meta_display_windows_are_interactable (x11_display->display)) - return; - - meta_x11_error_trap_push (x11_display); - timestamp = meta_display_get_current_time (x11_display->display); - meta_x11_display_set_input_focus_internal (x11_display, - x11_display->focus_xwindow, - timestamp); - meta_x11_error_trap_pop (x11_display); -} - static MetaX11DisplayLogicalMonitorData * get_x11_display_logical_monitor_data (MetaLogicalMonitor *logical_monitor) { diff --unified --recursive --text --new-file --color mutter-43.3+4.old/src/x11/meta-x11-display-private.h mutter-43.3+4.new/src/x11/meta-x11-display-private.h --- mutter-43.3+4.old/src/x11/meta-x11-display-private.h 2023-03-13 16:20:18.990232717 +0800 +++ mutter-43.3+4.new/src/x11/meta-x11-display-private.h 2023-03-13 16:21:25.375564893 +0800 @@ -258,8 +258,6 @@ gboolean focus_frame, uint32_t timestamp); -void meta_x11_display_sync_input_focus (MetaX11Display *x11_display); - MetaDisplay * meta_x11_display_get_display (MetaX11Display *x11_display); #endif /* META_X11_DISPLAY_PRIVATE_H */ diff --unified --recursive --text --new-file --color mutter-43.3+4.old/src/x11/window-x11.c mutter-43.3+4.new/src/x11/window-x11.c --- mutter-43.3+4.old/src/x11/window-x11.c 2023-03-13 16:20:18.993565979 +0800 +++ mutter-43.3+4.new/src/x11/window-x11.c 2023-03-13 16:21:25.382231433 +0800 @@ -3382,7 +3382,8 @@ event->xclient.data.l[4]); /* height */ } else if (event->xclient.message_type == - x11_display->atom__NET_ACTIVE_WINDOW) + x11_display->atom__NET_ACTIVE_WINDOW && + meta_display_windows_are_interactable (window->display)) { MetaClientType source_indication; guint32 timestamp;