From 2fcc88d02131b0fd64857a2646381653b410f053 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 21 Oct 2014 11:05:54 +0200 Subject: [PATCH] OS X: drag and drop and auto-scrolling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/cocoa/qnsview.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 6234c0dcbe..92ab16683e 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -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 )sender { return [self handleDrag : sender];