From 22d075fef0ed2a52283bbe5b41be83be028c899a Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 10 Feb 2016 16:59:20 +0100 Subject: Cocoa integration - suppress excessive dragginUpdated messages Our abstract item views are using a timer before starting autoscroll. Constant dragginUpdated (re)starts this timer again and again and it actually never times out (== no autoscroll). It looks like a bug in Cocoa since 10.11, they test: respondsToSelector:@selector(wantsPeriodicDraggingUpdated:) with ':' at the end, though they need a method without parameters; as a result QTBUG-32761 was re-introduced. Let's make them happy and respond to this selector also (never gets called actually). Change-Id: I3b7bb0a455124f84c97fc350f69486bf0fc5d5fc Task-number: QTBUG-32761 Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/qnsview.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index e707010979..8733116c6f 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1898,6 +1898,18 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin return NO; } + +- (BOOL)wantsPeriodicDraggingUpdates:(void *)dummy +{ + // This method never gets called. It's a workaround for Apple's + // bug: they first respondsToSelector : @selector(wantsPeriodicDraggingUpdates:) + // (note ':') and then call -wantsPeriodicDraggingUpdate (without colon). + // So, let's make them happy. + Q_UNUSED(dummy); + + return NO; +} + - (void)updateCursorFromDragResponse:(QPlatformDragQtResponse)response drag:(QCocoaDrag *)drag { const QPixmap pixmapCursor = drag->currentDrag()->dragCursor(response.acceptedAction()); -- cgit v1.2.3 From c5d49725779292a04fed599eb7f508d334ffc5c3 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Thu, 3 Dec 2015 10:57:55 +0100 Subject: Fix for deferredDelete() bug when calling the glib loop directly This patch makes sure that all events posted using Qt on top of the GLib event loop have the loopLevel counter incremented. This is done since Qt depends on the fact that all deleteLater() calls are issued within the scope of some signal handler (in other words, triggered by the chain sendEvent() -> notifyInternal2()). There is a side effect though: in the conditions affected by this patch, that is deleteLater()s issued within a glib event handler for example, manually calling processEvents() or sendPostedEvents() with or without the QEvent::DeferredDelete flag has the same effect, and deferred deleted events are always processed. While this is not a currently working feature which the patch breaks, this side effect seems to be difficult to avoid without separating sendPostedEvents() and processEvents() into a public and a private method, in order to detect when they are manually called. Such change could perhaps be done for Qt6. An autotest for QTBUG-36434 is also included. Autotesting for QTBUG-32859 seems to be more challenging in this respect, due to its dependency on GLib. Task-number: QTBUG-18434 Task-number: QTBUG-32859 Task-number: QTBUG-36434 Change-Id: Ib89175aa27c9e38bca68ae254d182b2cd21cf7e9 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/plugins/platforms/cocoa/qcocoamenu.mm | 2 +- src/plugins/platforms/cocoa/qcocoamenuloader.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 8091ba8465..8c576c7cbe 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -128,7 +128,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate); - (void) itemFired:(NSMenuItem*) item { QCocoaMenuItem *cocoaItem = reinterpret_cast([item tag]); - QScopedLoopLevelCounter loopLevelCounter(QGuiApplicationPrivate::instance()->threadData); + QScopedScopeLevelCounter scopeLevelCounter(QGuiApplicationPrivate::instance()->threadData); QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers:[NSEvent modifierFlags]]; static QMetaMethod activatedSignal = QMetaMethod::fromSignal(&QCocoaMenuItem::activated); activatedSignal.invoke(cocoaItem, Qt::QueuedConnection); diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm index d73b9a8b7b..e440a9080c 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm @@ -308,7 +308,7 @@ QT_END_NAMESPACE if ([item tag]) { QCocoaMenuItem *cocoaItem = reinterpret_cast([item tag]); - QScopedLoopLevelCounter loopLevelCounter(QGuiApplicationPrivate::instance()->threadData); + QScopedScopeLevelCounter scopeLevelCounter(QGuiApplicationPrivate::instance()->threadData); cocoaItem->activated(); } } -- cgit v1.2.3 From 0df5c366e50b9533fd8ea3f31c4c360ae7f4c5b6 Mon Sep 17 00:00:00 2001 From: Andre Somers Date: Tue, 2 Feb 2016 14:40:29 +0100 Subject: Use QFlags::setFlag where prudent in qtbase QFlags::setFlag is most useful to replace explicit constructs like if (condition) { someFlags |= TheConditionFlag; } else { someFlags &= ~TheConditionFlag; } with someFlags.setFlag(TheConditionFlag, condition); Change-Id: Ie4586681c83e0af812d5bbf14965aad51941a960 Reviewed-by: Marc Mutz --- src/plugins/platforms/xcb/qxcbconnection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 6a2ecacd77..02dc95e852 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -472,7 +472,7 @@ public: xcb_window_t getSelectionOwner(xcb_atom_t atom) const; xcb_window_t getQtSelectionOwner(); - void setButton(Qt::MouseButton button, bool down) { if (down) m_buttons |= button; else m_buttons &= ~button; } + void setButton(Qt::MouseButton button, bool down) { m_buttons.setFlag(button, down); } Qt::MouseButtons buttons() const { return m_buttons; } Qt::MouseButton translateMouseButton(xcb_button_t s); -- cgit v1.2.3