[PATCH v5 weston] xwm: Choose icon closest to target size
Pekka Paalanen
ppaalanen at gmail.com
Thu Mar 29 10:44:32 UTC 2018
On Thu, 29 Mar 2018 12:17:46 +0300
Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Tue, 27 Mar 2018 12:43:36 -0500
> Derek Foreman <derekf at osg.samsung.com> wrote:
>
> > Xwayland clients can offer multiple icon sizes in no particular order.
> > Previously xwm was selecting the first one unconditionally. This patch
> > selects the icon that matches the size closest to the target size. The
> > target size is hard coded to 16 since there is only one theme and the
> > data used to create the theme is hard coded.
> >
> > Co-authored-by: Scott Moreau <oreaus at gmail.com>
> > +static uint32_t *
> > +get_icon_size_from_data(int target_width, int target_height,
> > + uint32_t *width, uint32_t *height,
> > + uint32_t length, uint32_t *data)
...
> > + return ret;
> > +
> > + a2 = w * h;
> > + a3 = *width * *height;
> > + if (!a3 || abs(a2 - a1) < abs(a3 - a1)) {
> > + *width = w;
> > + *height = h;
> > + ret = d;
> > + }
> > +
> > + d += a2;
>
> The computations here seem to be correct.
Oh btw, wasn't the intention to pick the closest *larger* sized icon
from the list and then downscale? Only pick smaller if there is no
larger provided.
This seems to pick the closest larger or smaller in terms of area.
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180329/6e421198/attachment.sig>
More information about the wayland-devel
mailing list