img: remove padding_x from lab_img_render()

padding_x in lab_img_render() was just to make sure window icons in the
titlebar doesn't get too close to adjacent buttons and it didn't felt
clean. To remove it from lab_img, this commit changes the size of window
icon buffers from (window.button.width)x(window.button.height) to
(window.button.width * 0.8)x(window.button.height) and horizontally
slide it by (window.button.width * 0.1) to keep the horizontal padding.

Note that the size of the hitbox for a window icon is kept the same and
nothing is changed from user's perspective.
This commit is contained in:
tokyo4j 2025-01-09 17:20:08 +09:00 committed by Hiroaki Yamamoto
parent a0cf6bb068
commit 45f73b58a1
8 changed files with 20 additions and 30 deletions

View file

@ -15,7 +15,7 @@ _create_buffer(struct scaled_scene_buffer *scaled_buffer, double scale)
{
struct scaled_img_buffer *self = scaled_buffer->data;
struct lab_data_buffer *buffer = lab_img_render(self->img,
self->width, self->height, self->padding, scale);
self->width, self->height, scale);
return buffer;
}
@ -36,8 +36,7 @@ _equal(struct scaled_scene_buffer *scaled_buffer_a,
return lab_img_equal(a->img, b->img)
&& a->width == b->width
&& a->height == b->height
&& a->padding == b->padding;
&& a->height == b->height;
}
static struct scaled_scene_buffer_impl impl = {
@ -48,7 +47,7 @@ static struct scaled_scene_buffer_impl impl = {
struct scaled_img_buffer *
scaled_img_buffer_create(struct wlr_scene_tree *parent, struct lab_img *img,
int width, int height, int padding)
int width, int height)
{
assert(img);
struct scaled_scene_buffer *scaled_buffer = scaled_scene_buffer_create(
@ -59,7 +58,6 @@ scaled_img_buffer_create(struct wlr_scene_tree *parent, struct lab_img *img,
self->img = lab_img_copy(img);
self->width = width;
self->height = height;
self->padding = padding;
scaled_buffer->data = self;
@ -70,14 +68,13 @@ scaled_img_buffer_create(struct wlr_scene_tree *parent, struct lab_img *img,
void
scaled_img_buffer_update(struct scaled_img_buffer *self, struct lab_img *img,
int width, int height, int padding)
int width, int height)
{
assert(img);
lab_img_destroy(self->img);
self->img = lab_img_copy(img);
self->width = width;
self->height = height;
self->padding = padding;
scaled_scene_buffer_request_update(self->scaled_buffer, width, height);
}