indragiek / INAppStoreWindow

NSWindow subclass with a highly customizable title bar and traffic lights
BSD 2-Clause "Simplified" License
1.06k stars 160 forks source link

Title bar colour on retina display border issue #111

Open kieransenior opened 11 years ago

kieransenior commented 11 years ago

Hey there,

I've noticed that on a retina display the border has a lighter coloured line on top regardless of what you set the title bar colour to be. Perhaps I'm doing something wrong? Any hints? screen shot 2013-06-06 at 15 51 05

indragiek commented 11 years ago

Seems like the drawing rectangle passed into the drawing block might be 1px too small. Could you try increasing the height of your drawing rectangle by 1 pixel and see if it works?

kieransenior commented 11 years ago

Do you mean just setting titleBarHeight with an extra pixel? If so, I've tried that to no avail.

kieransenior commented 11 years ago

@indragiek This is the line of code which is the culprit. Get rid of that and it's fixed.

https://github.com/indragiek/INAppStoreWindow/blob/master/INAppStoreWindow.m#L236

indragiek commented 11 years ago

That line of code only executes when you're using the default title bar appearance (OS X style) to show the highlight line at the top. If you're using a custom title bar, you should be calling -setTitleBarDrawingBlock: and drawing your custom title bar background in there, and this problem won't appear because the rect will be sized appropriately.

kieransenior commented 11 years ago

I haven't passed a block to specify a custom title bar yet, nothing is specified in that respect. Here's what's around so far:

INAppStoreWindow *aWindow = (INAppStoreWindow*)[self window];
aWindow.titleBarHeight = 40.0;
aWindow.titleBarStartColor = [NSColor colorWithCalibratedRed:0.1 green:0.3 blue:0.5 alpha:1];
aWindow.titleBarEndColor = [NSColor colorWithCalibratedRed:0.2 green:0.4 blue:0.6 alpha:1];
aWindow.titleTextColor = [NSColor colorWithCalibratedWhite:1.0 alpha:1.0];
aWindow.trafficLightButtonsLeftMargin = (float)12.0;
aWindow.centerTrafficLightButtons = YES;
aWindow.centerFullScreenButton = YES;
aWindow.fullScreenButtonRightMargin = (float)12.0;

So omitting the block causes the problem?

indragiek commented 11 years ago

Oops, I forgot about the title bar color properties. I'll think of a good solution. — Indragie Karunaratne

On Fri, Jun 14, 2013 at 9:27 AM, Kieran Senior notifications@github.com wrote:

I haven't passed a block to specify a custom title bar yet, nothing is specified in that respect. Here's what's around so far: INAppStoreWindow aWindow = (INAppStoreWindow)[self window]; aWindow.titleBarHeight = 40.0; aWindow.titleBarStartColor = [NSColor colorWithCalibratedRed:0.1 green:0.3 blue:0.5 alpha:1]; aWindow.titleBarEndColor = [NSColor colorWithCalibratedRed:0.2 green:0.4 blue:0.6 alpha:1]; aWindow.titleTextColor = [NSColor colorWithCalibratedWhite:1.0 alpha:1.0]; aWindow.trafficLightButtonsLeftMargin = (float)12.0; aWindow.centerTrafficLightButtons = YES; aWindow.centerFullScreenButton = YES; aWindow.fullScreenButtonRightMargin = (float)12.0;

So omitting the block causes the problem?

Reply to this email directly or view it on GitHub: https://github.com/indragiek/INAppStoreWindow/issues/111#issuecomment-19467328

zakdances commented 11 years ago

Was a fix ever merged in for this issue?

indragiek commented 11 years ago

Not yet. Sorry, totally forgot about this. I'll see if I can put together a fix sometime this week. If you have a solution before then, please feel free to submit a pull request.

zakdances commented 11 years ago

I haven't had a change to look at this in-depth yet. Were you able to explore a possible fix?

kieransenior commented 11 years ago

Sorry not yet, this one fell off my radar until I get time to reinvestigate it.

On 3 Oct 2013, at 18:41, zakdances notifications@github.com wrote:

I haven't had a change to look at this in-depth yet. Were you able to explore a possible fix?

— Reply to this email directly or view it on GitHub.

zakdances commented 11 years ago

I've done a little investigating and this is what I'm guessing: INAppStoreWindow's titleBar simply overlaps the default titleBar. Because the default titleBar is kept on, it insets the contentView of the window by 1 pixel (you can NSLog the frame of the contentView to confirm). So what you're seeing here is the default titleBar peaking above the inset INAppStoreWindow titleBar. Does this correspond with what you're seeing as well?

kieransenior commented 11 years ago

Yeah that's right - it was just one pixel off from the top. As I say, I'd love to devote some more time to this but I'm swamped at the moment and the project using InAppStoreWindow has been lowered in priority for the moment. I'll re-address it in the near future hopefully. If you manage to find a fix before I do I'll check it out. Issue a pull request and I can check that out and see if it works as I expect, unless I get around to it first :)

vojto commented 10 years ago

+1 :-(

jakepetroules commented 10 years ago

Still an issue? Rendering code geometry has changed quite a bit recently.