From 43d7459734423e5733fb89e95d866da46bf42842 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Mon, 26 Feb 2018 10:37:29 +0100 Subject: unset fullscreen when surface is brought to front The output fullscreen surfaces are drawn in front of everything, without consideration for view z-order. If a view is brought to front, unset any fullscreen view that would cover this view to make sure the view is visible. --- rootston/seat.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'rootston/seat.c') diff --git a/rootston/seat.c b/rootston/seat.c index d2d211ba..052f63da 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -715,6 +715,16 @@ struct roots_seat_view *roots_seat_view_from_view( return seat_view; } +static void release_fullscreen(struct roots_output *output) { + if (output->fullscreen_view) { + if (output->fullscreen_view->set_fullscreen) { + output->fullscreen_view->set_fullscreen( + output->fullscreen_view, false); + } + view_set_fullscreen(output->fullscreen_view, false, output->wlr_output); + } +} + void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { // Make sure the view will be rendered on top of others, even if it's // already focused in this seat @@ -723,6 +733,17 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { wl_list_insert(&seat->input->server->desktop->views, &view->link); } + struct roots_desktop *desktop = view->desktop; + struct roots_output *output; + struct wlr_box box; + view_get_box(view, &box); + wl_list_for_each(output, &desktop->outputs, link) { + if (wlr_output_layout_intersects(desktop->layout, + output->wlr_output, &box)) { + release_fullscreen(output); + } + } + struct roots_view *prev_focus = roots_seat_get_focus(seat); if (view == prev_focus) { return; -- cgit v1.2.3 From 07ca9764891f8de90fe2892051dac980bd472df2 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Tue, 27 Feb 2018 10:14:17 +0100 Subject: only unfullscreen when necessary Check whether the newly focused view is the same as the one currently fullscreen on that output, or override redirect and don't unfullscreen in these cases. --- rootston/seat.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'rootston/seat.c') diff --git a/rootston/seat.c b/rootston/seat.c index 052f63da..017e6221 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -715,16 +715,6 @@ struct roots_seat_view *roots_seat_view_from_view( return seat_view; } -static void release_fullscreen(struct roots_output *output) { - if (output->fullscreen_view) { - if (output->fullscreen_view->set_fullscreen) { - output->fullscreen_view->set_fullscreen( - output->fullscreen_view, false); - } - view_set_fullscreen(output->fullscreen_view, false, output->wlr_output); - } -} - void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { // Make sure the view will be rendered on top of others, even if it's // already focused in this seat @@ -733,14 +723,30 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { wl_list_insert(&seat->input->server->desktop->views, &view->link); } - struct roots_desktop *desktop = view->desktop; - struct roots_output *output; - struct wlr_box box; - view_get_box(view, &box); - wl_list_for_each(output, &desktop->outputs, link) { - if (wlr_output_layout_intersects(desktop->layout, - output->wlr_output, &box)) { - release_fullscreen(output); + + bool unfullscreen = true; + +#ifdef WLR_HAS_XWAYLAND + if (view && view->type == ROOTS_XWAYLAND_VIEW && + view->xwayland_surface->override_redirect) { + unfullscreen = false; + } +#endif + + if (unfullscreen) { + struct roots_desktop *desktop = view->desktop; + struct roots_output *output; + struct wlr_box box; + view_get_box(view, &box); + wl_list_for_each(output, &desktop->outputs, link) { + if (output->fullscreen_view && + output->fullscreen_view != view && + wlr_output_layout_intersects( + desktop->layout, + output->wlr_output, &box)) { + view_set_fullscreen(output->fullscreen_view, + false, NULL); + } } } -- cgit v1.2.3 From 0c4d347d1ebc7c65cebd3fff40d16d894327cda7 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Tue, 27 Mar 2018 09:17:47 +0200 Subject: rootston: Fix segfault in seat unfullscreening ==32557==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000425f96 bp 0x7fff8ac19de0 sp 0x7fff8ac19d20 T0) ==32557==The signal is caused by a READ memory access. ==32557==Hint: address points to the zero page. #0 0x425f95 in roots_seat_set_focus ../rootston/seat.c:737 #1 0x40bcd6 in roots_cursor_press_button ../rootston/cursor.c:272 #2 0x40c1f7 in roots_cursor_handle_button ../rootston/cursor.c:298 #3 0x42179b in handle_cursor_button ../rootston/seat.c:58 #4 0x7f1651062367 in wlr_signal_emit_safe ../util/signal.c:29 #5 0x7f165101b532 in handle_pointer_button ../types/wlr_cursor.c:344 #6 0x7f1651062367 in wlr_signal_emit_safe ../util/signal.c:29 #7 0x7f1650ff633b in handle_pointer_button ../backend/libinput/pointer.c:85 #8 0x7f1650ff5291 in wlr_libinput_event ../backend/libinput/events.c:215 #9 0x7f1650ff3990 in wlr_libinput_readable ../backend/libinput/backend.c:35 #10 0x7f1650d88c11 in wl_event_loop_dispatch (/lib64/libwayland-server.so.0+0x9c11) #11 0x7f1650d87449 in wl_display_run (/lib64/libwayland-server.so.0+0x8449) #12 0x418e90 in main ../rootston/main.c:81 #13 0x7f164ff7ef29 in __libc_start_main (/lib64/libc.so.6+0x20f29) #14 0x405829 in _start (/home/shared/wayland/wlroots/build/rootston/rootston+0x405829) introduced by #680 --- rootston/seat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rootston/seat.c') diff --git a/rootston/seat.c b/rootston/seat.c index 017e6221..bdcad5c7 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -733,7 +733,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { } #endif - if (unfullscreen) { + if (view && unfullscreen) { struct roots_desktop *desktop = view->desktop; struct roots_output *output; struct wlr_box box; -- cgit v1.2.3