I've got a program that accepts the native window handle of an NSWindow (that's already been created but not yet visible). I do this to change some native window styles and behaviors. I can do everything I need to except I can't get mouseEnter/mouseExit to work because it seems to require subclassing before instantiation. Is there a way around this? I really don't want to continuously poll the mouse position just for detecting mouseEnter and mouseExit of a portion of my window.
Note: I have to do it this way because I want to detect hover while the window isn't focused.
I can attach the tracking area, but without subclassing it I'm not sure how to hook into the events:
NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:CGRectMake(0, 0, 120, 300) options:NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect | NSTrackingActiveAlways owner:window userInfo:nil];
[window.contentView addTrackingArea:area];
P.S. I'm open to using C or Swift if it'd help.