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

@ -108,7 +108,7 @@ add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
struct ssd_part *icon_part = add_scene_part(part_list, type);
struct scaled_img_buffer *img_buffer = scaled_img_buffer_create(
parent, imgs[state_set], rc.theme->window_button_width,
rc.theme->window_button_height, /* padding_x */ 0);
rc.theme->window_button_height);
assert(img_buffer);
icon_part->node = &img_buffer->scene_buffer->node;
wlr_scene_node_set_enabled(icon_part->node, false);

View file

@ -632,9 +632,9 @@ ssd_update_window_icon(struct ssd *ssd)
struct scaled_img_buffer *img_buffer =
scaled_img_buffer_from_node(node);
scaled_img_buffer_update(img_buffer, icon_img,
theme->window_button_width,
theme->window_button_height,
icon_padding);
theme->window_button_width - 2 * icon_padding,
theme->window_button_height);
wlr_scene_node_set_position(node, icon_padding, 0);
}
}
} FOR_EACH_END