Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350751

Summary: SWT TrayItem Image not scaling properly on Mac OSX
Product: [Eclipse Project] Platform Reporter: l1m5 <benjamin.limmer>
Component: SWTAssignee: Lakshmi P Shanmugam <lshanmug>
Status: VERIFIED FIXED QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: normal    
Priority: P3 CC: benjamin.limmer, lshanmug, Silenio_Quarti
Version: 3.7   
Target Milestone: 3.8 M2   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Scaling problem of the TrayItem on Mac 10.6.x
none
patch none

Description l1m5 CLA 2011-06-29 17:38:25 EDT
Created attachment 198864 [details]
Scaling problem of the TrayItem on Mac 10.6.x

On my cross-platform SWT Java application, I'm using TrayItem's setImages() function to set the dock and status bar icon. The icon is a 128x128 transparent PNG. The status and tray icons are appropriately clipped on both Windows and Linux distributions, but on the Mac I have problems that make the status bar icon appear with strange padding on both sides like attachment 1 [details].

It's strange to me that this is working on all other platforms but the Mac. For instance, on my Linux and Windows 7 boxes, this does not occur.

I believe the issue lies in widgets/TrayIcon.java in the setImage function. There the code calls item.setLength to the width of the image + the border. I believe this is what is causing the extra padding to show up. This only happens on the Mac because (I think) Windows and Linux automatically crop to a square icon which Mac does not.
Comment 1 Lakshmi P Shanmugam CLA 2011-07-11 09:24:18 EDT
Created attachment 199412 [details]
patch

The trayitem is created as a square and the image is scaled accordingly.
Silenio, can you please review?
Comment 2 l1m5 CLA 2011-07-15 12:52:43 EDT
Is there any way I could get an ETA for QA on the proposed patch?

Thank you!
Comment 3 Silenio Quarti CLA 2011-07-28 18:05:22 EDT
Patch is good. Please remove BORDER static var before releasing.
Comment 4 l1m5 CLA 2011-08-02 15:20:04 EDT
Thank you very much for taking care of this so promptly! Is there any chance to resolve the same problem in carbon?
Comment 5 Lakshmi P Shanmugam CLA 2011-08-05 03:25:47 EDT
(In reply to comment #4)
> Is there any chance to
> resolve the same problem in carbon?
No, sorry! Carbon is not a supported platform in Eclipse now (since 3.7).
Comment 6 l1m5 CLA 2011-08-05 11:08:16 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > Is there any chance to
> > resolve the same problem in carbon?
> No, sorry! Carbon is not a supported platform in Eclipse now (since 3.7).

No problem, I figured it was a long shot. Thanks again for being so responsive to this issue!
Comment 7 Lakshmi P Shanmugam CLA 2011-08-08 07:56:13 EDT
Thanks Silenio!
Fixed in 3.8 HEAD.
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=5e8d594fe029072e912e0bfb886e42a17cb362bc
Comment 8 Lakshmi P Shanmugam CLA 2011-09-13 05:04:23 EDT
Verified in I20110912-2126
Comment 9 Lakshmi P Shanmugam CLA 2011-11-18 08:24:15 EST
*** Bug 350332 has been marked as a duplicate of this bug. ***