Check for subsurfaces and popups before using wlr_output_set_fullscreen_surface
This commit is contained in:
parent
80998cdf57
commit
abab2902f5
|
@ -19,13 +19,14 @@ struct roots_output {
|
|||
struct wlr_output *wlr_output;
|
||||
struct wl_listener frame;
|
||||
struct timespec last_frame;
|
||||
struct wl_list link;
|
||||
struct wl_list link; // roots_desktop:outputs
|
||||
struct roots_view *fullscreen_view;
|
||||
};
|
||||
|
||||
struct roots_desktop {
|
||||
struct wl_list views; // roots_view::link
|
||||
|
||||
struct wl_list outputs;
|
||||
struct wl_list outputs; // roots_output::link
|
||||
struct timespec last_frame;
|
||||
|
||||
struct roots_server *server;
|
||||
|
|
|
@ -57,7 +57,7 @@ struct roots_view {
|
|||
float rotation;
|
||||
|
||||
bool maximized;
|
||||
struct wlr_output *fullscreen_output;
|
||||
struct roots_output *fullscreen_output;
|
||||
struct {
|
||||
double x, y;
|
||||
uint32_t width, height;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue