Open mattshepherd opened 10 years ago
I noticed if you use a textured window it resolves this. Might work for me since I don't need any part of the window background showing anyway.
Yeah, it looks like using a textured window or setting movableByWindowBackground
to YES
are the workarounds to this issue. I'll see if there's a solution that doesn't require a workaround.
Without looking at the code... IIRC, OS X has a specific dragging event, perhaps the code is only tracking mouse down, move, up, etc, instead of actual drag events?
@jakepetroules It's using -mouseDragged:
. See here: https://github.com/indragiek/INAppStoreWindow/blob/master/INAppStoreWindow/INAppStoreWindow.m#L446
I think I recall from past experience that there was some funky behaviour with -mouseDragged:
not being called when the drag is initiated while the app is not active. I'll take a look when I get a chance.
I had fix this. @mattshepherd @indragiek @jakepetroules @tonyarnold @robin
- (void)becomeKeyWindow
{
// repost the first NSLeftMouseDown event filter by NSWindow
[self postEvent:[self currentEvent] atStart:true];
[super becomeKeyWindow];
[self _updateTitlebarView];
[self _updateBottomBarView];
[self _layoutTrafficLightsAndContent];
[self _setupTrafficLightsTrackingArea];
}
refer by Cocoa Event Handling Guide,so repost the event fix the problem.
Some events, many of which are defined by the Application Kit (type NSAppKitDefined), have to do with actions controlled by a window or the application object itself. Examples of these events are those related to activating, deactivating, hiding, and showing the application. NSApp filters out these events early in its dispatch routine and handles them itself.
or you can repost the event in NSWindowDelegate's notification
- (void)windowDidBecomeKey:(NSNotification *)notification {
NSEvent *theEvent = [self.window currentEvent];
if (theEvent != nil) {
if(theEvent.type == NSLeftMouseDown){
[self.window postEvent:theEvent atStart:true];
NSLog(@"repost LeftMouseDown event");
}
}
}
I was looking into using this in a project of mine and noticed and issue when you click the titlebar of the window while it is in the background and try to drag. If you click high enough where the normal title bar is it allows you to drag, if you click lower it does not drag, it just activates the window.