aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Tudor Brindus <me@tbrindus.ca>2021-04-24 13:06:40 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2021-04-25 11:20:56 +0200
commit80128d23ba9f0a6a92284b2c6077e304f35e7a76 (patch)
treeaaa439972d00b2c09d8a8a8188801bef7b117345 /sway/tree/view.c
parentview_destroy: fix use-after-free with subsurface_destroy (diff)
downloadsway-80128d23ba9f0a6a92284b2c6077e304f35e7a76.tar.gz
sway-80128d23ba9f0a6a92284b2c6077e304f35e7a76.tar.zst
sway-80128d23ba9f0a6a92284b2c6077e304f35e7a76.zip
tree/view: don't give focus to views mapped under fullscreen views
Fixes #6211.
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 43c37bda..32df19e5 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -600,6 +600,11 @@ static bool should_focus(struct sway_view *view) {
600 return true; 600 return true;
601 } 601 }
602 602
603 // View opened "under" fullscreen view should not be given focus.
604 if (root->fullscreen_global || map_ws->fullscreen) {
605 return false;
606 }
607
603 // Views can only take focus if they are mapped into the active workspace 608 // Views can only take focus if they are mapped into the active workspace
604 if (prev_ws != map_ws) { 609 if (prev_ws != map_ws) {
605 return false; 610 return false;
@@ -758,7 +763,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
758 763
759 view_init_subsurfaces(view, wlr_surface); 764 view_init_subsurfaces(view, wlr_surface);
760 wl_signal_add(&wlr_surface->events.new_subsurface, 765 wl_signal_add(&wlr_surface->events.new_subsurface,
761 &view->surface_new_subsurface); 766 &view->surface_new_subsurface);
762 view->surface_new_subsurface.notify = view_handle_surface_new_subsurface; 767 view->surface_new_subsurface.notify = view_handle_surface_new_subsurface;
763 768
764 if (decoration) { 769 if (decoration) {
@@ -806,9 +811,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
806#if HAVE_XWAYLAND 811#if HAVE_XWAYLAND
807 if (wlr_surface_is_xwayland_surface(wlr_surface)) { 812 if (wlr_surface_is_xwayland_surface(wlr_surface)) {
808 struct wlr_xwayland_surface *xsurface = 813 struct wlr_xwayland_surface *xsurface =
809 wlr_xwayland_surface_from_wlr_surface(wlr_surface); 814 wlr_xwayland_surface_from_wlr_surface(wlr_surface);
810 set_focus = (wlr_xwayland_icccm_input_model(xsurface) != 815 set_focus &= wlr_xwayland_icccm_input_model(xsurface) !=
811 WLR_ICCCM_INPUT_MODEL_NONE) && set_focus; 816 WLR_ICCCM_INPUT_MODEL_NONE;
812 } 817 }
813#endif 818#endif
814 819
@@ -819,11 +824,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
819 const char *app_id; 824 const char *app_id;
820 const char *class; 825 const char *class;
821 if ((app_id = view_get_app_id(view)) != NULL) { 826 if ((app_id = view_get_app_id(view)) != NULL) {
822 wlr_foreign_toplevel_handle_v1_set_app_id( 827 wlr_foreign_toplevel_handle_v1_set_app_id(view->foreign_toplevel, app_id);
823 view->foreign_toplevel, app_id);
824 } else if ((class = view_get_class(view)) != NULL) { 828 } else if ((class = view_get_class(view)) != NULL) {
825 wlr_foreign_toplevel_handle_v1_set_app_id( 829 wlr_foreign_toplevel_handle_v1_set_app_id(view->foreign_toplevel, class);
826 view->foreign_toplevel, class);
827 } 830 }
828} 831}
829 832