diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 15 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qkeymapper.cpp | 13 | ||||
-rw-r--r-- | src/gui/kernel/qkeymapper_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qoffscreensurface.cpp | 17 | ||||
-rw-r--r-- | src/gui/kernel/qoffscreensurface_platform.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 26 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext_platform.h | 8 | ||||
-rw-r--r-- | src/gui/kernel/qplatformoffscreensurface.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qplatformopenglcontext.h | 6 |
11 files changed, 80 insertions, 19 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index eed035c221..966a558304 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -4196,6 +4196,21 @@ QInputDeviceManager *QGuiApplicationPrivate::inputDeviceManager() return m_inputDeviceManager; } +template <> +Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QGuiApplication *that, const std::type_info &type, int revision) +{ + using namespace QNativeInterface::Private; + + auto *platformIntegration = QGuiApplicationPrivate::platformIntegration(); + Q_UNUSED(platformIntegration); + +#if defined(Q_OS_WIN) + QT_NATIVE_INTERFACE_RETURN_IF(QWindowsApplication, platformIntegration); +#endif + + return resolveInterface<QCoreApplication>(that, type, revision); +} + #include "moc_qguiapplication.cpp" QT_END_NAMESPACE diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index c71ed52556..02d0376e77 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -170,6 +170,8 @@ public: bool isSavingSession() const; #endif + QT_DECLARE_NATIVE_INTERFACE_ACCESSOR + static void sync(); Q_SIGNALS: void fontDatabaseChanged(); diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index f225bf0010..f6c8693206 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -354,7 +354,7 @@ class QWindowsMime; struct Q_GUI_EXPORT QWindowsApplication { - QT_DECLARE_NATIVE_INTERFACE(QWindowsApplication) + QT_DECLARE_NATIVE_INTERFACE(QWindowsApplication, 1, QGuiApplication) enum WindowActivationBehavior { DefaultActivateWindow, diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp index 19b0e15279..3781330073 100644 --- a/src/gui/kernel/qkeymapper.cpp +++ b/src/gui/kernel/qkeymapper.cpp @@ -135,4 +135,17 @@ QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent *e) return extractKeyFromEvent(e); } +template <> +Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QKeyMapper *that, const std::type_info &type, int revision) +{ + Q_UNUSED(that); Q_UNUSED(type); Q_UNUSED(revision); + using namespace QNativeInterface::Private; + +#if QT_CONFIG(evdev) + QT_NATIVE_INTERFACE_RETURN_IF(QEvdevKeyMapper, QGuiApplicationPrivate::platformIntegration()); +#endif + + return nullptr; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index e0614a79a1..9f061a9eb7 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -106,7 +106,7 @@ namespace QNativeInterface::Private { #if QT_CONFIG(evdev) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QEvdevKeyMapper { - QT_DECLARE_NATIVE_INTERFACE(QEvdevKeyMapper) + QT_DECLARE_NATIVE_INTERFACE(QEvdevKeyMapper, 1, QKeyMapper) virtual void loadKeymap(const QString &filename) = 0; virtual void switchLang() = 0; }; diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index d80a081105..53c60b278e 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -369,4 +369,21 @@ QPlatformSurface *QOffscreenSurface::surfaceHandle() const return d->platformOffscreenSurface; } +using namespace QNativeInterface; + +template <> +Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QOffscreenSurface *that, const std::type_info &type, int revision) +{ + Q_UNUSED(that); Q_UNUSED(type); Q_UNUSED(revision); + + auto *surfacePrivate = QOffscreenSurfacePrivate::get(const_cast<QOffscreenSurface*>(that)); + Q_UNUSED(surfacePrivate); + +#if defined(Q_OS_ANDROID) + QT_NATIVE_INTERFACE_RETURN_IF(QAndroidOffscreenSurface, surfacePrivate->platformOffscreenSurface); +#endif + + return nullptr; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qoffscreensurface_platform.h b/src/gui/kernel/qoffscreensurface_platform.h index 3eb250ea5e..b6d77491d5 100644 --- a/src/gui/kernel/qoffscreensurface_platform.h +++ b/src/gui/kernel/qoffscreensurface_platform.h @@ -55,7 +55,7 @@ namespace QNativeInterface { #if defined(Q_OS_ANDROID) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QAndroidOffscreenSurface { - QT_DECLARE_NATIVE_INTERFACE(QAndroidOffscreenSurface) + QT_DECLARE_NATIVE_INTERFACE(QAndroidOffscreenSurface, 1, QOffscreenSurface) static QOffscreenSurface *fromNative(ANativeWindow *nativeSurface); virtual ANativeWindow *nativeSurface() const = 0; }; diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 6cc2d65a35..4a423e7ed5 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1309,6 +1309,32 @@ QDebug operator<<(QDebug debug, const QOpenGLContextGroup *cg) } #endif // QT_NO_DEBUG_STREAM +using namespace QNativeInterface; + +template <> +Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QOpenGLContext *that, const std::type_info &type, int revision) +{ + Q_UNUSED(that); Q_UNUSED(type); Q_UNUSED(revision); + + auto *platformContext = that->handle(); + Q_UNUSED(platformContext); + +#if defined(Q_OS_MACOS) + QT_NATIVE_INTERFACE_RETURN_IF(QCocoaGLContext, platformContext); +#endif +#if defined(Q_OS_WIN) + QT_NATIVE_INTERFACE_RETURN_IF(QWGLContext, platformContext); +#endif +#if QT_CONFIG(xcb_glx_plugin) + QT_NATIVE_INTERFACE_RETURN_IF(QGLXContext, platformContext); +#endif +#if QT_CONFIG(egl) + QT_NATIVE_INTERFACE_RETURN_IF(QEGLContext, platformContext); +#endif + + return nullptr; +} + #include "moc_qopenglcontext.cpp" QT_END_NAMESPACE diff --git a/src/gui/kernel/qopenglcontext_platform.h b/src/gui/kernel/qopenglcontext_platform.h index 2e475c7fe9..7627e34c20 100644 --- a/src/gui/kernel/qopenglcontext_platform.h +++ b/src/gui/kernel/qopenglcontext_platform.h @@ -71,7 +71,7 @@ namespace QNativeInterface { #if defined(Q_OS_MACOS) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QCocoaGLContext { - QT_DECLARE_NATIVE_INTERFACE(QCocoaGLContext) + QT_DECLARE_NATIVE_INTERFACE(QCocoaGLContext, 1, QOpenGLContext) static QOpenGLContext *fromNative(QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *context, QOpenGLContext *shareContext = nullptr); virtual QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *nativeContext() const = 0; }; @@ -80,7 +80,7 @@ struct Q_GUI_EXPORT QCocoaGLContext #if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QWGLContext { - QT_DECLARE_NATIVE_INTERFACE(QWGLContext) + QT_DECLARE_NATIVE_INTERFACE(QWGLContext, 1, QOpenGLContext) static HMODULE openGLModuleHandle(); static QOpenGLContext *fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext = nullptr); virtual HGLRC nativeContext() const = 0; @@ -90,7 +90,7 @@ struct Q_GUI_EXPORT QWGLContext #if QT_CONFIG(xcb_glx_plugin) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QGLXContext { - QT_DECLARE_NATIVE_INTERFACE(QGLXContext) + QT_DECLARE_NATIVE_INTERFACE(QGLXContext, 1, QOpenGLContext) static QOpenGLContext *fromNative(GLXContext configBasedContext, QOpenGLContext *shareContext = nullptr); static QOpenGLContext *fromNative(GLXContext visualBasedContext, void *visualInfo, QOpenGLContext *shareContext = nullptr); virtual GLXContext nativeContext() const = 0; @@ -100,7 +100,7 @@ struct Q_GUI_EXPORT QGLXContext #if QT_CONFIG(egl) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QEGLContext { - QT_DECLARE_NATIVE_INTERFACE(QEGLContext) + QT_DECLARE_NATIVE_INTERFACE(QEGLContext, 1, QOpenGLContext) static QOpenGLContext *fromNative(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext = nullptr); virtual EGLContext nativeContext() const = 0; }; diff --git a/src/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h index 46bc65d467..259b213f5a 100644 --- a/src/gui/kernel/qplatformoffscreensurface.h +++ b/src/gui/kernel/qplatformoffscreensurface.h @@ -83,12 +83,6 @@ private: Q_DISABLE_COPY(QPlatformOffscreenSurface) }; -template <typename NativeInterface> -NativeInterface *QOffscreenSurface::nativeInterface() const -{ - return dynamic_cast<NativeInterface*>(surfaceHandle()); -} - namespace QNativeInterface::Private { #if defined(Q_OS_ANDROID) diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h index d747b3b7d4..034462e5f3 100644 --- a/src/gui/kernel/qplatformopenglcontext.h +++ b/src/gui/kernel/qplatformopenglcontext.h @@ -104,12 +104,6 @@ private: Q_DISABLE_COPY(QPlatformOpenGLContext) }; -template <typename NativeInterface> -NativeInterface *QOpenGLContext::nativeInterface() const -{ - return dynamic_cast<NativeInterface*>(handle()); -} - namespace QNativeInterface::Private { #if defined(Q_OS_MACOS) |