From 2e8543cac0436decfd412520b39a85b7e66f8fdc Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Thu, 28 Sep 2017 19:32:04 -0400 Subject: update rootston for surface changes --- rootston/output.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rootston/output.c') diff --git a/rootston/output.c b/rootston/output.c index 5aeb71b1..833ee4aa 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -31,7 +31,7 @@ static void render_view(struct roots_desktop *desktop, surface->texture, &matrix); struct wlr_frame_callback *cb, *cnext; - wl_list_for_each_safe(cb, cnext, &surface->frame_callback_list, link) { + wl_list_for_each_safe(cb, cnext, &surface->current->frame_callback_list, link) { wl_callback_send_done(cb->resource, timespec_to_msec(when)); wl_resource_destroy(cb->resource); } @@ -52,8 +52,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { for (size_t i = 0; i < desktop->views->length; ++i) { struct roots_view *view = desktop->views->items[i]; - int width = view->wlr_surface->current.buffer_width; - int height = view->wlr_surface->current.buffer_height; + int width = view->wlr_surface->current->buffer_width; + int height = view->wlr_surface->current->buffer_height; if (wlr_output_layout_intersects(desktop->layout, wlr_output, view->x, view->y, view->x + width, view->y + height)) { -- cgit v1.2.3 From 8c2e1ed3e67750908d46e6f777ec57fdbc7d4319 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sat, 30 Sep 2017 09:33:19 -0400 Subject: rootston: render subsurfaces --- rootston/output.c | 64 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 26 deletions(-) (limited to 'rootston/output.c') diff --git a/rootston/output.c b/rootston/output.c index 833ee4aa..14d1783e 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -16,28 +16,49 @@ static inline int64_t timespec_to_msec(const struct timespec *a) { return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000; } -static void render_view(struct roots_desktop *desktop, - struct wlr_output *wlr_output, struct timespec *when, - struct roots_view *view, double ox, double oy) { - struct wlr_surface *surface = view->wlr_surface; - float matrix[16]; - float transform[16]; +static void render_surface(struct wlr_surface *surface, + struct roots_desktop *desktop, struct wlr_output *wlr_output, + struct timespec *when, double lx, double ly) { wlr_surface_flush_damage(surface); if (surface->texture->valid) { - wlr_matrix_translate(&transform, ox, oy, 0); - wlr_surface_get_matrix(surface, &matrix, - &wlr_output->transform_matrix, &transform); - wlr_render_with_matrix(desktop->server->renderer, - surface->texture, &matrix); - - struct wlr_frame_callback *cb, *cnext; - wl_list_for_each_safe(cb, cnext, &surface->current->frame_callback_list, link) { - wl_callback_send_done(cb->resource, timespec_to_msec(when)); - wl_resource_destroy(cb->resource); + int width = surface->current->buffer_width; + int height = surface->current->buffer_height; + double ox = lx, oy = ly; + wlr_output_layout_output_coords(desktop->layout, wlr_output, &ox, &oy); + + if (wlr_output_layout_intersects(desktop->layout, wlr_output, + lx, ly, lx + width, ly + height)) { + float matrix[16]; + float transform[16]; + wlr_matrix_translate(&transform, ox, oy, 0); + wlr_surface_get_matrix(surface, &matrix, + &wlr_output->transform_matrix, &transform); + wlr_render_with_matrix(desktop->server->renderer, + surface->texture, &matrix); + + struct wlr_frame_callback *cb, *cnext; + wl_list_for_each_safe(cb, cnext, + &surface->current->frame_callback_list, link) { + wl_callback_send_done(cb->resource, timespec_to_msec(when)); + wl_resource_destroy(cb->resource); + } + } + + struct wlr_subsurface *subsurface; + wl_list_for_each(subsurface, &surface->subsurface_list, parent_link) { + render_surface(subsurface->surface, desktop, wlr_output, when, + lx + subsurface->surface->current->subsurface_position.x, + ly + subsurface->surface->current->subsurface_position.y); } } } +static void render_view(struct roots_view *view, struct roots_desktop *desktop, + struct wlr_output *wlr_output, struct timespec *when) { + render_surface(view->wlr_surface, desktop, wlr_output, when, + view->x, view->y); +} + 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); @@ -52,16 +73,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { for (size_t i = 0; i < desktop->views->length; ++i) { struct roots_view *view = desktop->views->items[i]; - int width = view->wlr_surface->current->buffer_width; - int height = view->wlr_surface->current->buffer_height; - - if (wlr_output_layout_intersects(desktop->layout, wlr_output, - view->x, view->y, view->x + width, view->y + height)) { - double ox = view->x, oy = view->y; - wlr_output_layout_output_coords( - desktop->layout, wlr_output, &ox, &oy); - render_view(desktop, wlr_output, &now, view, ox, oy); - } + render_view(view, desktop, wlr_output, &now); } wlr_renderer_end(server->renderer); -- cgit v1.2.3