Fix dynamic output based scaling for menu and SSD

wlr_scene_buffers need an additional wlr_scene_buffer_set_source_box()
to be scaled correctly by wlroots based on the output scale.

With this commit the buffers are now scaled correctly but, especially
on higher scale factors, may be a bit blurry.

In the future we likely want a dynamic font label generator based
on the maximal scale of all the outputs the specific buffer is currently on.

Some inspiration for that could be
https://github.com/Nefsen402/sway/blob/scene-graph/sway/sway_text_buffer.c

Fixes #348
This commit is contained in:
Consolatis 2022-05-29 18:34:25 +02:00
parent 78dc2ea7fe
commit e87aa19066
3 changed files with 31 additions and 7 deletions

View file

@ -40,7 +40,11 @@ add_scene_buffer(struct wl_list *list, enum ssd_part_type type,
int x, int y)
{
struct ssd_part *part = add_scene_part(list, type);
part->node = &wlr_scene_buffer_create(parent, buffer)->node;
struct wlr_scene_buffer *scene_buffer =
wlr_scene_buffer_create(parent, buffer);
part->node = &scene_buffer->node;
struct wlr_fbox source_box = { 0, 0, buffer->width, buffer->height };
wlr_scene_buffer_set_source_box(scene_buffer, &source_box);
wlr_scene_node_set_position(part->node, x, y);
return part;
}