<AWT Dev> [8] Review request for 7148275: [macosx] setIconImages() not working correctly (distorted icon when minimized)

Mike Swingler swingler at apple.com
Mon Apr 2 12:49:24 PDT 2012

Sorry, I jumped right to the diff.

I looked into this, and there is no way to provide multiple image reps for Dock, because it needs to be able to smoothly scale as your mouse over the Dock with magnification turned on. Since it would look funny to snap between different representations of the same image as you scrub across it with your mouse, the Dock simply picks the biggest one it needs and down samples it.

In this case, I'd say "don't worry about it". The whole concept is foreign on Mac OS X, because the default behavior of showing a snapshot of the window is almost always a more recognizable representation of the window.

Mike Swingler
Apple Inc.

On Apr 2, 2012, at 12:29 PM, Anthony Petrov wrote:

> But this approach doesn't work as one would expect. Please read my quote bellow. In a nutshell we've got 2 options:
> 1. Pass all images representations in one NSImage to setMiniwindowImage:. This doesn't work - if the dock is small, still the largest image is chosen only. Is there way to fix this?
> 2. There's no API to request the current dock size, so I can't apply the approach as we do on Windows.
> What should we do to make it work - either as #1 or #2?
> --
> best regards,
> Anthony
> On 4/2/2012 11:19 PM, Mike Swingler wrote:
>> This seems like a reasonable approach, though setting window icons is generally discouraged on OS X.
>> Regards,
>> Mike Swingler
>> Apple Inc.
>> On Apr 2, 2012, at 7:16 AM, Anthony Petrov wrote:
>>> Hi Mike,
>>> Have you had a chance to take a look at the issue?
>>> --
>>> best regards,
>>> Anthony
>>> On 03/27/12 20:49, Anthony Petrov wrote:
>>>> On 3/27/2012 8:44 PM, Anthony Petrov wrote:
>>>>> Artem: this is a good idea, thanks.
>>>>> Mike: I'm trying to do something like this:
>>>>> http://cr.openjdk.java.net/~anthony/8-15-lowResIcon-7148275.1/
>>>>> i.e. I'm feeding an NSImage with images of all available sizes.
>>>>> A sample test provides a list of icons 16x16, 32x32, 48x48, and 64x64.
>>>>> I've verified that they all get added into the representations array.
>>>>> However, even if I resize the dock to be very very tiny, it still
>>>>> chooses the 64x64 icon to represent a minimized window. This is
>>>>> actually wrong since the 16x16 icon would look better in this case
>>>>> than a resized 64x64 icon.
>>>>> Any idea how this can be fixed?
>>>>> Another solution would be to take an approach similar to what we use
>>>>> on MS Windows: we query the system icon size, and then choose the best
>>>>> image (see SunToolkit.getScaledIconData()). But I can't find API that
>>>> Rather WWindowPeer.updateIconImages() which calls the SunToolkit method.
>>>> --
>>>> best regards,
>>>> Anthony
>>>>> would allow me to determine the current dock icon size on OS X. Is
>>>>> there any?
>>>>> --
>>>>> best regards,
>>>>> Anthony
>>>>> On 3/26/2012 5:19 PM, Artem Ananiev wrote:
>>>>>> It was fine for 7uX, but can we do anything better for JDK8? Is the
>>>>>> largest icon always the best? I remember on Windows we use another
>>>>>> approach to find what exactly icon from the list to apply.
>>>>>> Thanks,
>>>>>> Artem
>>>>>> On 3/23/2012 8:18 PM, Anthony Petrov wrote:
>>>>>>> Hello,
>>>>>>> Please review a fix for
>>>>>>> http://bugs.sun.com/view_bug.do?bug_id=7148275 at:
>>>>>>> http://cr.openjdk.java.net/~anthony/8-15-lowResIcon-7148275.0/
>>>>>>> This is a direct forward-port of the same fix from 7u4.
>>>>>>> More details:
>>>>>>> http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-March/003531.html
>>>>>>> --
>>>>>>> best regards,
>>>>>>> Anthony

More information about the awt-dev mailing list