From 490bf800e645c4f9c3321315894cdfe57afb2044 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 9 Aug 2013 16:14:10 +0200 Subject: Avoid a potential crash in unignoredChildren This doesn't actually fix the source of the problem, but its harmless. This was reproduced with tst_qcolumnview and voiceover enabled Task-number: QTBUG-32440 Change-Id: Iad27884e1ca9194f911271c16908ef358e4b1875 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/cocoa/qcocoaaccessibility.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 5649f3ad73..e135f36e78 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -231,8 +231,7 @@ NSArray *unignoredChildren(id parentObject, QAccessibleInterface *interface) NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; for (int i = 0; i < numKids; ++i) { QAccessibleInterface *child = interface->child(i); - Q_ASSERT(child); - if (child->state().invalid || child->state().invisible) + if (!child || !child->isValid() || child->state().invalid || child->state().invisible) continue; QAccessible::Id childId = QAccessible::uniqueId(child); -- cgit v1.2.3 From 1044f23deec0e6bee6455fee9cd8793b3fb65c60 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 7 Aug 2013 17:15:49 +0200 Subject: Fix QKeyEvent::isAutoRepeat on Mac Task-number: QTBUG-21500 Change-Id: Ifed85ddcdecd30453207728b0f376baa2abf6e66 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index aff93dd133..4ffab289f0 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -967,7 +967,7 @@ static QTouchDevice *touchDevice = 0; if (m_sendKeyEvent && m_composingText.isEmpty()) QWindowSystemInterface::handleExtendedKeyEvent(m_window, timestamp, QEvent::Type(eventType), keyCode, modifiers, - nativeScanCode, nativeVirtualKey, nativeModifiers, text); + nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat]); m_sendKeyEvent = false; } -- cgit v1.2.3 From 3e4c9cb3d6177c8feb4d57f900f118596f7b3c18 Mon Sep 17 00:00:00 2001 From: Daiwei Li Date: Tue, 13 Aug 2013 15:58:41 -0700 Subject: Cocoa: Set window title after setting window flags if window has border A QWindow should keep its title after removing and restoring the frame, so set it if we are setting window flags that include a frame. Task-number: QTBUG-32978 Change-Id: I0fe1b651eac05a210b06ec4f7f6fb78f2536834d Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 1126315126..26869d4b5f 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -486,6 +486,9 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags) [m_nsWindow setStyleMask:styleMask]; [m_nsWindow setLevel:level]; setWindowShadow(flags); + if (!(styleMask & NSBorderlessWindowMask)) { + setWindowTitle(window()->title()); + } } m_windowFlags = flags; -- cgit v1.2.3 From bab29dd76c7b6794e683220c918dca7c3f5a89fd Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 13 Aug 2013 09:54:40 +0200 Subject: Cocoa: bugfix mouse wheel + modifier keys not working To avoid using modifier keys when releasing a two-finger mouse wheel flick on a trackpad, we listen to event phases. But for a normal mouse, a separate phase NSEventPhaseNone is given. Ensure that we still send modifier keys when that state is reported. Task-number: QTBUG-32098 Change-Id: Ib840dd661b7842ae49127e5a8d42e3666ae2da4e Reviewed-by: Gabriel de Dietrich Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qnsview.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 4ffab289f0..a949bb3ea5 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -872,13 +872,13 @@ static QTouchDevice *touchDevice = 0; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 if ([theEvent respondsToSelector:@selector(scrollingDeltaX)]) { NSEventPhase phase = [theEvent phase]; - if (phase == NSEventPhaseBegan) { + if (phase == NSEventPhaseBegan || phase == NSEventPhaseNone) { currentWheelModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]]; } QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers); - if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled) { + if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled || phase == NSEventPhaseNone) { currentWheelModifiers = Qt::NoModifier; } } else -- cgit v1.2.3 From 7495b59dbda45049ba54f3682904962c217a9906 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Thu, 1 Aug 2013 13:40:36 +0200 Subject: xcb: Fix TouchPointPressed being sent multiple times. XI2 sends events for individual touch points, but QTouchEvent sends all of them with a stationary state if they didn't change. If a touch pressed event is received, and the next XI2 event is about a different touch point, we wouldn't update the state of the previously pressed touch point. Change-Id: I1ebcbea1cea54872064ef7710e2aac7b0b41cd70 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 991c82eaaa..799bb387e1 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -309,8 +309,6 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) case XI_TouchUpdate: if (touchPoint.area.center() != QPoint(x, y)) touchPoint.state = Qt::TouchPointMoved; - else - touchPoint.state = Qt::TouchPointStationary; break; case XI_TouchEnd: touchPoint.state = Qt::TouchPointReleased; @@ -323,9 +321,13 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) " area " << touchPoint.area << " pressure " << touchPoint.pressure; #endif QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiEvent->time, dev->qtTouchDevice, m_touchPoints.values()); - // If a touchpoint was released, we can forget it, because the ID won't be reused. if (touchPoint.state == Qt::TouchPointReleased) + // If a touchpoint was released, we can forget it, because the ID won't be reused. m_touchPoints.remove(touchPoint.id); + else + // Make sure that we don't send TouchPointPressed/Moved in more than one QTouchEvent + // with this touch point if the next XI2 event is about a different touch point. + touchPoint.state = Qt::TouchPointStationary; } } #endif -- cgit v1.2.3 From eb2ae61cb4ff3ec80859e7a563878d33df7a6758 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 19 Aug 2013 10:30:19 +0200 Subject: Windows: Add hit test handling for non-client areas. Suppress resize cursor for fixed size windows. Task-number: QTBUG-32663 Change-Id: I9579bb13d494fe21e5db7b75d01a3cf1b693c7f6 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qtwindowsglobal.h | 5 +++ src/plugins/platforms/windows/qwindowscontext.cpp | 4 ++- src/plugins/platforms/windows/qwindowswindow.cpp | 41 +++++++++++++++++++++++ src/plugins/platforms/windows/qwindowswindow.h | 3 +- 4 files changed, 51 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index ae48887a80..238817e85c 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -88,6 +88,7 @@ enum WindowsEventType // Simplify event types CursorEvent = MouseEventFlag + 3, TouchEvent = TouchEventFlag + 1, NonClientMouseEvent = NonClientEventFlag + MouseEventFlag + 1, + NonClientHitTest = NonClientEventFlag + 2, KeyEvent = KeyEventFlag + 1, KeyDownEvent = KeyEventFlag + KeyDownEventFlag + 1, InputMethodKeyEvent = InputMethodEventFlag + KeyEventFlag + 1, @@ -142,6 +143,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::ResizeEvent; case WM_NCCALCSIZE: return QtWindows::CalculateSize; +#ifndef Q_OS_WINCE + case WM_NCHITTEST: + return QtWindows::NonClientHitTest; +#endif // !Q_OS_WINCE case WM_GETMINMAXINFO: return QtWindows::QuerySizeHints; case WM_KEYDOWN: // keyboard event diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 37a51e1fec..5114e9d524 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -819,7 +819,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true;// maybe available on some SDKs revisit WM_NCCALCSIZE case QtWindows::CalculateSize: return QWindowsGeometryHint::handleCalculateSize(platformWindow->customMargins(), msg, result); -#endif + case QtWindows::NonClientHitTest: + return platformWindow->handleNonClientHitTest(QPoint(msg.pt.x, msg.pt.y), result); +#endif // !Q_OS_WINCE case QtWindows::ExposeEvent: return platformWindow->handleWmPaint(hwnd, message, wParam, lParam); case QtWindows::NonClientMouseEvent: diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index e7e964a128..8ec10294a2 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1796,6 +1796,47 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const if (QWindowsContext::verboseWindows) qDebug() << __FUNCTION__ << window() << *mmi; } + +bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const +{ + // QTBUG-32663, suppress resize cursor for fixed size windows. + const QWindow *w = window(); + if (!w->isTopLevel() // Task 105852, minimized windows need to respond to user input. + || (m_windowState != Qt::WindowNoState && m_windowState != Qt::WindowActive) + || (m_data.flags & Qt::FramelessWindowHint)) { + return false; + } + const QSize minimumSize = w->minimumSize(); + if (minimumSize.isEmpty()) + return false; + const QSize maximumSize = w->maximumSize(); + const bool fixedWidth = minimumSize.width() == maximumSize.width(); + const bool fixedHeight = minimumSize.height() == maximumSize.height(); + if (!fixedWidth && !fixedHeight) + return false; + const QPoint localPos = w->mapFromGlobal(globalPos); + const QSize size = w->size(); + if (fixedHeight) { + if (localPos.y() >= size.height()) { + *result = HTBORDER; // Unspecified border, no resize cursor. + return true; + } + if (localPos.y() < 0) { + const QMargins margins = frameMargins(); + const int topResizeBarPos = margins.left() - margins.top(); + if (localPos.y() < topResizeBarPos) { + *result = HTCAPTION; // Extend caption over top resize bar, let's user move the window. + return true; + } + } + } + if (fixedWidth && (localPos.x() < 0 || localPos.x() >= size.width())) { + *result = HTBORDER; // Unspecified border, no resize cursor. + return true; + } + return false; +} + #endif // !Q_OS_WINCE #ifndef QT_NO_CURSOR diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 996542f92a..f7d142fc36 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -234,7 +234,8 @@ public: void releaseDC(); #ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO void getSizeHints(MINMAXINFO *mmi) const; -#endif + bool handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const; +#endif // !Q_OS_WINCE #ifndef QT_NO_CURSOR QWindowsWindowCursor cursor() const { return m_cursor; } -- cgit v1.2.3