gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mouse drags and the responder chain


From: Adrian Robert
Subject: Mouse drags and the responder chain
Date: Wed, 12 Jan 2005 12:58:42 -0500

In Emacs, I have a situation where I need to track a scrollbar drag without using a modal loop. In OS X, the NSWindow containing the scrollbar accepts mouse movement events (as does, assumedly, the scrollbar), and implementing -mouseDragged: in an NSScroller subclass does the trick: it gets fed the drag events. In GNUstep, however, this only works until the mouse pointer leaves the scrollbar area, at which point -mouseDragged: is no longer called. Thus, you cannot drag the scrollbar "sloppily".

I traced the behavior to [NSWindow -sendEvent:], which does the following:

            case NSLeftMouseDragged:
              v = [_wv hitTest: [theEvent locationInWindow]];
              [v mouseDragged: theEvent];
              break;

Drags are only sent to the object they are over. Thus, even if the scrollbar explicitly requests and gets firstResponder status from the window, it still won't get the events. I'm not sure how the implementation on OS X differs, but it might be that the drags are sent according to the responder chain instead of or in addition to the hit detection. Any thoughts? I'd like to get GNUstep working more similarly to OS X if we can figure out what it does, unless people think there is something incorrect about it.

thanks





reply via email to

[Prev in Thread] Current Thread [Next in Thread]