aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_scene.h4
-rw-r--r--types/wlr_scene.c24
2 files changed, 28 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h
index 6e3c13cd..f2773c6b 100644
--- a/include/wlr/types/wlr_scene.h
+++ b/include/wlr/types/wlr_scene.h
@@ -189,5 +189,9 @@ void wlr_scene_output_destroy(struct wlr_scene_output *scene_output);
*/
void wlr_scene_output_set_position(struct wlr_scene_output *scene_output,
int lx, int ly);
+/**
+ * Render and commit an output.
+ */
+bool wlr_scene_output_commit(struct wlr_scene_output *scene_output);
#endif
diff --git a/types/wlr_scene.c b/types/wlr_scene.c
index eb22d69d..4498c5f0 100644
--- a/types/wlr_scene.c
+++ b/types/wlr_scene.c
@@ -477,3 +477,27 @@ void wlr_scene_output_set_position(struct wlr_scene_output *scene_output,
scene_output->x = lx;
scene_output->y = ly;
}
+
+bool wlr_scene_output_commit(struct wlr_scene_output *scene_output) {
+ struct wlr_output *output = scene_output->output;
+
+ if (!wlr_output_attach_render(output, NULL)) {
+ return false;
+ }
+
+ struct wlr_renderer *renderer = wlr_backend_get_renderer(output->backend);
+ assert(renderer != NULL);
+
+ int width, height;
+ wlr_output_effective_resolution(output, &width, &height);
+ wlr_renderer_begin(renderer, width, height);
+ wlr_renderer_clear(renderer, (float[4]){ 0.0, 0.0, 0.0, 0.0 });
+
+ wlr_scene_render_output(scene_output->scene, output,
+ scene_output->x, scene_output->y, NULL);
+ wlr_output_render_software_cursors(output, NULL);
+
+ wlr_renderer_end(renderer);
+
+ return wlr_output_commit(output);
+}