diff --git a/output.c b/output.c index 1394c71..b4732f9 100644 --- a/output.c +++ b/output.c @@ -26,6 +26,15 @@ #include "server.h" #include "view.h" +static void +render_overlay(struct wlr_renderer *renderer, struct wlr_output *output, int width, int height) +{ + struct wlr_box box = { .width = width, .height = height }; + float color[4] = { 0.0, 0.0, 0.0, 0.3 }; + + wlr_render_rect(renderer, &box, color, output->transform_matrix); +} + /* Used to move all of the data necessary to render a surface from the * top-level frame handler to the per-surface render function. */ struct render_data { @@ -102,6 +111,12 @@ handle_output_frame(struct wl_listener *listener, void *data) wl_list_for_each_reverse(view, &output->server->views, link) { rdata.view = view; view_for_each_surface(view, render_surface, &rdata); + /* If we have dialogs open and this view is not the + top of the stack, draw an overlay. */ + if (have_dialogs_open(output->server) && + view->link.prev != &output->server->views) { + render_overlay(renderer, output->wlr_output, width, height); + } } wlr_renderer_end(renderer); diff --git a/seat.c b/seat.c index c8a3c3e..88e56ed 100644 --- a/seat.c +++ b/seat.c @@ -26,7 +26,7 @@ #include "server.h" #include "view.h" -static inline bool +bool have_dialogs_open(struct cg_server *server) { /* We only need to test if there is more than a single diff --git a/seat.h b/seat.h index ba74060..cb012eb 100644 --- a/seat.h +++ b/seat.h @@ -70,5 +70,6 @@ struct cg_seat *cg_seat_create(struct cg_server *server); void cg_seat_destroy(struct cg_seat *seat); struct cg_view *seat_get_focus(struct cg_seat *seat); void seat_set_focus(struct cg_seat *seat, struct cg_view *view); +bool have_dialogs_open(struct cg_server *server); #endif