OS X: drag and drop and auto-scrolling

Cocoa sens periodic drag updated events even if there is no
actuall mouse movement (or any other updates).
This breaks animations in different
views/widgets supporting our own auto-scroll (done with timers).
This patch kindly asks Cocoa _not_ to send us these events.

Task-number: QTBUG-32761
Change-Id: I5dad4ceb0a490e2f3cb34a806a5bdb1045b4dac3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Timur Pocheptsov 2014-10-21 11:05:54 +02:00
parent 963037d86b
commit 2fcc88d021

View File

@ -1822,6 +1822,19 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
return NO;
}
- (BOOL)wantsPeriodicDraggingUpdates
{
// From the documentation:
//
// "If the destination returns NO, these messages are sent only when the mouse moves
// or a modifier flag changes. Otherwise the destination gets the default behavior,
// where it receives periodic dragging-updated messages even if nothing changes."
//
// We do not want these constant drag update events while mouse is stationary,
// since we do all animations (autoscroll) with timers.
return NO;
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
return [self handleDrag : sender];