summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2013-10-09 15:50:11 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-09 15:50:11 +0200
commitda0cb32b8ee7cc4a991a59420a411898e63a660e (patch)
tree9ed8e190a6543518f9b082afc5a380f659da0220 /src/plugins/platforms/windows
parent7f3e3c1099f42cff46bbd267c70587bcf72024fc (diff)
parentd8fc0da235b2bd566b2b6f1e21218afdf2f34eb3 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.h12
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp11
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp41
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.h27
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp19
7 files changed, 87 insertions, 32 deletions
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.h b/src/plugins/platforms/windows/accessible/iaccessible2.h
index a391d495f9..9c922dce36 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.h
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.h
@@ -331,9 +331,21 @@ private:
{
wchar_t *constRelationString = 0;
switch (relation) {
+ case QAccessible::Label:
+ constRelationString = IA2_RELATION_LABEL_FOR;
+ break;
+ case QAccessible::Labelled:
+ constRelationString = IA2_RELATION_LABELLED_BY;
+ break;
+ case QAccessible::Controller:
+ constRelationString = IA2_RELATION_CONTROLLER_FOR;
+ break;
case QAccessible::Controlled:
constRelationString = IA2_RELATION_CONTROLLED_BY;
break;
+ case QAccessible::AllRelations:
+ constRelationString = ( L"AllRelations" );
+ break;
}
if (constRelationString) {
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index cf6cb199c7..51e0d0e803 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -203,13 +203,12 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L
qWarning("%s: Cowardly refusing to send clipboard message to hung application...", Q_FUNC_INFO);
return;
}
- // Also refuse if the process is being debugged, specifically, if it is
+ // Do not block if the process is being debugged, specifically, if it is
// displaying a runtime assert, which is not caught by isHungAppWindow().
- if (isProcessBeingDebugged(m_nextClipboardViewer)) {
- qWarning("%s: Cowardly refusing to send clipboard message to application under debugger...", Q_FUNC_INFO);
- return;
- }
- SendMessage(m_nextClipboardViewer, message, wParam, lParam);
+ if (isProcessBeingDebugged(m_nextClipboardViewer))
+ PostMessage(m_nextClipboardViewer, message, wParam, lParam);
+ else
+ SendMessage(m_nextClipboardViewer, message, wParam, lParam);
}
/*!
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 5b2a3acbae..5e7944a4cf 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -45,7 +45,7 @@
#include "qwindowswindow.h"
#include "qwindowsscreen.h"
-#include <QtGui/QPixmap>
+#include <QtGui/QBitmap>
#include <QtGui/QImage>
#include <QtGui/QBitmap>
#include <QtGui/QGuiApplication>
@@ -61,6 +61,30 @@ Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat =
Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap);
/*!
+ \class QWindowsCursorCacheKey
+ \brief Cache key for storing values in a QHash with a QCursor as key.
+
+ \internal
+ \ingroup qt-lighthouse-win
+*/
+
+QWindowsCursorCacheKey::QWindowsCursorCacheKey(const QCursor &c)
+ : shape(c.shape()), bitmapCacheKey(0), maskCacheKey(0)
+{
+ if (shape == Qt::BitmapCursor) {
+ const qint64 pixmapCacheKey = c.pixmap().cacheKey();
+ if (pixmapCacheKey) {
+ bitmapCacheKey = pixmapCacheKey;
+ } else {
+ Q_ASSERT(c.bitmap());
+ Q_ASSERT(c.mask());
+ bitmapCacheKey = c.bitmap()->cacheKey();
+ maskCacheKey = c.mask()->cacheKey();
+ }
+ }
+}
+
+/*!
\class QWindowsCursor
\brief Platform cursor implementation
@@ -388,9 +412,10 @@ HCURSOR QWindowsCursor::createSystemCursor(const QCursor &c)
QWindowsWindowCursor QWindowsCursor::standardWindowCursor(Qt::CursorShape shape)
{
- StandardCursorCache::iterator it = m_standardCursorCache.find(shape);
- if (it == m_standardCursorCache.end())
- it = m_standardCursorCache.insert(shape, QWindowsWindowCursor(QCursor(shape)));
+ const QWindowsCursorCacheKey key(shape);
+ CursorCache::iterator it = m_cursorCache.find(key);
+ if (it == m_cursorCache.end())
+ it = m_cursorCache.insert(key, QWindowsWindowCursor(QCursor(shape)));
return it.value();
}
@@ -400,10 +425,10 @@ QWindowsWindowCursor QWindowsCursor::standardWindowCursor(Qt::CursorShape shape)
QWindowsWindowCursor QWindowsCursor::pixmapWindowCursor(const QCursor &c)
{
- const qint64 cacheKey = c.pixmap().cacheKey();
- PixmapCursorCache::iterator it = m_pixmapCursorCache.find(cacheKey);
- if (it == m_pixmapCursorCache.end())
- it = m_pixmapCursorCache.insert(cacheKey, QWindowsWindowCursor(c));
+ const QWindowsCursorCacheKey cacheKey(c);
+ CursorCache::iterator it = m_cursorCache.find(cacheKey);
+ if (it == m_cursorCache.end())
+ it = m_cursorCache.insert(cacheKey, QWindowsWindowCursor(c));
return it.value();
}
diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h
index 1e818bc9b8..b366d9a06a 100644
--- a/src/plugins/platforms/windows/qwindowscursor.h
+++ b/src/plugins/platforms/windows/qwindowscursor.h
@@ -52,6 +52,27 @@ QT_BEGIN_NAMESPACE
class QWindowsWindowCursorData;
+struct QWindowsCursorCacheKey
+{
+ explicit QWindowsCursorCacheKey(const QCursor &c);
+ explicit QWindowsCursorCacheKey(Qt::CursorShape s) : shape(s), bitmapCacheKey(0), maskCacheKey(0) {}
+ QWindowsCursorCacheKey() : shape(Qt::CustomCursor), bitmapCacheKey(0), maskCacheKey(0) {}
+
+ Qt::CursorShape shape;
+ qint64 bitmapCacheKey;
+ qint64 maskCacheKey;
+};
+
+inline bool operator==(const QWindowsCursorCacheKey &k1, const QWindowsCursorCacheKey &k2)
+{
+ return k1.shape == k2.shape && k1.bitmapCacheKey == k2.bitmapCacheKey && k1.maskCacheKey == k2.maskCacheKey;
+}
+
+inline uint qHash(const QWindowsCursorCacheKey &k, uint seed) Q_DECL_NOTHROW
+{
+ return (uint(k.shape) + uint(k.bitmapCacheKey) + uint(k.maskCacheKey)) ^ seed;
+}
+
class QWindowsWindowCursor
{
public:
@@ -86,11 +107,9 @@ public:
QWindowsWindowCursor pixmapWindowCursor(const QCursor &c);
private:
- typedef QHash<Qt::CursorShape, QWindowsWindowCursor> StandardCursorCache;
- typedef QHash<qint64, QWindowsWindowCursor> PixmapCursorCache;
+ typedef QHash<QWindowsCursorCacheKey, QWindowsWindowCursor> CursorCache;
- StandardCursorCache m_standardCursorCache;
- PixmapCursorCache m_pixmapCursorCache;
+ CursorCache m_cursorCache;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index adac7aa254..e72b1d60c8 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -315,7 +315,6 @@ struct QWindowsIntegrationPrivate
QWindowsDrag m_drag;
# endif
#endif
- QWindowsGuiEventDispatcher *m_eventDispatcher;
#if defined(QT_OPENGL_ES_2)
QEGLStaticContextPtr m_staticEGLContext;
#elif !defined(QT_NO_OPENGL)
@@ -356,7 +355,6 @@ static inline unsigned parseOptions(const QStringList &paramList)
QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramList)
: m_options(parseOptions(paramList))
, m_fontDatabase(0)
- , m_eventDispatcher(new QWindowsGuiEventDispatcher)
{
}
@@ -369,7 +367,6 @@ QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()
QWindowsIntegration::QWindowsIntegration(const QStringList &paramList) :
d(new QWindowsIntegrationPrivate(paramList))
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(d->m_eventDispatcher);
#ifndef QT_NO_CLIPBOARD
d->m_clipboard.registerViewer();
#endif
@@ -633,9 +630,9 @@ QPlatformSessionManager *QWindowsIntegration::createPlatformSessionManager(const
}
#endif
-QAbstractEventDispatcher * QWindowsIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher * QWindowsIntegration::createEventDispatcher() const
{
- return d->m_eventDispatcher;
+ return new QWindowsGuiEventDispatcher;
}
QStringList QWindowsIntegration::themeNames() const
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 3911fde388..270ff7ef68 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -74,7 +74,7 @@ public:
#ifndef QT_NO_OPENGL
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
#endif
- virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ virtual QAbstractEventDispatcher *createEventDispatcher() const;
#ifndef QT_NO_CLIPBOARD
virtual QPlatformClipboard *clipboard() const;
# ifndef QT_NO_DRAGANDDROP
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 7077eaf4b0..be739d0551 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1260,11 +1260,11 @@ void QWindowsWindow::setGeometry(const QRect &rectIn)
const QWindowsGeometryHint hint(window(), m_data.customMargins);
if (!hint.validSize(newSize)) {
qWarning("%s: Attempt to set a size (%dx%d) violating the constraints"
- "(%dx%d - %dx%d) on window '%s'.", __FUNCTION__,
+ "(%dx%d - %dx%d) on window %s/'%s'.", __FUNCTION__,
newSize.width(), newSize.height(),
hint.minimumSize.width(), hint.minimumSize.height(),
hint.maximumSize.width(), hint.maximumSize.height(),
- qPrintable(window()->objectName()));
+ window()->metaObject()->className(), qPrintable(window()->objectName()));
}
}
if (m_data.hwnd) {
@@ -1273,13 +1273,13 @@ void QWindowsWindow::setGeometry(const QRect &rectIn)
// notify and warn.
setGeometry_sys(rect);
if (m_data.geometry != rect) {
- qWarning("%s: Unable to set geometry %dx%d+%d+%d on '%s'."
+ qWarning("%s: Unable to set geometry %dx%d+%d+%d on %s/'%s'."
" Resulting geometry: %dx%d+%d+%d "
"(frame: %d, %d, %d, %d, custom margin: %d, %d, %d, %d"
", minimum size: %dx%d, maximum size: %dx%d).",
__FUNCTION__,
rect.width(), rect.height(), rect.x(), rect.y(),
- qPrintable(window()->objectName()),
+ window()->metaObject()->className(), qPrintable(window()->objectName()),
m_data.geometry.width(), m_data.geometry.height(),
m_data.geometry.x(), m_data.geometry.y(),
m_data.frame.left(), m_data.frame.top(),
@@ -1838,8 +1838,9 @@ bool QWindowsWindow::setMouseGrabEnabled(bool grab)
return false;
}
if (!isVisible() && grab) {
- qWarning("%s: Not setting mouse grab for invisible window %s",
- __FUNCTION__, qPrintable(window()->objectName()));
+ qWarning("%s: Not setting mouse grab for invisible window %s/'%s'",
+ __FUNCTION__, window()->metaObject()->className(),
+ qPrintable(window()->objectName()));
return false;
}
// release grab or an explicit grab overriding autocapture: Clear flag.
@@ -2091,8 +2092,10 @@ EGLSurface QWindowsWindow::ensureEglSurfaceHandle(const QWindowsWindow::QWindows
m_staticEglContext = staticContext;
m_eglSurface = eglCreateWindowSurface(staticContext->display(), config, (EGLNativeWindowType)m_data.hwnd, NULL);
if (m_eglSurface == EGL_NO_SURFACE)
- qWarning("%s: Could not create the egl surface (eglCreateWindowSurface failed): error = 0x%x\n",
- Q_FUNC_INFO, eglGetError());
+ qWarning("%s: Could not create the egl surface for %s/'%s' (eglCreateWindowSurface failed): error = 0x%x\n",
+ Q_FUNC_INFO, window()->metaObject()->className(),
+ qPrintable(window()->objectName()), eglGetError());
+
if (QWindowsContext::verboseGL)
qDebug("%s: Created EGL surface %p, this = %p",
__FUNCTION__, m_eglSurface, this);