tree/view: don't give focus to views mapped under fullscreen views

Fixes #6211.
This commit is contained in:
Tudor Brindus 2021-04-24 13:06:40 -04:00 committed by Simon Ser
parent 8529141150
commit 80128d23ba

View file

@ -600,6 +600,11 @@ static bool should_focus(struct sway_view *view) {
return true; return true;
} }
// View opened "under" fullscreen view should not be given focus.
if (root->fullscreen_global || map_ws->fullscreen) {
return false;
}
// Views can only take focus if they are mapped into the active workspace // Views can only take focus if they are mapped into the active workspace
if (prev_ws != map_ws) { if (prev_ws != map_ws) {
return false; return false;
@ -807,8 +812,8 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
if (wlr_surface_is_xwayland_surface(wlr_surface)) { if (wlr_surface_is_xwayland_surface(wlr_surface)) {
struct wlr_xwayland_surface *xsurface = struct wlr_xwayland_surface *xsurface =
wlr_xwayland_surface_from_wlr_surface(wlr_surface); wlr_xwayland_surface_from_wlr_surface(wlr_surface);
set_focus = (wlr_xwayland_icccm_input_model(xsurface) != set_focus &= wlr_xwayland_icccm_input_model(xsurface) !=
WLR_ICCCM_INPUT_MODEL_NONE) && set_focus; WLR_ICCCM_INPUT_MODEL_NONE;
} }
#endif #endif
@ -819,11 +824,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
const char *app_id; const char *app_id;
const char *class; const char *class;
if ((app_id = view_get_app_id(view)) != NULL) { if ((app_id = view_get_app_id(view)) != NULL) {
wlr_foreign_toplevel_handle_v1_set_app_id( wlr_foreign_toplevel_handle_v1_set_app_id(view->foreign_toplevel, app_id);
view->foreign_toplevel, app_id);
} else if ((class = view_get_class(view)) != NULL) { } else if ((class = view_get_class(view)) != NULL) {
wlr_foreign_toplevel_handle_v1_set_app_id( wlr_foreign_toplevel_handle_v1_set_app_id(view->foreign_toplevel, class);
view->foreign_toplevel, class);
} }
} }