Reuse render() and struct timespec *now
This commit is contained in:
parent
03c020f058
commit
2c08d0b421
50
dwl.c
50
dwl.c
|
@ -240,8 +240,7 @@ static void pointerfocus(Client *c, struct wlr_surface *surface,
|
||||||
static void quit(const Arg *arg);
|
static void quit(const Arg *arg);
|
||||||
static void render(struct wlr_surface *surface, int sx, int sy, void *data);
|
static void render(struct wlr_surface *surface, int sx, int sy, void *data);
|
||||||
static void renderclients(Monitor *m, struct timespec *now);
|
static void renderclients(Monitor *m, struct timespec *now);
|
||||||
static void renderlayer(Monitor *m, struct wl_list *layer_surfaces);
|
static void renderlayer(struct wl_list *layer_surfaces, struct timespec *now);
|
||||||
static void renderlayersurface(struct wlr_surface *surface, int sx, int sy, void *data);
|
|
||||||
static void rendermon(struct wl_listener *listener, void *data);
|
static void rendermon(struct wl_listener *listener, void *data);
|
||||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||||
static void run(char *startup_cmd);
|
static void run(char *startup_cmd);
|
||||||
|
@ -1554,40 +1553,19 @@ renderclients(Monitor *m, struct timespec *now)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
renderlayer(Monitor *m, struct wl_list *layer_surfaces)
|
renderlayer(struct wl_list *layer_surfaces, struct timespec *now)
|
||||||
{
|
{
|
||||||
|
struct render_data rdata;
|
||||||
LayerSurface *layersurface;
|
LayerSurface *layersurface;
|
||||||
wl_list_for_each(layersurface, layer_surfaces, link)
|
wl_list_for_each(layersurface, layer_surfaces, link) {
|
||||||
|
rdata.output = layersurface->layer_surface->output;
|
||||||
|
rdata.when = now;
|
||||||
|
rdata.x = layersurface->geo.x;
|
||||||
|
rdata.y = layersurface->geo.y;
|
||||||
|
|
||||||
wlr_surface_for_each_surface(layersurface->layer_surface->surface,
|
wlr_surface_for_each_surface(layersurface->layer_surface->surface,
|
||||||
renderlayersurface, layersurface);
|
render, &rdata);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
renderlayersurface(struct wlr_surface *surface, int sx, int sy, void *data)
|
|
||||||
{
|
|
||||||
LayerSurface *layersurface = data;
|
|
||||||
struct wlr_texture *texture = wlr_surface_get_texture(surface);
|
|
||||||
struct wlr_output *output;
|
|
||||||
double ox = 0, oy = 0;
|
|
||||||
enum wl_output_transform transform;
|
|
||||||
struct wlr_box box;
|
|
||||||
float matrix[9];
|
|
||||||
struct timespec now;
|
|
||||||
|
|
||||||
if (!texture) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output = layersurface->layer_surface->output;
|
|
||||||
wlr_output_layout_output_coords(output_layout, output, &ox, &oy);
|
|
||||||
ox += layersurface->geo.x + sx, oy += layersurface->geo.y + sy;
|
|
||||||
transform = wlr_output_transform_invert(surface->current.transform);
|
|
||||||
memcpy(&box, &layersurface->geo, sizeof(struct wlr_box));
|
|
||||||
wlr_matrix_project_box(matrix, &box, transform, 0,
|
|
||||||
output->transform_matrix);
|
|
||||||
wlr_render_texture_with_matrix(drw, texture, matrix, 1);
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
|
||||||
wlr_surface_send_frame_done(surface, &now);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1620,14 +1598,14 @@ rendermon(struct wl_listener *listener, void *data)
|
||||||
wlr_renderer_begin(drw, m->wlr_output->width, m->wlr_output->height);
|
wlr_renderer_begin(drw, m->wlr_output->width, m->wlr_output->height);
|
||||||
wlr_renderer_clear(drw, rootcolor);
|
wlr_renderer_clear(drw, rootcolor);
|
||||||
|
|
||||||
renderlayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
|
renderlayer(&m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &now);
|
||||||
renderlayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]);
|
renderlayer(&m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &now);
|
||||||
renderclients(m, &now);
|
renderclients(m, &now);
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
renderindependents(m->wlr_output, &now);
|
renderindependents(m->wlr_output, &now);
|
||||||
#endif
|
#endif
|
||||||
renderlayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
|
renderlayer(&m->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &now);
|
||||||
renderlayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
|
renderlayer(&m->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &now);
|
||||||
|
|
||||||
/* Hardware cursors are rendered by the GPU on a separate plane, and can be
|
/* Hardware cursors are rendered by the GPU on a separate plane, and can be
|
||||||
* moved around without re-rendering what's beneath them - which is more
|
* moved around without re-rendering what's beneath them - which is more
|
||||||
|
|
Loading…
Reference in a new issue