On Thu, 29 Mar 2018 12:17:46 +0300
Pekka Paalanen <ppaala...@gmail.com> wrote:

> On Tue, 27 Mar 2018 12:43:36 -0500
> Derek Foreman <der...@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 <ore...@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

Attachment: pgpBzA5DvHpZa.pgp
Description: OpenPGP digital signature

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to