diff --git a/src/view.c b/src/view.c index 40f047b2..1a622bc3 100644 --- a/src/view.c +++ b/src/view.c @@ -2242,7 +2242,9 @@ view_move_to_front(struct view *view) * to an incorrect X window depending on timing. To mitigate the * race, perform an explicit flush after restacking. */ - xwayland_flush(view->server); + if (view->type == LAB_XWAYLAND_VIEW) { + xwayland_flush(view->server); + } #endif cursor_update_focus(view->server); desktop_update_top_layer_visibility(view->server); diff --git a/src/xwayland.c b/src/xwayland.c index 5984a31b..2f07adb5 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -946,6 +946,14 @@ xwayland_view_set_activated(struct view *view, bool activated) } wlr_xwayland_surface_activate(xwayland_surface, activated); + /* + * Make sure that the X11-protocol messages (SetInputFocus etc.) + * are sent immediately. This mitigates a race where the XWayland + * server may generate an unwanted FocusOut event for the newly + * activated window, if it receives mouse/pointer events over the + * parallel wayland connection first. + */ + xwayland_flush(view->server); } static void