From 143cf9e4675ff0f1317dce915aef009886307cf8 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Apr 2018 13:41:04 -0700 Subject: QCocoaWindow: Fix handleMouseEvent() compilation warning qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm:408:53: warning: 'handleMouseEvent' is deprecated [-Wdeprecated-declarations] QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint, Change-Id: Ifbf8c46e31a1de2089ce0e16cec087fdd9adb64e Reviewed-by: Erik Verbruggen --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 54254455e4..f9d16ab1c6 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -404,8 +404,10 @@ void QCocoaWindow::setVisible(bool visible) removeMonitor(); monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDownMask|NSMouseMovedMask handler:^(NSEvent *e) { QPointF localPoint = QCocoaScreen::mapFromNative([NSEvent mouseLocation]); + const auto eventType = e.type == NSMouseMoved ? QEvent::MouseMove : QEvent::MouseButtonPress; QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint, - cocoaButton2QtButton([e buttonNumber])); + Qt::MouseButtons(uint(NSEvent.pressedMouseButtons & 0xFFFF)), + cocoaButton2QtButton(e.buttonNumber), eventType); }]; } } -- cgit v1.2.3 From c7eb2c173e79f2936985cd7589347e59b6005c7c Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Apr 2018 12:22:35 -0700 Subject: QCocoaFontDialogHelper: Fix NSFontManager delegate warning According to Apple's documentation, there's no delegate in NSFontManager. We set its target instead. The action is changeFont: by default. Change-Id: I8c01bfa97c78dd8097f38c27353748d13f51489f Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 9a96895d07..815882ab06 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -73,8 +73,6 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) return newFont; } -@class QT_MANGLE_NAMESPACE(QNSFontPanelDelegate); - @interface QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) : NSObject { @public @@ -110,7 +108,8 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); [mFontPanel setRestorable:NO]; [mFontPanel setDelegate:self]; - [[NSFontManager sharedFontManager] setDelegate:self]; + + [NSFontManager sharedFontManager].target = self; // Action is changeFont: [mFontPanel retain]; return self; @@ -120,7 +119,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); { [mStolenContentView release]; [mFontPanel setDelegate:nil]; - [[NSFontManager sharedFontManager] setDelegate:nil]; + [NSFontManager sharedFontManager].target = nil; [[NSNotificationCenter defaultCenter] removeObserver:self]; [super dealloc]; -- cgit v1.2.3 From 0f6a6b2bffb9b9d0a5db8b9473fda108d14e9915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 11 Apr 2018 12:31:11 +0200 Subject: =?UTF-8?q?Cocoa:=20Don=E2=80=99t=20starve=20the=20event=20loop=20?= =?UTF-8?q?on=20requestUpdate()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of our examples, and perhaps also some applications, call requestUpdate() immediately after producing a frame. This can cause Cocoa to immediately start (trying to) draw a new frame without processing e.g. input events. This should (and will) be handled by rate limiting updates with CVDisplayLink. In the mean time fall back to using the base class QPlatformWindow implementation, which is implemented using a timer, which will allow for input event processing. Change-Id: Ic2541f344b2f4018d785404a06274959a7bad2df Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index f9d16ab1c6..965a15a548 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1336,7 +1336,7 @@ void QCocoaWindow::recreateWindowIfNeeded() void QCocoaWindow::requestUpdate() { qCDebug(lcQpaCocoaDrawing) << "QCocoaWindow::requestUpdate" << window(); - [qnsview_cast(m_view) requestUpdate]; + QPlatformWindow::requestUpdate(); } void QCocoaWindow::requestActivateWindow() -- cgit v1.2.3