diff options
| -rw-r--r-- | dwl.c | 50 | 
1 files changed, 14 insertions, 36 deletions
| @@ -240,8 +240,7 @@ static void pointerfocus(Client *c, struct wlr_surface *surface,  static void quit(const Arg *arg);  static void render(struct wlr_surface *surface, int sx, int sy, void *data);  static void renderclients(Monitor *m, struct timespec *now); -static void renderlayer(Monitor *m, struct wl_list *layer_surfaces); -static void renderlayersurface(struct wlr_surface *surface, int sx, int sy, void *data); +static void renderlayer(struct wl_list *layer_surfaces, struct timespec *now);  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 run(char *startup_cmd); @@ -1554,40 +1553,19 @@ renderclients(Monitor *m, struct timespec *now)  }  void -renderlayer(Monitor *m, struct wl_list *layer_surfaces) +renderlayer(struct wl_list *layer_surfaces, struct timespec *now)  { +	struct render_data rdata;  	LayerSurface *layersurface; -	wl_list_for_each(layersurface, layer_surfaces, link) -		wlr_surface_for_each_surface(layersurface->layer_surface->surface, -			renderlayersurface, layersurface); -} - -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; +	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; -	if (!texture) { -		return; +		wlr_surface_for_each_surface(layersurface->layer_surface->surface, +				render, &rdata);  	} - -	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 @@ -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_clear(drw, rootcolor); -		renderlayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); -		renderlayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); +		renderlayer(&m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &now); +		renderlayer(&m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &now);  		renderclients(m, &now);  #ifdef XWAYLAND  		renderindependents(m->wlr_output, &now);  #endif -		renderlayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); -		renderlayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); +		renderlayer(&m->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &now); +		renderlayer(&m->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &now);  		/* 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 | 
