Giter Club home page Giter Club logo

Comments (6)

indragiek avatar indragiek commented on July 18, 2024

This is a known issue, and I have been trying to fix it without much luck. What I know is that the themeFrame (superview of [window contentView]) has an NSTrackingArea set up to capture the mouse entered event and activate the mouse over. I have tried manually calling [themeFrame updateTrackingAreas] without success. What you could try is modifying the single tracking area of the themeFrame and set the proper rect for the traffic lights. This would basically mean creating a new tracking area with all the attributes of the current tracking area (except the rect, which would be adjusted to the new traffic light position), removing the old tracking area, and adding the new one.

I'll push a fix as soon as I figure it out (or if you figure it out, send me a pull request and I'll merge the changes).

Thanks.

from inappstorewindow.

indragiek avatar indragiek commented on July 18, 2024

Just tried a fix real quick. I executed this code on -awakeForNib (after the traffic lights had been positioned):

- (void)_resetThemeFrameTrackingArea
{
    NSView *themeFrame = [[self contentView] superview];
    NSArray *trackingAreas = [themeFrame trackingAreas];
    if (![trackingAreas count]) { return; }
    NSTrackingArea *lightsTracking = [trackingAreas objectAtIndex:0];
    NSButton *closeButton = [self standardWindowButton:NSWindowCloseButton];
    NSRect newTrackingRect = [lightsTracking rect];
    newTrackingRect.origin.y = [closeButton frame].origin.y;
    NSTrackingArea *newArea = [[NSTrackingArea alloc] initWithRect:newTrackingRect options:[lightsTracking options] owner:[lightsTracking owner] userInfo:[lightsTracking userInfo]];
    [themeFrame removeTrackingArea:lightsTracking];
    [themeFrame addTrackingArea:newArea];
    [newArea release];
}

This didn't seem to have any effect. Maybe I'm running it too early or something. But there's a place for you to start ;-)

EDIT: If you take a look at Sparrow (another app that uses this same technique to position its traffic lights), they seem to have the exact same bug here which indicates that they most likely were not able to find a solution for it.

from inappstorewindow.

nonamelive avatar nonamelive commented on July 18, 2024

Exactly, they have the same problem.
I found that the reason the newly added trackingArea doesn't work is that the trackingArea is "pending installed, notInstalled, disabled". You can find this information by logging it in the console. I still don't have a solution to fix it. :)

from inappstorewindow.

indragiek avatar indragiek commented on July 18, 2024

I doubt that there's an easy way around this one except for completely redrawing the window from scratch; however, doing that would be a lot of work (replicating the traffic lights, resize behaviour, etc. etc.)

from inappstorewindow.

flocked avatar flocked commented on July 18, 2024

Strange: If you manually resize the window (with the mouse), the tracingArea will move to the right position. I tried to resize the window with setFrame:, but it doesn't work.

from inappstorewindow.

indragiek avatar indragiek commented on July 18, 2024

Yeah I found the exact same thing, I'm sure that dragging the resize corner invokes a private method that resets the tracking area.

from inappstorewindow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.