summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-08-22 00:11:16 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-22 02:04:39 +0200
commitc374f4441ab42d1849431bb42fec91a976a8e502 (patch)
tree0733146c5df48b91a39097730c445dbe9cd2359a /src/plugins/platforms
parent85b24bb2dea97c3a9b013bacd5a422b26fe5d14b (diff)
parentc8ca300e491c186304d0864a9e870337e891e6f7 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm3
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm6
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h5
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp41
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp8
8 files changed, 63 insertions, 10 deletions
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);
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index fcebb7e0dc..20f767e240 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -489,6 +489,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;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 3063ce452e..e529e445ad 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1034,7 +1034,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
#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]];
}
@@ -1056,7 +1056,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph);
- if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled) {
+ if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled || phase == NSEventPhaseNone) {
currentWheelModifiers = Qt::NoModifier;
}
} else
@@ -1142,7 +1142,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
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;
}
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h
index dcd3db2d47..64bf1d71ca 100644
--- a/src/plugins/platforms/windows/qtwindowsglobal.h
+++ b/src/plugins/platforms/windows/qtwindowsglobal.h
@@ -89,6 +89,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,
@@ -143,6 +144,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 de0a583e58..132b3684e9 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -839,7 +839,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; }
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index ee1fe44530..b144d953a7 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -419,8 +419,6 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
touchPoint.state = Qt::TouchPointMoved;
dev->pointPressedPosition[touchPoint.id] = QPointF(x, y);
}
- else
- touchPoint.state = Qt::TouchPointStationary;
break;
case XI_TouchEnd:
touchPoint.state = Qt::TouchPointReleased;
@@ -442,9 +440,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 // XCB_USE_XINPUT22