diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-10-07 12:11:46 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-10-07 13:03:27 +0200 |
commit | 0efe79f80d6f249040f47162ebbfc82289ca073d (patch) | |
tree | b2326e1c7392367e438a16370f4cfb0ad63b09a0 /src/gui/kernel | |
parent | 4ef79853528dcc908ad3737f7bebf38b059de959 (diff) |
Rename the new platform APIs from QPlatformInterface to QNativeInterface
We were already using the 'native' nomenclature when referring to these
kinds of APIs, e.g. when talking about native handles, or the existing
QPlatformNativeInterface on a QPA level. Using 'native' for the user
facing APIs also distinguishes them from the 'platform' backend layer
in QPA and elsewhere.
Change-Id: I0f3273265904f0f19c0b6d62471f8820d3c3232e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 12 | ||||
-rw-r--r-- | src/gui/kernel/qkeymapper_p.h | 11 | ||||
-rw-r--r-- | src/gui/kernel/qoffscreensurface.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qoffscreensurface.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qoffscreensurface_platform.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext_platform.h | 12 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qplatformmenu_p.h | 10 | ||||
-rw-r--r-- | src/gui/kernel/qplatformoffscreensurface.h | 12 | ||||
-rw-r--r-- | src/gui/kernel/qplatformopenglcontext.h | 18 | ||||
-rw-r--r-- | src/gui/kernel/qplatformscreen_p.h | 10 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow_p.h | 12 |
14 files changed, 62 insertions, 65 deletions
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index ea791326cd..2471bb9e56 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -350,9 +350,9 @@ private: static qreal m_maxDevicePixelRatio; }; -// ----------------- QPlatformInterface ----------------- +// ----------------- QNativeInterface ----------------- -namespace QPlatformInterface::Private { +namespace QNativeInterface::Private { #if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC) @@ -360,7 +360,7 @@ class QWindowsMime; struct Q_GUI_EXPORT QWindowsApplication { - QT_DECLARE_PLATFORM_INTERFACE(QWindowsApplication) + QT_DECLARE_NATIVE_INTERFACE(QWindowsApplication) enum WindowActivationBehavior { DefaultActivateWindow, @@ -415,11 +415,11 @@ struct Q_GUI_EXPORT QWindowsApplication }; #endif // Q_OS_WIN -} // QPlatformInterface::Private +} // QNativeInterface::Private #if defined(Q_OS_WIN) -Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformInterface::Private::QWindowsApplication::TouchWindowTouchTypes) -Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformInterface::Private::QWindowsApplication::DarkModeHandling) +Q_DECLARE_OPERATORS_FOR_FLAGS(QNativeInterface::Private::QWindowsApplication::TouchWindowTouchTypes) +Q_DECLARE_OPERATORS_FOR_FLAGS(QNativeInterface::Private::QWindowsApplication::DarkModeHandling) #endif QT_END_NAMESPACE diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index fea671cf40..65d1c229ca 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -72,8 +72,7 @@ public: static void changeKeyboard(); static QList<int> possibleKeys(QKeyEvent *e); - template <typename T> - T *platformInterface() const; + QT_DECLARE_NATIVE_INTERFACE_ACCESSOR private: friend QKeyMapperPrivate *qt_keymapper_private(); @@ -99,20 +98,20 @@ public: QKeyMapperPrivate *qt_keymapper_private(); // from qkeymapper.cpp -// ----------------- QPlatformInterface ----------------- +// ----------------- QNativeInterface ----------------- -namespace QPlatformInterface::Private { +namespace QNativeInterface::Private { #if QT_CONFIG(evdev) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QEvdevKeyMapper { - QT_DECLARE_PLATFORM_INTERFACE(QEvdevKeyMapper) + QT_DECLARE_NATIVE_INTERFACE(QEvdevKeyMapper) virtual void loadKeymap(const QString &filename) = 0; virtual void switchLang() = 0; }; #endif -} // QPlatformInterface::Private +} // QNativeInterface::Private QT_END_NAMESPACE diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index 9875911d30..3144bc6f8c 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE /*! - \fn T QOffScreenSurface::platformInterface<T>() + \fn template <typename NativeInterface> NativeInterface *QOffScreenSurface::nativeInterface() - Returns a platform interface of type T for the surface. + Returns a native interface of type \c NativeInterface for the surface. This function provides access to platform specific functionality - of QOffScreenSurface, as defined in the QPlatformInterface namespace. + of QOffScreenSurface, as defined in the QNativeInterface namespace. If the requested interface is not available a \nullptr is returned. */ diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h index fe8db44633..3fc850a79d 100644 --- a/src/gui/kernel/qoffscreensurface.h +++ b/src/gui/kernel/qoffscreensurface.h @@ -79,8 +79,7 @@ public: QPlatformOffscreenSurface *handle() const; - template <typename T> - T *platformInterface() const; + QT_DECLARE_NATIVE_INTERFACE_ACCESSOR Q_SIGNALS: void screenChanged(QScreen *screen); diff --git a/src/gui/kernel/qoffscreensurface_platform.h b/src/gui/kernel/qoffscreensurface_platform.h index c991ec0122..a122891ee4 100644 --- a/src/gui/kernel/qoffscreensurface_platform.h +++ b/src/gui/kernel/qoffscreensurface_platform.h @@ -49,18 +49,18 @@ QT_FORWARD_DECLARE_CLASS(ANativeWindow); QT_BEGIN_NAMESPACE -namespace QPlatformInterface { +namespace QNativeInterface { #if defined(Q_OS_ANDROID) struct Q_GUI_EXPORT QAndroidOffscreenSurface { - QT_DECLARE_PLATFORM_INTERFACE(QAndroidOffscreenSurface) + QT_DECLARE_NATIVE_INTERFACE(QAndroidOffscreenSurface) static QOffscreenSurface *fromNative(ANativeWindow *nativeSurface); virtual ANativeWindow *nativeSurface() const = 0; }; #endif -} // QPlatformInterface +} // QNativeInterface QT_END_NAMESPACE diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 81ab994f10..490d082fd4 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -347,12 +347,12 @@ void QOpenGLContextPrivate::_q_screenDestroyed(QObject *object) } /*! - \fn template <typename T> T *QOpenGLContext::platformInterface() const + \fn template <typename NativeInterface> NativeInterface *QOpenGLContext::nativeInterface() const - Returns a platform interface of type T for the context. + Returns a native interface of type \c NativeInterface for the context. This function provides access to platform specific functionality - of QOpenGLContext, as defined in the QPlatformInterface namespace. + of QOpenGLContext, as defined in the QNativeInterface namespace. If the requested interface is not available a \nullptr is returned. */ diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 24adb1910b..60f3e3d03a 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -152,8 +152,7 @@ public: static bool supportsThreadedOpenGL(); static QOpenGLContext *globalShareContext(); - template <typename T> - T *platformInterface() const; + QT_DECLARE_NATIVE_INTERFACE_ACCESSOR Q_SIGNALS: void aboutToBeDestroyed(); diff --git a/src/gui/kernel/qopenglcontext_platform.h b/src/gui/kernel/qopenglcontext_platform.h index 1b03325c7f..c498c19437 100644 --- a/src/gui/kernel/qopenglcontext_platform.h +++ b/src/gui/kernel/qopenglcontext_platform.h @@ -64,12 +64,12 @@ typedef void *NSOpenGLContext; QT_BEGIN_NAMESPACE -namespace QPlatformInterface { +namespace QNativeInterface { #if defined(Q_OS_MACOS) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QCocoaGLContext { - QT_DECLARE_PLATFORM_INTERFACE(QCocoaGLContext) + QT_DECLARE_NATIVE_INTERFACE(QCocoaGLContext) static QOpenGLContext *fromNative(QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *, QOpenGLContext *shareContext = nullptr); virtual QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *nativeContext() const = 0; }; @@ -78,7 +78,7 @@ struct Q_GUI_EXPORT QCocoaGLContext #if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QWGLContext { - QT_DECLARE_PLATFORM_INTERFACE(QWGLContext) + QT_DECLARE_NATIVE_INTERFACE(QWGLContext) static HMODULE openGLModuleHandle(); static QOpenGLContext *fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext = nullptr); virtual HGLRC nativeContext() const = 0; @@ -88,7 +88,7 @@ struct Q_GUI_EXPORT QWGLContext #if defined(Q_OS_LINUX) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QGLXContext { - QT_DECLARE_PLATFORM_INTERFACE(QGLXContext) + QT_DECLARE_NATIVE_INTERFACE(QGLXContext) static QOpenGLContext *fromNative(GLXContext configBasedContext, QOpenGLContext *shareContext = nullptr); static QOpenGLContext *fromNative(GLXContext visualBasedContext, void *visualInfo, QOpenGLContext *shareContext = nullptr); virtual GLXContext nativeContext() const = 0; @@ -98,13 +98,13 @@ struct Q_GUI_EXPORT QGLXContext #if QT_CONFIG(egl) struct Q_GUI_EXPORT QEGLContext { - QT_DECLARE_PLATFORM_INTERFACE(QEGLContext) + QT_DECLARE_NATIVE_INTERFACE(QEGLContext) static QOpenGLContext *fromNative(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext = nullptr); virtual EGLContext nativeContext() const = 0; }; #endif -} // QPlatformInterface +} // QNativeInterface QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 5083542e12..c8438a6c24 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -81,7 +81,7 @@ class QOffscreenSurface; class QPlatformVulkanInstance; class QVulkanInstance; -namespace QPlatformInterface::Private { +namespace QNativeInterface::Private { template <typename R, typename I, auto func, typename... Args> struct QInterfaceProxyImp @@ -103,7 +103,7 @@ struct QInterfaceProxy<func> : public QInterfaceProxyImp<R, I, func, Args...> {} template <typename R, typename I, typename... Args, R(I::*func)(Args...) const> struct QInterfaceProxy<func> : public QInterfaceProxyImp<R, I, func, Args...> {}; -} // QPlatformInterface::Private +} // QNativeInterface::Private class Q_GUI_EXPORT QPlatformIntegration { @@ -229,7 +229,7 @@ public: template <auto func, typename... Args> auto call(Args... args) { - using namespace QPlatformInterface::Private; + using namespace QNativeInterface::Private; return QInterfaceProxy<func>::apply(this, args...); } diff --git a/src/gui/kernel/qplatformmenu_p.h b/src/gui/kernel/qplatformmenu_p.h index 40aef4bfd4..feba5aa9ff 100644 --- a/src/gui/kernel/qplatformmenu_p.h +++ b/src/gui/kernel/qplatformmenu_p.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE -// ----------------- QPlatformInterface ----------------- +// ----------------- QNativeInterface ----------------- #if !defined(Q_OS_MACOS) && defined(Q_CLANG_QDOC) typedef void NSMenu; @@ -65,24 +65,24 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu); QT_BEGIN_NAMESPACE #endif -namespace QPlatformInterface::Private { +namespace QNativeInterface::Private { #if defined(Q_OS_MACOS) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QCocoaMenu { - QT_DECLARE_PLATFORM_INTERFACE(QCocoaMenu) + QT_DECLARE_NATIVE_INTERFACE(QCocoaMenu) virtual NSMenu *nsMenu() const = 0; virtual void setAsDockMenu() const = 0; }; struct Q_GUI_EXPORT QCocoaMenuBar { - QT_DECLARE_PLATFORM_INTERFACE(QCocoaMenuBar) + QT_DECLARE_NATIVE_INTERFACE(QCocoaMenuBar) virtual NSMenu *nsMenu() const = 0; }; #endif -} // QPlatformInterface::Private +} // QNativeInterface::Private QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h index 1d06336956..06fa80b994 100644 --- a/src/gui/kernel/qplatformoffscreensurface.h +++ b/src/gui/kernel/qplatformoffscreensurface.h @@ -81,23 +81,23 @@ private: Q_DISABLE_COPY(QPlatformOffscreenSurface) }; -template <typename T> -T *QOffscreenSurface::platformInterface() const +template <typename NativeInterface> +NativeInterface *QOffscreenSurface::nativeInterface() const { - return dynamic_cast<T*>(surfaceHandle()); + return dynamic_cast<NativeInterface*>(surfaceHandle()); } -namespace QPlatformInterface::Private { +namespace QNativeInterface::Private { #if defined(Q_OS_ANDROID) struct Q_GUI_EXPORT QAndroidOffScreenIntegration { - QT_DECLARE_PLATFORM_INTERFACE(QAndroidOffScreenIntegration) + QT_DECLARE_NATIVE_INTERFACE(QAndroidOffScreenIntegration) virtual QOffscreenSurface *createOffscreenSurface(ANativeWindow *nativeSurface) const = 0; }; #endif -} // QPlatformInterface::Private +} // QNativeInterface::Private QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h index 8c38d88b56..f5d7461394 100644 --- a/src/gui/kernel/qplatformopenglcontext.h +++ b/src/gui/kernel/qplatformopenglcontext.h @@ -102,18 +102,18 @@ private: Q_DISABLE_COPY(QPlatformOpenGLContext) }; -template <typename T> -T *QOpenGLContext::platformInterface() const +template <typename NativeInterface> +NativeInterface *QOpenGLContext::nativeInterface() const { - return dynamic_cast<T*>(handle()); + return dynamic_cast<NativeInterface*>(handle()); } -namespace QPlatformInterface::Private { +namespace QNativeInterface::Private { #if defined(Q_OS_MACOS) struct Q_GUI_EXPORT QCocoaGLIntegration { - QT_DECLARE_PLATFORM_INTERFACE(QCocoaGLIntegration) + QT_DECLARE_NATIVE_INTERFACE(QCocoaGLIntegration) virtual QOpenGLContext *createOpenGLContext(NSOpenGLContext *, QOpenGLContext *shareContext) const = 0; }; #endif @@ -121,7 +121,7 @@ struct Q_GUI_EXPORT QCocoaGLIntegration #if defined(Q_OS_WIN) struct Q_GUI_EXPORT QWindowsGLIntegration { - QT_DECLARE_PLATFORM_INTERFACE(QWindowsGLIntegration) + QT_DECLARE_NATIVE_INTERFACE(QWindowsGLIntegration) virtual HMODULE openGLModuleHandle() const = 0; virtual QOpenGLContext *createOpenGLContext(HGLRC context, HWND window, QOpenGLContext *shareContext) const = 0; }; @@ -130,7 +130,7 @@ struct Q_GUI_EXPORT QWindowsGLIntegration #if defined(Q_OS_LINUX) struct Q_GUI_EXPORT QGLXIntegration { - QT_DECLARE_PLATFORM_INTERFACE(QGLXIntegration) + QT_DECLARE_NATIVE_INTERFACE(QGLXIntegration) virtual QOpenGLContext *createOpenGLContext(GLXContext context, void *visualInfo, QOpenGLContext *shareContext) const = 0; }; #endif @@ -138,12 +138,12 @@ struct Q_GUI_EXPORT QGLXIntegration #if QT_CONFIG(egl) struct Q_GUI_EXPORT QEGLIntegration { - QT_DECLARE_PLATFORM_INTERFACE(QEGLIntegration) + QT_DECLARE_NATIVE_INTERFACE(QEGLIntegration) virtual QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const = 0; }; #endif -} // QPlatformInterface::Private +} // QNativeInterface::Private QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformscreen_p.h b/src/gui/kernel/qplatformscreen_p.h index 2f09c1de37..340f637dd9 100644 --- a/src/gui/kernel/qplatformscreen_p.h +++ b/src/gui/kernel/qplatformscreen_p.h @@ -65,14 +65,14 @@ public: QPointer<QScreen> screen; }; -// ----------------- QPlatformInterface ----------------- +// ----------------- QNativeInterface ----------------- -namespace QPlatformInterface::Private { +namespace QNativeInterface::Private { #if QT_CONFIG(xcb) struct Q_GUI_EXPORT QXcbScreen { - QT_DECLARE_PLATFORM_INTERFACE(QXcbScreen) + QT_DECLARE_NATIVE_INTERFACE(QXcbScreen) virtual int virtualDesktopNumber() const = 0; }; #endif @@ -80,7 +80,7 @@ struct Q_GUI_EXPORT QXcbScreen #if QT_CONFIG(vsp2) struct Q_GUI_EXPORT QVsp2Screen { - QT_DECLARE_PLATFORM_INTERFACE(QVsp2Screen) + QT_DECLARE_NATIVE_INTERFACE(QVsp2Screen) virtual int addLayer(int dmabufFd, const QSize &size, const QPoint &position, uint drmPixelFormat, uint bytesPerLine) = 0; virtual void setLayerBuffer(int id, int dmabufFd) = 0; virtual void setLayerPosition(int id, const QPoint &position) = 0; @@ -90,7 +90,7 @@ struct Q_GUI_EXPORT QVsp2Screen }; #endif -} // QPlatformInterface::Private +} // QNativeInterface::Private QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h index 7d459556fd..ffc3879bf1 100644 --- a/src/gui/kernel/qplatformwindow_p.h +++ b/src/gui/kernel/qplatformwindow_p.h @@ -66,14 +66,14 @@ public: QBasicTimer updateTimer; }; -// ----------------- QPlatformInterface ----------------- +// ----------------- QNativeInterface ----------------- -namespace QPlatformInterface::Private { +namespace QNativeInterface::Private { #if defined(Q_OS_MACOS) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QCocoaWindow { - QT_DECLARE_PLATFORM_INTERFACE(QCocoaWindow) + QT_DECLARE_NATIVE_INTERFACE(QCocoaWindow) virtual void setContentBorderEnabled(bool enable) = 0; virtual QPoint bottomLeftClippedByNSWindowOffset() const = 0; }; @@ -82,7 +82,7 @@ struct Q_GUI_EXPORT QCocoaWindow #if QT_CONFIG(xcb) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QXcbWindow { - QT_DECLARE_PLATFORM_INTERFACE(QXcbWindow) + QT_DECLARE_NATIVE_INTERFACE(QXcbWindow) enum WindowType { None = 0x000000, @@ -114,7 +114,7 @@ struct Q_GUI_EXPORT QXcbWindow #if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC) struct Q_GUI_EXPORT QWindowsWindow { - QT_DECLARE_PLATFORM_INTERFACE(QWindowsWindow) + QT_DECLARE_NATIVE_INTERFACE(QWindowsWindow) virtual void setHasBorderInFullScreen(bool border) = 0; virtual bool hasBorderInFullScreen() const = 0; @@ -124,7 +124,7 @@ struct Q_GUI_EXPORT QWindowsWindow }; #endif // Q_OS_WIN -} // QPlatformInterface::Private +} // QNativeInterface::Private QT_END_NAMESPACE |