summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qguiapplication.cpp12
-rw-r--r--src/gui/kernel/qopenglcontext.cpp26
-rw-r--r--src/gui/kernel/qopenglcontext.h12
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qplatformintegration.cpp4
-rw-r--r--src/gui/kernel/qplatformmenu.h5
-rw-r--r--src/gui/kernel/qwindow.cpp4
7 files changed, 45 insertions, 20 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index a49f0ce496..827bf0164b 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1880,7 +1880,11 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
return;
if (previous) {
- QFocusEvent focusOut(QEvent::FocusOut, e->reason);
+ Qt::FocusReason r = e->reason;
+ if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) &&
+ newFocus && (newFocus->flags() & Qt::Popup) == Qt::Popup)
+ r = Qt::PopupFocusReason;
+ QFocusEvent focusOut(QEvent::FocusOut, r);
QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
QObject::disconnect(previous, SIGNAL(focusObjectChanged(QObject*)),
qApp, SLOT(_q_updateFocusObject(QObject*)));
@@ -1889,7 +1893,11 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
}
if (QGuiApplicationPrivate::focus_window) {
- QFocusEvent focusIn(QEvent::FocusIn, e->reason);
+ Qt::FocusReason r = e->reason;
+ if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) &&
+ previous && (previous->flags() & Qt::Popup) == Qt::Popup)
+ r = Qt::PopupFocusReason;
+ QFocusEvent focusIn(QEvent::FocusIn, r);
QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
QObject::connect(QGuiApplicationPrivate::focus_window, SIGNAL(focusObjectChanged(QObject*)),
qApp, SLOT(_q_updateFocusObject(QObject*)));
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 7fa0452fe5..9bc4373860 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -61,6 +61,10 @@
#include <QDebug>
+#ifndef QT_OPENGL_ES_2
+#include <QOpenGLFunctions_1_0>
+#endif
+
QT_BEGIN_NAMESPACE
class QOpenGLVersionProfilePrivate
@@ -360,13 +364,15 @@ int QOpenGLContextPrivate::maxTextureSize()
funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
#ifndef QT_OPENGL_ES
- if (!q->isES()) {
+ if (!q->isOpenGLES()) {
GLenum proxy = GL_PROXY_TEXTURE_2D;
GLint size;
GLint next = 64;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
+ QOpenGLFunctions_1_0 *gl1funcs = q->versionFunctions<QOpenGLFunctions_1_0>();
+ gl1funcs->initializeOpenGLFunctions();
+ gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
if (size == 0) {
return max_texture_size;
}
@@ -377,7 +383,7 @@ int QOpenGLContextPrivate::maxTextureSize()
if (next > max_texture_size)
break;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
+ gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
} while (next > size);
max_texture_size = size;
@@ -730,7 +736,7 @@ QOpenGLFunctions *QOpenGLContext::functions() const
QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const
{
#ifndef QT_OPENGL_ES_2
- if (isES()) {
+ if (isOpenGLES()) {
qWarning("versionFunctions: Not supported on OpenGL ES");
return 0;
}
@@ -1090,8 +1096,8 @@ void *QOpenGLContext::openGLModuleHandle()
\enum QOpenGLContext::OpenGLModuleType
This enum defines the type of the underlying OpenGL implementation.
- \value DesktopGL Desktop OpenGL
- \value GLES2 OpenGL ES 2.0 or higher
+ \value LibGL OpenGL
+ \value LibGLES OpenGL ES 2.0 or higher
\since 5.3
*/
@@ -1106,7 +1112,7 @@ void *QOpenGLContext::openGLModuleHandle()
\note A desktop OpenGL implementation may be capable of creating
ES-compatible contexts too. Therefore in most cases it is more
appropriate to check QSurfaceFormat::renderableType() or using the
- the convenience function isES().
+ the convenience function isOpenGLES().
\note This function requires that the QGuiApplication instance is already created.
@@ -1118,9 +1124,9 @@ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
Q_ASSERT(qGuiApp);
return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType();
#elif defined(QT_OPENGL_ES_2)
- return GLES2;
+ return LibGLES;
#else
- return DesktopGL;
+ return LibGL;
#endif
}
@@ -1134,7 +1140,7 @@ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
\since 5.3
*/
-bool QOpenGLContext::isES() const
+bool QOpenGLContext::isOpenGLES() const
{
return format().renderableType() == QSurfaceFormat::OpenGLES;
}
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 736ae0c0b4..402989b4d0 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -198,13 +198,19 @@ public:
static void *openGLModuleHandle();
enum OpenGLModuleType {
- DesktopGL,
- GLES2
+ LibGL,
+ LibGLES,
+
+ // ###
+ DesktopGL = LibGL,
+ GLES2 = LibGLES
};
static OpenGLModuleType openGLModuleType();
- bool isES() const;
+ bool isOpenGLES() const;
+
+ bool isES() const { return isOpenGLES(); } // ###
Q_SIGNALS:
void aboutToBeDestroyed();
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 660fdd1298..8c6a0a04ca 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -127,7 +127,7 @@ private:
class Q_GUI_EXPORT QOpenGLContextGroupPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QOpenGLContextGroup);
+ Q_DECLARE_PUBLIC(QOpenGLContextGroup)
public:
QOpenGLContextGroupPrivate()
: m_context(0)
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 432199f142..f20482a859 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -510,14 +510,14 @@ void QPlatformIntegration::sync()
a desktop OpenGL implementation may be capable of creating OpenGL
ES-compatible contexts too.
- \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isES()
+ \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isOpenGLES()
\since 5.3
*/
QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType()
{
qWarning("This plugin does not support dynamic OpenGL loading!");
- return QOpenGLContext::DesktopGL;
+ return QOpenGLContext::LibGL;
}
#endif
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index 19e2d9bccf..b88f2a7e84 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -86,6 +86,9 @@ public:
virtual void setChecked(bool isChecked) = 0;
virtual void setShortcut(const QKeySequence& shortcut) = 0;
virtual void setEnabled(bool enabled) = 0;
+
+ virtual void setNativeContents(WId item) { Q_UNUSED(item); }
+
Q_SIGNALS:
void activated();
void hovered();
@@ -118,6 +121,8 @@ public:
setVisible(true);
}
+ virtual void dismiss() { } // Closes this and all its related menu popups
+
virtual QPlatformMenuItem *menuItemAt(int position) const = 0;
virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0;
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 2b0c95b2b6..4b36e5ca41 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -458,7 +458,7 @@ void QWindow::setVisible(bool visible)
}
#ifndef QT_NO_CURSOR
- if (visible && d->hasCursor)
+ if (visible && (d->hasCursor || QGuiApplication::overrideCursor()))
d->applyCursor();
#endif
d->platformWindow->setVisible(visible);
@@ -746,7 +746,7 @@ void QWindow::setTitle(const QString &title)
d->windowTitle = title;
changed = true;
}
- if (d->platformWindow)
+ if (d->platformWindow && type() != Qt::Desktop)
d->platformWindow->setWindowTitle(title);
if (changed)
emit windowTitleChanged(title);