Skip to content

window: sort icons before adding to _NET_WM_ICON

Ray Strode requested to merge wip/sort-icons-by-size into master

When processing the list of icons for a window to add them to _NET_WM_ICON gdk_x11_surface_set_icon_list only adds as many icon sizes as will fit within X protocol limits.

It achieves this by keeping a running total of the number of bytes taken up by icons already processed and bails as soon as it goes over the limit.

The problem is, one 512x512 icon is already over the limit, and so no icons will get added at all if the first icon in list is 512x512.

Indeed, the code seems to assume the list is sorted from smallest icon to biggest icon.

This commit changes the caller to sort the list.

Merge request reports