diff options
Diffstat (limited to 'examples/compositor/main.c')
-rw-r--r-- | examples/compositor/main.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/compositor/main.c b/examples/compositor/main.c index 6a689669..e13fda24 100644 --- a/examples/compositor/main.c +++ b/examples/compositor/main.c @@ -11,6 +11,7 @@ #include <wlr/render/gles2.h> #include <wlr/types/wlr_output.h> #include <xkbcommon/xkbcommon.h> +#include <wlr/util/log.h> #include "shared.h" #include "compositor.h" @@ -27,7 +28,18 @@ void handle_output_frame(struct output_state *output, struct timespec *ts) { wlr_output_make_current(wlr_output); wlr_renderer_begin(sample->renderer, wlr_output); - // TODO: render surfaces + + struct wl_resource *_res; + float matrix[16]; + wl_list_for_each(_res, &sample->compositor.surfaces, link) { + struct wlr_surface *surface = wl_resource_get_user_data(_res); + if (surface->valid) { + wlr_surface_get_matrix(surface, &matrix, + &wlr_output->transform_matrix, 200, 200); + wlr_render_with_matrix(sample->renderer, surface, &matrix); + } + } + wlr_renderer_end(sample->renderer); wlr_output_swap_buffers(wlr_output); } @@ -42,7 +54,7 @@ int main() { state.renderer = wlr_gles2_renderer_init(); wl_display_init_shm(compositor.display); - wl_compositor_init(compositor.display, &state.compositor); + wl_compositor_init(compositor.display, &state.compositor, state.renderer); wl_shell_init(compositor.display, &state.shell); compositor_run(&compositor); |