Closed js closed 12 years ago
I've come across issues like this before, and the workaround seems to be to register the view for notifications for NSWindowDidBecomeKeyNotification and NSWindowDidResignKeyNotification and then call setNeedsDisplay:YES when those notifications are received. What we could do is register for the notifications for the title bar view only, and then iterate through all its subviews recursively and redraw everything. I can give this a try if I have some time, or you could go ahead and try it and let me know if it works.
We may need to recurse through the subviews but I don't think we need the notifications as we already override all the window state change methods: https://github.com/indragiek/INAppStoreWindow/blob/master/INAppStoreWindow.m#L316
Oh yeah, forgot about that. Then yeah all we'd need to do is just recurse the subviews in those notification callbacks.
Tried recursively calling -setNeedsDisplay: on the subviews but it didn't work, I think there must be a different flag that needs to be set although not sure what that would be.
I'm not sure why I didn't try the approach in pull request #61 right away, but I initially thought that it wouldn't allow the click-through (if the window was inactive) to work, but it certainly seems to.
I thought of the same approach and didn't suggest it for the same reasons but if it works that's awesome! I'll take a look at the pull request soon.
Sent from my iPhone
On 2012-08-29, at 3:21 AM, "Johan Sørensen" notifications@github.com wrote:
I'm not sure why I didn't try the approach in pull request
away, but I initially thought that it wouldn't allow the click-through (if the window was inactive) to work, but it certainly seems to.
— Reply to this email directly or view it on GitHubhttps://github.com/indragiek/INAppStoreWindow/issues/59#issuecomment-8119642.
Works great.
I noticed that any controls added to the titleBarView doesn't get the inactive state set when the window (or app) isn't frontmost. Compare it with the Finder windows where the buttons also get a slight tint when they're in the background.
The issue can be seen here if you switch back and forth between the main window and the opened window controller: https://github.com/js/INAppStoreWindow/commit/6f567d5a7e3283236bc91274182f516e8d052a7d
I'm not quite sure what kind of state flag (and where) NSWindow is supposed to set on its view in order for the controls to get this state?