aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/rootston/desktop.h5
-rw-r--r--include/rootston/view.h2
-rw-r--r--rootston/desktop.c16
-rw-r--r--rootston/output.c27
4 files changed, 43 insertions, 7 deletions
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h
index c245eb09..8bf1f6eb 100644
--- a/include/rootston/desktop.h
+++ b/include/rootston/desktop.h
@@ -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;
diff --git a/include/rootston/view.h b/include/rootston/view.h
index 77bbfbec..44a98115 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -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;
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;