I am running the following in my mouseDown: waiting for a mouseup event. I have not created a second thread. All of this happens on the main thread. As I understand, all UI updates are done on the main thread, so why would this work? I assume I should have to return out of the mousedown: before [window…] gets a chance to catch the next event, no?
NSEvent *newEvent = [window nextEventMatchingMask:(NSLeftMouseDraggedMask | NSLeftMouseUpMask)];
if ([newEvent type] == NSLeftMouseUp)
//Do magical stuff
[window setFrame:newFrame display:YES animate:NO];