- (void)awakeFromNib
{
[self setAutoresizesSubviews: YES];
- [self setImagesLeft:[NSImage imageNamed:@"topbar-dark-left"] middle: [NSImage imageNamed:@"topbar-dark-center-fill"] right:[NSImage imageNamed:@"topbar-dark-right"]];
+ [self setImagesLeft:imageFromRes(@"topbar-dark-left") middle: imageFromRes(@"topbar-dark-center-fill") right:imageFromRes(@"topbar-dark-right")];
[self loadButtonIcons];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTintChanged:) name: NSControlTintDidChangeNotification object: nil];
[contextMenu release];
NSURL * representedURL = [[self window] representedURL];
- if (! representedURL)
+ if (!representedURL)
return;
NSArray * pathComponents;
[currentItem setImage: icon];
[currentItem setTarget: self];
- [NSMenu popUpContextMenu: contextMenu withEvent: o_event forView: [self superview]];
+ // center the context menu similar to the white interface
+ CGFloat menuWidth = [contextMenu size].width;
+ NSRect windowFrame = [[self window] frame];
+ NSPoint point;
+
+ CGFloat fullButtonWidth = 0.;
+ if([[VLCMain sharedInstance] nativeFullscreenMode])
+ fullButtonWidth = 20.;
+
+ // assumes 60 px for the window buttons
+ point.x = (windowFrame.size.width - 60. - fullButtonWidth) / 2. - menuWidth / 2. + 60. - 20.;
+ point.y = windowFrame.size.height + 1.;
+ if (point.x < 0)
+ point.x = 10;
+
+ NSEvent *fakeMouseEvent = [NSEvent mouseEventWithType:NSRightMouseDown
+ location:point
+ modifierFlags:0
+ timestamp:0
+ windowNumber:[[self window] windowNumber]
+ context:nil
+ eventNumber:0
+ clickCount:0
+ pressure:0];
+ [NSMenu popUpContextMenu: contextMenu withEvent: fakeMouseEvent forView: [self superview]];
}
- (IBAction)revealInFinder:(id)sender