Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when clicking on titlebar when in background #136

Open
mattshepherd opened this issue Jan 9, 2014 · 7 comments
Open

Issue when clicking on titlebar when in background #136

mattshepherd opened this issue Jan 9, 2014 · 7 comments
Labels

Comments

@mattshepherd
Copy link

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.

@mattshepherd
Copy link
Author

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.

@indragiek
Copy link
Owner

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.

@jakepetroules
Copy link
Contributor

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?

@indragiek
Copy link
Owner

@indragiek
Copy link
Owner

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.

@fancymax
Copy link

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.

@fancymax
Copy link

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");
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants