Use performWindowDragWithEvent: if available.
This commit is contained in:
parent
17dc5f407e
commit
f56411fde1
|
@ -41,7 +41,6 @@ void onMoveDrag(struct onMoveDragParams *p, NSEvent *e)
|
|||
[p->w setFrameOrigin:frame.origin];
|
||||
}
|
||||
|
||||
// LONGTERM FUTURE -[NSWindow performWindowDragWithEvent:] would be better but that's 10.11-only
|
||||
void doManualMove(NSWindow *w, NSEvent *initialEvent)
|
||||
{
|
||||
__block struct onMoveDragParams mdp;
|
||||
|
@ -49,6 +48,13 @@ void doManualMove(NSWindow *w, NSEvent *initialEvent)
|
|||
BOOL (^handleEvent)(NSEvent *e);
|
||||
__block BOOL done;
|
||||
|
||||
// this is only available on 10.11 and newer (LONGTERM FUTURE)
|
||||
// but use it if available; this lets us use the real OS dragging code, which means we can take advantage of OS features like Spaces
|
||||
if ([w respondsToSelector:@selector(performWindowDragWithEvent:)]) {
|
||||
[((id) w) performWindowDragWithEvent:initialEvent];
|
||||
return;
|
||||
}
|
||||
|
||||
mdp.w = w;
|
||||
mdp.initialFrame = [mdp.w frame];
|
||||
mdp.initialPoint = makeIndependent([initialEvent locationInWindow], mdp.w);
|
||||
|
|
Loading…
Reference in New Issue