diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-01-24 11:24:00 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-26 19:22:01 +0100 |
commit | 03d057ff01332333b98f5298c3d0bd85b5604ac9 (patch) | |
tree | 2f0922111950af7e5335f48dbc6e3ae58d2522b9 /src/plugins/platforms/cocoa/qcocoawindow.mm | |
parent | b2c73c73cd0a68aae0586cf447c2612c13aeb52c (diff) |
Cocoa: Make touch events work again.
Bring back the ref-counted enable on enter/leave
workaround we had in Qt 4: If any widget in a
window sets WA_AcceptTouchEvents then that window
will start processing touch events.
Enabling touch events has implications for delivery
of other events, for example by causing scrolling
event lag.
Change-Id: I307488937f417612eff624bf9892b82a7f69c1b7
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 9988cea597..e74f9dcfe0 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -201,6 +201,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_hasModalSession(false) , m_frameStrutEventsEnabled(false) , m_isExposed(false) + , m_registerTouchCount(0) { #ifdef QT_COCOA_ENABLE_WINDOW_DEBUG qDebug() << "QCocoaWindow::QCocoaWindow" << this; @@ -899,6 +900,15 @@ QCocoaMenuBar *QCocoaWindow::menubar() const return m_menubar; } +void QCocoaWindow::registerTouch(bool enable) +{ + m_registerTouchCount += enable ? 1 : -1; + if (m_registerTouchCount == 1) + [m_contentView setAcceptsTouchEvents:YES]; + else if (m_registerTouchCount == 0) + [m_contentView setAcceptsTouchEvents:NO]; +} + qreal QCocoaWindow::devicePixelRatio() const { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 |