diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c index 9f42c385f..3c3a65061 100644 --- a/src/x11/meta-x11-display.c +++ b/src/x11/meta-x11-display.c @@ -2104,11 +2104,8 @@ meta_x11_display_set_input_focus (MetaX11Display *x11_display, xwindow = window->frame->xwindow; else xwindow = meta_window_x11_get_xwindow (window); - -#ifdef HAVE_X11 - if (!meta_is_wayland_compositor ()) - clutter_stage_set_key_focus (stage, NULL); } +#ifdef HAVE_X11 else if (!meta_is_wayland_compositor () && stage_has_focus_actor (x11_display)) { @@ -2117,8 +2114,6 @@ meta_x11_display_set_input_focus (MetaX11Display *x11_display, */ xwindow = meta_x11_get_stage_window (stage); } -#else - } #endif meta_topic (META_DEBUG_FOCUS, "Setting X11 input focus for window %s to 0x%lx", @@ -2129,6 +2124,11 @@ meta_x11_display_set_input_focus (MetaX11Display *x11_display, serial = XNextRequest (x11_display->xdisplay); meta_x11_display_update_focus_window (x11_display, xwindow, serial, TRUE); mtk_x11_error_trap_pop (x11_display->xdisplay); + +#ifdef HAVE_X11 + if (window && !meta_is_wayland_compositor ()) + clutter_stage_set_key_focus (stage, NULL); +#endif } static MetaX11DisplayLogicalMonitorData *