Skip to content

Entry: Don't allocate size to empty icon positions or return a non-null pixbuf for them

Daniel Boles requested to merge wip/dboles/entry-icon-empty-size-3 into gtk-3-24

This is my go at point 2 in #1527 (closed). In brief, it excludes the icon gadgets from sizing and input if they have no image (storage type empty), and makes sure we always return a null pixbuf in that case, rather than a non-null-but-empty one.

If this is considered desirable but for whatever reason not wanted in GTK+ 3, I can prepare one for master instead; I'm more interested in reviews of the concept and implementation, and it's presumably not difficult to cherry-pick to there.

commit fd9bc333645ee8c21db0d95e569cbd6f57b0ae6a (HEAD -> wip/dboles/entry-icon-empty-size-3)
Author: Daniel Boles <dboles.src@gmail.com>
Date:   Sat Dec 15 16:45:34 2018 +0000

    Entry: Emit notify::pixbuf whenever icon's cleared
    
    not just if it was specifically using pixbuf storage type, since the
    getter works for any storage type, so in any case when we had storage
    and clear it, we need to notify that the effective :pixbuf is now NULL.

commit d5a4de8cce970c51a99e8ad52172c4fc071adff5
Author: Daniel Boles <dboles.src@gmail.com>
Date:   Sat Dec 15 16:44:00 2018 +0000

    Entry: Don't allocate size to empty icon positions
    
    We only checked whether the icon_info at the position was NULL, but if
    there was previously an icon there that was since cleared, we have an
    icon_info but no image to show, so we were allocating size for nothing.
    
    Fix by also checking whether the image storage type is empty, so if we
    previously had an icon but have since unset it (but keep the resources
    around in case needed again later), we don't allocate any size to it,
    nor draw it, nor consider clicks to land in it, nor return any Pixbuf.
Edited by Daniel Boles

Merge request reports