Fix wxIconBundle::GetIcon(wxDefaultSize) in wxOSX
GetIcon() relies on wxSYS_ICON_X/Y to determine the size to return if it isn't specified and FALLBACK_SYSTEM is used. But wxSYS_ICON_X/Y is not implemented in many ports and this code fails. If wxSYS_ICON_X is -1, usea reasonable default that is the same as other platforms use (32) and also add FALLBACK_NEAREST_LARGER to allow picking some other size if 32x32 isn't available. Doing this fixes an assert in wxLogDialog on macOS if a non-native art provider (such as Tango) isn't available.
This commit is contained in:
@@ -215,6 +215,14 @@ wxIcon wxIconBundle::GetIcon(const wxSize& size, int flags) const
|
||||
|
||||
sizeX = sysX;
|
||||
sizeY = sysY;
|
||||
|
||||
// Not all ports provide this metric, so if they don't, fall back to
|
||||
// something reasonable _and_ allow searching for a closer match.
|
||||
if ( sizeX == -1 && sizeY == -1 )
|
||||
{
|
||||
sizeX = sizeY = 32;
|
||||
flags |= FALLBACK_NEAREST_LARGER;
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate over all icons searching for the exact match or the closest icon
|
||||
|
Reference in New Issue
Block a user