aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-22 11:36:29 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-22 11:36:31 +0100
commitce130de453e561477b30643a27638e0707ac5c54 (patch)
tree04f764cf1ecf9bd6c7cdff90ccaf5bf9eb9c362f /src/quick
parent918159a2aae5062935a946e6d64120769802d625 (diff)
parenta5669568904b37b1d6b297e7190d18306e198604 (diff)
Merge remote-tracking branch 'origin/release' into stable
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp38
-rw-r--r--src/quick/items/qquickmultipointtoucharea_p.h9
-rw-r--r--src/quick/items/qquickpincharea.cpp47
-rw-r--r--src/quick/items/qquickpincharea_p.h9
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp18
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp17
6 files changed, 84 insertions, 54 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 8fe306b006..e0eb641528 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -323,7 +323,6 @@ void QQuickTouchPoint::setSceneY(qreal sceneY)
QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent)
: QQuickItem(parent),
- _currentWindow(0),
_minimumTouchPoints(0),
_maximumTouchPoints(INT_MAX),
_stealMouse(false)
@@ -333,8 +332,8 @@ QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent)
if (qmlVisualTouchDebugging()) {
setFlag(QQuickItem::ItemHasContents);
}
-#ifdef Q_OS_MAC
- connect(this, &QQuickItem::windowChanged, this, &QQuickMultiPointTouchArea::setTouchEventsEnabledForWindow);
+#ifdef Q_OS_OSX
+ setAcceptHoverEvents(true); // needed to enable touch events on mouse hover.
#endif
}
@@ -547,28 +546,31 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p)
_pressedTouchPoints.append(dtp);
}
-void QQuickMultiPointTouchArea::setTouchEventsEnabledForWindow(QWindow *window)
+#ifdef Q_OS_OSX
+void QQuickMultiPointTouchArea::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_UNUSED(event);
+ setTouchEventsEnabled(true);
+}
+
+void QQuickMultiPointTouchArea::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_UNUSED(event);
+ setTouchEventsEnabled(false);
+}
+
+void QQuickMultiPointTouchArea::setTouchEventsEnabled(bool enable)
{
-#ifdef Q_OS_MAC
// Resolve function for enabling touch events from the (cocoa) platform plugin.
typedef void (*RegisterTouchWindowFunction)(QWindow *, bool);
RegisterTouchWindowFunction registerTouchWindow = reinterpret_cast<RegisterTouchWindowFunction>(
QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));
if (!registerTouchWindow)
- return; // Not necessarily an error, Qt migh be using a different platform plugin.
-
- // Disable touch on the old window, enable on the new window.
- if (_currentWindow)
- registerTouchWindow(_currentWindow, false);
- if (window)
- registerTouchWindow(window, true);
- // Save the current window, setTouchEventsEnabledForWindow will be called
- // with a null window on disable.
- _currentWindow = window;
-#else // Q_OS_MAC
- Q_UNUSED(window)
-#endif
+ return; // Not necessarily an error, Qt might be using a different platform plugin.
+
+ registerTouchWindow(window(), enable);
}
+#endif // Q_OS_OSX
void QQuickMultiPointTouchArea::addTouchPrototype(QQuickTouchPoint *prototype)
{
diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h
index 2e1f2a98fb..83cc407401 100644
--- a/src/quick/items/qquickmultipointtoucharea_p.h
+++ b/src/quick/items/qquickmultipointtoucharea_p.h
@@ -250,9 +250,11 @@ protected:
bool shouldFilter(QEvent *event);
void grabGesture();
virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
-
-protected Q_SLOTS:
- void setTouchEventsEnabledForWindow(QWindow *window);
+#ifdef Q_OS_OSX
+ void hoverEnterEvent(QHoverEvent *event);
+ void hoverLeaveEvent(QHoverEvent *event);
+ void setTouchEventsEnabled(bool enable);
+#endif
private:
void ungrab();
@@ -261,7 +263,6 @@ private:
QList<QObject*> _releasedTouchPoints;
QList<QObject*> _pressedTouchPoints;
QList<QObject*> _movedTouchPoints;
- QWindow *_currentWindow;
int _minimumTouchPoints;
int _maximumTouchPoints;
bool _stealMouse;
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index 419792aaa5..f741a08512 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -248,14 +248,13 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate()
QQuickPinchArea::QQuickPinchArea(QQuickItem *parent)
: QQuickItem(*(new QQuickPinchAreaPrivate), parent)
- , _currentWindow(0)
{
Q_D(QQuickPinchArea);
d->init();
setAcceptedMouseButtons(Qt::LeftButton);
setFiltersChildMouseEvents(true);
-#ifdef Q_OS_MAC
- connect(this, &QQuickItem::windowChanged, this, &QQuickPinchArea::setTouchEventsEnabledForWindow);
+#ifdef Q_OS_OSX
+ setAcceptHoverEvents(true); // needed to enable touch events on mouse hover.
#endif
}
@@ -537,37 +536,39 @@ void QQuickPinchArea::itemChange(ItemChange change, const ItemChangeData &value)
QQuickItem::itemChange(change, value);
}
-QQuickPinch *QQuickPinchArea::pinch()
+#ifdef Q_OS_OSX
+void QQuickPinchArea::hoverEnterEvent(QHoverEvent *event)
{
- Q_D(QQuickPinchArea);
- if (!d->pinch)
- d->pinch = new QQuickPinch;
- return d->pinch;
+ Q_UNUSED(event);
+ setTouchEventsEnabled(true);
}
-void QQuickPinchArea::setTouchEventsEnabledForWindow(QWindow *window)
+void QQuickPinchArea::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_UNUSED(event);
+ setTouchEventsEnabled(false);
+}
+
+void QQuickPinchArea::setTouchEventsEnabled(bool enable)
{
-#ifdef Q_OS_MAC
// Resolve function for enabling touch events from the (cocoa) platform plugin.
typedef void (*RegisterTouchWindowFunction)(QWindow *, bool);
RegisterTouchWindowFunction registerTouchWindow = reinterpret_cast<RegisterTouchWindowFunction>(
QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));
if (!registerTouchWindow)
- return; // Not necessarily an error, Qt migh be using a different platform plugin.
-
- // Disable touch on the old window, enable on the new window.
- if (_currentWindow)
- registerTouchWindow(_currentWindow, false);
- if (window)
- registerTouchWindow(window, true);
- // Save the current window, setTouchEventsEnabledForWindow will be called
- // with a null window on disable.
- _currentWindow = window;
-#else // Q_OS_MAC
- Q_UNUSED(window)
-#endif
+ return; // Not necessarily an error, Qt might be using a different platform plugin.
+
+ registerTouchWindow(window(), enable);
}
+#endif // Q_OS_OSX
+QQuickPinch *QQuickPinchArea::pinch()
+{
+ Q_D(QQuickPinchArea);
+ if (!d->pinch)
+ d->pinch = new QQuickPinch;
+ return d->pinch;
+}
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h
index c991145fc7..81bdbda3a1 100644
--- a/src/quick/items/qquickpincharea_p.h
+++ b/src/quick/items/qquickpincharea_p.h
@@ -282,9 +282,11 @@ protected:
virtual void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
virtual void itemChange(ItemChange change, const ItemChangeData& value);
-
-private Q_SLOTS:
- void setTouchEventsEnabledForWindow(QWindow *window);
+#ifdef Q_OS_OSX
+ void hoverEnterEvent(QHoverEvent *event);
+ void hoverLeaveEvent(QHoverEvent *event);
+ void setTouchEventsEnabled(bool enable);
+#endif
private:
void updatePinch();
@@ -292,7 +294,6 @@ private:
void handleRelease();
private:
- QWindow *_currentWindow;
Q_DISABLE_COPY(QQuickPinchArea)
Q_DECLARE_PRIVATE(QQuickPinchArea)
};
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 389945849f..378451c307 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -48,6 +48,7 @@
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
#include <QtGui/QSurface>
+#include <QtGui/qpa/qplatformnativeinterface.h>
#include <private/qsgtexture_p.h>
@@ -144,10 +145,21 @@ Atlas::Atlas(const QSize &size)
{
#ifdef QT_OPENGL_ES
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString *deviceName =
+ static_cast<QString *>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("AndroidDeviceName"));
+ static bool wrongfullyReportsBgra8888Support = deviceName->compare(QStringLiteral("samsung SM-T211"), Qt::CaseInsensitive) == 0
+ || deviceName->compare(QStringLiteral("samsung SM-T210"), Qt::CaseInsensitive) == 0
+ || deviceName->compare(QStringLiteral("samsung SM-T215"), Qt::CaseInsensitive) == 0;
+#else
+ static bool wrongfullyReportsBgra8888Support = false;
+#endif
+
const char *ext = (const char *) glGetString(GL_EXTENSIONS);
- if (strstr(ext, "GL_EXT_bgra")
- || strstr(ext, "GL_EXT_texture_format_BGRA8888")
- || strstr(ext, "GL_IMG_texture_format_BGRA8888")) {
+ if (!wrongfullyReportsBgra8888Support
+ && (strstr(ext, "GL_EXT_bgra")
+ || strstr(ext, "GL_EXT_texture_format_BGRA8888")
+ || strstr(ext, "GL_IMG_texture_format_BGRA8888"))) {
m_internalFormat = m_externalFormat = GL_BGRA;
#ifdef Q_OS_IOS
} else if (strstr(ext, "GL_APPLE_texture_format_BGRA8888")) {
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index df724d8a01..04ffad7acf 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -47,6 +47,8 @@
#include <qthread.h>
#include <private/qqmlprofilerservice_p.h>
#include <private/qqmlglobal_p.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qpa/qplatformnativeinterface.h>
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
#define CAN_BACKTRACE_EXECINFO
@@ -682,14 +684,25 @@ void QSGPlainTexture::bind()
GLenum externalFormat = GL_RGBA;
GLenum internalFormat = GL_RGBA;
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString *deviceName =
+ static_cast<QString *>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("AndroidDeviceName"));
+ static bool wrongfullyReportsBgra8888Support = deviceName->compare(QStringLiteral("samsung SM-T211"), Qt::CaseInsensitive) == 0
+ || deviceName->compare(QStringLiteral("samsung SM-T210"), Qt::CaseInsensitive) == 0
+ || deviceName->compare(QStringLiteral("samsung SM-T215"), Qt::CaseInsensitive) == 0;
+#else
+ static bool wrongfullyReportsBgra8888Support = false;
+#endif
+
QOpenGLContext *context = QOpenGLContext::currentContext();
if (context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"))) {
externalFormat = GL_BGRA;
#ifdef QT_OPENGL_ES
internalFormat = GL_BGRA;
#endif
- } else if (context->hasExtension(QByteArrayLiteral("GL_EXT_texture_format_BGRA8888"))
- || context->hasExtension(QByteArrayLiteral("GL_IMG_texture_format_BGRA8888"))) {
+ } else if (!wrongfullyReportsBgra8888Support
+ && (context->hasExtension(QByteArrayLiteral("GL_EXT_texture_format_BGRA8888"))
+ || context->hasExtension(QByteArrayLiteral("GL_IMG_texture_format_BGRA8888")))) {
externalFormat = GL_BGRA;
internalFormat = GL_BGRA;
#ifdef Q_OS_IOS