commit
908950376e
11
ewmh.c
11
ewmh.c
|
@ -686,10 +686,15 @@ ewmh_window_icon_from_reply(xcb_get_property_reply_t *r, uint32_t preferred_size
|
||||||
|
|
||||||
/* use the greater of the two dimensions to match against the preferred size */
|
/* use the greater of the two dimensions to match against the preferred size */
|
||||||
uint32_t size = MAX(data[0], data[1]);
|
uint32_t size = MAX(data[0], data[1]);
|
||||||
|
|
||||||
/* pick the icon if it's a better match than the one we already have */
|
/* pick the icon if it's a better match than the one we already have */
|
||||||
if (data[0] && data[1] && (
|
bool found_icon_too_small = found_size < preferred_size;
|
||||||
(found_size < preferred_size && size > found_size) ||
|
bool found_icon_too_large = found_size > preferred_size;
|
||||||
(found_size > preferred_size && size >= preferred_size && size < found_size)))
|
bool icon_empty = data[0] == 0 || data[1] == 0;
|
||||||
|
bool better_because_bigger = found_icon_too_small && size > found_size;
|
||||||
|
bool better_because_smaller = found_icon_too_large &&
|
||||||
|
size >= preferred_size && size < found_size;
|
||||||
|
if (!icon_empty && (better_because_bigger || better_because_smaller || found_size == 0))
|
||||||
{
|
{
|
||||||
found_data = data;
|
found_data = data;
|
||||||
found_size = size;
|
found_size = size;
|
||||||
|
|
Loading…
Reference in New Issue