diff options
author | emersion <contact@emersion.fr> | 2017-11-20 19:45:10 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-11-20 19:45:10 +0100 |
commit | abab2902f5051bcde93b34b5a57bf9bae93b3bab (patch) | |
tree | 708b7b8b6adf907e5a735e61b34c7cce20a5f1ce /rootston | |
parent | 80998cdf57756fe46d55921c98a745aff4848215 (diff) |
Check for subsurfaces and popups before using wlr_output_set_fullscreen_surface
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/desktop.c | 16 | ||||
-rw-r--r-- | rootston/output.c | 27 |
2 files changed, 39 insertions, 4 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c index be74b619..b48da44b 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -174,8 +174,14 @@ void view_set_fullscreen(struct roots_view *view, bool fullscreen, output_box->height); view->rotation = 0; - wlr_output_set_fullscreen_surface(output, view->wlr_surface); - view->fullscreen_output = output; + struct roots_output *roots_output; + wl_list_for_each(roots_output, &view->desktop->outputs, link) { + if (roots_output->wlr_output == output) { + roots_output->fullscreen_view = view; + view->fullscreen_output = roots_output; + break; + } + } } if (was_fullscreen && !fullscreen) { @@ -183,7 +189,7 @@ void view_set_fullscreen(struct roots_view *view, bool fullscreen, view->saved.height); view->rotation = view->saved.rotation; - wlr_output_set_fullscreen_surface(view->fullscreen_output, NULL); + view->fullscreen_output->fullscreen_view = NULL; view->fullscreen_output = NULL; } } @@ -236,6 +242,10 @@ bool view_center(struct roots_view *view) { void view_destroy(struct roots_view *view) { wl_signal_emit(&view->events.destroy, view); + if (view->fullscreen_output) { + view->fullscreen_output->fullscreen_view = NULL; + } + wl_list_remove(&view->link); free(view); } diff --git a/rootston/output.c b/rootston/output.c index 35a5dac3..82618b06 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -174,6 +174,22 @@ static void render_view(struct roots_view *view, struct roots_desktop *desktop, } } +static bool has_standalone_surface(struct roots_view *view) { + if (!wl_list_empty(&view->wlr_surface->subsurface_list)) { + wlr_log(L_DEBUG, "has subsurfaces"); + return false; + } + + switch (view->type) { + case ROOTS_XDG_SHELL_V6_VIEW: + return wl_list_empty(&view->xdg_surface_v6->popups); + case ROOTS_WL_SHELL_VIEW: + return wl_list_empty(&view->wl_shell_surface->popups); + case ROOTS_XWAYLAND_VIEW: + return true; + } +} + static void output_frame_notify(struct wl_listener *listener, void *data) { struct wlr_output *wlr_output = data; struct roots_output *output = wl_container_of(listener, output, frame); @@ -186,11 +202,20 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { wlr_output_make_current(wlr_output); wlr_renderer_begin(server->renderer, wlr_output); - if (wlr_output->fullscreen_surface != NULL) { + if (output->fullscreen_view != NULL) { + if (has_standalone_surface(output->fullscreen_view)) { + wlr_output_set_fullscreen_surface(wlr_output, + output->fullscreen_view->wlr_surface); + } else { + wlr_output_set_fullscreen_surface(wlr_output, NULL); + render_view(output->fullscreen_view, desktop, wlr_output, &now); + } wlr_renderer_end(server->renderer); wlr_output_swap_buffers(wlr_output); output->last_frame = desktop->last_frame = now; return; + } else { + wlr_output_set_fullscreen_surface(wlr_output, NULL); } struct roots_view *view; |