Expose the native interfaces of QScreen/QWindow
Add the macros. Task-number: QTBUG-84220 Change-Id: Ica23b9e4d5c1ca072acb5356e6f2be28d5199fa6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
19a154f57b
commit
cafdb8d3ee
@ -73,7 +73,7 @@ namespace QNativeInterface::Private {
|
||||
#if QT_CONFIG(xcb) || defined(Q_CLANG_QDOC)
|
||||
struct Q_GUI_EXPORT QXcbScreen
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QXcbScreen)
|
||||
QT_DECLARE_NATIVE_INTERFACE(QXcbScreen, 1, QScreen)
|
||||
virtual int virtualDesktopNumber() const = 0;
|
||||
};
|
||||
#endif
|
||||
@ -81,7 +81,7 @@ struct Q_GUI_EXPORT QXcbScreen
|
||||
#if QT_CONFIG(vsp2) || defined(Q_CLANG_QDOC)
|
||||
struct Q_GUI_EXPORT QVsp2Screen
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QVsp2Screen)
|
||||
QT_DECLARE_NATIVE_INTERFACE(QVsp2Screen, 1, QScreen)
|
||||
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;
|
||||
@ -94,7 +94,7 @@ struct Q_GUI_EXPORT QVsp2Screen
|
||||
#if defined(Q_OS_WEBOS) || defined(Q_CLANG_QDOC)
|
||||
struct Q_GUI_EXPORT QWebOSScreen
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QWebOSScreen)
|
||||
QT_DECLARE_NATIVE_INTERFACE(QWebOSScreen, 1, QScreen)
|
||||
virtual int addLayer(void *gbm_bo, const QRectF &geometry) = 0;
|
||||
virtual void setLayerBuffer(int id, void *gbm_bo) = 0;
|
||||
virtual void setLayerGeometry(int id, const QRectF &geometry) = 0;
|
||||
|
@ -74,7 +74,7 @@ namespace QNativeInterface::Private {
|
||||
#if defined(Q_OS_MACOS) || defined(Q_CLANG_QDOC)
|
||||
struct Q_GUI_EXPORT QCocoaWindow
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QCocoaWindow)
|
||||
QT_DECLARE_NATIVE_INTERFACE(QCocoaWindow, 1, QWindow)
|
||||
virtual void setContentBorderEnabled(bool enable) = 0;
|
||||
virtual QPoint bottomLeftClippedByNSWindowOffset() const = 0;
|
||||
};
|
||||
@ -83,7 +83,7 @@ struct Q_GUI_EXPORT QCocoaWindow
|
||||
#if QT_CONFIG(xcb) || defined(Q_CLANG_QDOC)
|
||||
struct Q_GUI_EXPORT QXcbWindow
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QXcbWindow)
|
||||
QT_DECLARE_NATIVE_INTERFACE(QXcbWindow, 1, QWindow)
|
||||
|
||||
enum WindowType {
|
||||
None = 0x000000,
|
||||
@ -115,7 +115,7 @@ struct Q_GUI_EXPORT QXcbWindow
|
||||
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
|
||||
struct Q_GUI_EXPORT QWindowsWindow
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QWindowsWindow)
|
||||
QT_DECLARE_NATIVE_INTERFACE(QWindowsWindow, 1, QWindow)
|
||||
|
||||
virtual void setHasBorderInFullScreen(bool border) = 0;
|
||||
virtual bool hasBorderInFullScreen() const = 0;
|
||||
|
@ -786,6 +786,31 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height)
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QScreen *that, const char *name, int revision)
|
||||
{
|
||||
using namespace QNativeInterface::Private;
|
||||
|
||||
auto *platformScreen = that->handle();
|
||||
Q_UNUSED(platformScreen);
|
||||
Q_UNUSED(name);
|
||||
Q_UNUSED(revision);
|
||||
|
||||
#if QT_CONFIG(xcb)
|
||||
QT_NATIVE_INTERFACE_RETURN_IF(QXcbScreen, platformScreen);
|
||||
#endif
|
||||
|
||||
#if QT_CONFIG(vsp2)
|
||||
QT_NATIVE_INTERFACE_RETURN_IF(QVsp2Screen, platformScreen);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WEBOS)
|
||||
QT_NATIVE_INTERFACE_RETURN_IF(QWebOSScreen, platformScreen);
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
||||
static inline void formatRect(QDebug &debug, const QRect r)
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <QtGui/QTransform>
|
||||
|
||||
#include <QtCore/qnamespace.h>
|
||||
#include <QtCore/qnativeinterface.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -148,6 +149,8 @@ public:
|
||||
|
||||
qreal refreshRate() const;
|
||||
|
||||
QT_DECLARE_NATIVE_INTERFACE_ACCESSOR
|
||||
|
||||
Q_SIGNALS:
|
||||
void geometryChanged(const QRect &geometry);
|
||||
void availableGeometryChanged(const QRect &geometry);
|
||||
|
@ -69,6 +69,7 @@
|
||||
|
||||
#include <QStyleHints>
|
||||
#include <qpa/qplatformcursor.h>
|
||||
#include <qpa/qplatformwindow_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -3003,6 +3004,31 @@ bool QWindowPrivate::applyCursor()
|
||||
}
|
||||
#endif // QT_NO_CURSOR
|
||||
|
||||
template <>
|
||||
Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QWindow *that, const char *name, int revision)
|
||||
{
|
||||
using namespace QNativeInterface::Private;
|
||||
|
||||
auto *platformWindow = that->handle();
|
||||
Q_UNUSED(platformWindow);
|
||||
Q_UNUSED(name);
|
||||
Q_UNUSED(revision);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
QT_NATIVE_INTERFACE_RETURN_IF(QWindowsWindow, platformWindow);
|
||||
#endif
|
||||
|
||||
#if QT_CONFIG(xcb)
|
||||
QT_NATIVE_INTERFACE_RETURN_IF(QXcbWindow, platformWindow);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
QT_NATIVE_INTERFACE_RETURN_IF(QCocoaWindow, platformWindow);
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug debug, const QWindow *window)
|
||||
{
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <QtCore/QRect>
|
||||
|
||||
#include <QtCore/qnamespace.h>
|
||||
#include <QtCore/qnativeinterface.h>
|
||||
|
||||
#include <QtGui/qsurface.h>
|
||||
#include <QtGui/qsurfaceformat.h>
|
||||
@ -283,6 +284,8 @@ public:
|
||||
QVulkanInstance *vulkanInstance() const;
|
||||
#endif
|
||||
|
||||
QT_DECLARE_NATIVE_INTERFACE_ACCESSOR
|
||||
|
||||
public Q_SLOTS:
|
||||
Q_REVISION(2, 1) void requestActivate();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user