mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
ssd: limit icon size to ~85% of window_button_width
This ensures that the icon doesn't push right up to the window edge (or left-aligned title) when using a large font or narrow button width. In the default config (with 10pt font), it makes no difference since the limiting factor on the icon size is the titlebar height anyway. I spent way too much time over-thinking how to compute the padding. I think 2px on each side is reasonable (and it should be equal on each side), so window_button_width/10 (rounded down) should be fine. Eventually the padding should probably be configurable anyway.
This commit is contained in:
parent
f347408949
commit
db3aab77fe
1 changed files with 10 additions and 1 deletions
|
|
@ -654,7 +654,16 @@ ssd_update_window_icon(struct ssd *ssd)
|
|||
|
||||
struct theme *theme = ssd->view->server->theme;
|
||||
|
||||
int icon_size = MIN(theme->window_button_width,
|
||||
/*
|
||||
* Ensure a small amount of horizontal padding within the button
|
||||
* area (2px on each side with the default 26px button width).
|
||||
* A new theme setting could be added to configure this. Using
|
||||
* an existing setting (padding.width or window.button.spacing)
|
||||
* was considered, but these settings have distinct purposes
|
||||
* already and are zero by default.
|
||||
*/
|
||||
int hpad = theme->window_button_width / 10;
|
||||
int icon_size = MIN(theme->window_button_width - 2 * hpad,
|
||||
theme->title_height - 2 * theme->padding_height);
|
||||
/* TODO: take into account output scales */
|
||||
int icon_scale = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue