winemac: Scale large system tray icons down to fit status bar.

This commit is contained in:
Ken Thomases 2013-04-05 03:34:20 -05:00 committed by Alexandre Julliard
parent 787a937ed8
commit 401b75e3e9
1 changed files with 13 additions and 0 deletions

View File

@ -149,8 +149,21 @@ void macdrv_set_status_item_image(macdrv_status_item s, CGImageRef cgimage)
NSImage* image = nil;
if (cgimage)
{
NSSize size;
CGFloat maxSize = [[NSStatusBar systemStatusBar] thickness];
BOOL changed = FALSE;
image = [[NSImage alloc] initWithCGImage:cgimage size:NSZeroSize];
CGImageRelease(cgimage);
size = [image size];
while (size.width > maxSize || size.height > maxSize)
{
size.width /= 2.0;
size.height /= 2.0;
changed = TRUE;
}
if (changed)
[image setSize:size];
}
[statusItem.item setImage:image];
[image release];