Make some QScreen native interfaces public
[ChangeLog][QtGui][QScreen] The QAndroidScreen, QWaylandScreen and QWaylandWindow native interfaces are now available on QScreen to provide a handle to the underlying platform screen. Task-number: QTBUG-113795 Change-Id: I83d70046678dfb79ee08544ddfc1820f3ff2d118 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
1c42b1e8c7
commit
706dafe347
@ -131,7 +131,7 @@ qt_internal_add_module(Gui
|
||||
kernel/qplatformwindow.cpp kernel/qplatformwindow.h kernel/qplatformwindow_p.h
|
||||
kernel/qpointingdevice.cpp kernel/qpointingdevice.h kernel/qpointingdevice_p.h
|
||||
kernel/qrasterwindow.cpp kernel/qrasterwindow.h
|
||||
kernel/qscreen.cpp kernel/qscreen.h kernel/qscreen_p.h
|
||||
kernel/qscreen.cpp kernel/qscreen.h kernel/qscreen_p.h kernel/qscreen_platform.h
|
||||
kernel/qsessionmanager.cpp kernel/qsessionmanager.h kernel/qsessionmanager_p.h
|
||||
kernel/qstylehints.cpp kernel/qstylehints.h kernel/qstylehints_p.h
|
||||
kernel/qsurface.cpp kernel/qsurface.h
|
||||
|
@ -20,14 +20,6 @@
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <QtCore/qnativeinterface.h>
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
#include <qwindowdefs_win.h>
|
||||
#endif
|
||||
|
||||
#if QT_CONFIG(wayland)
|
||||
struct wl_output;
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QScreen;
|
||||
@ -75,31 +67,6 @@ struct Q_GUI_EXPORT QWebOSScreen
|
||||
virtual void addFlipListener(void (*callback)()) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_QDOC)
|
||||
struct Q_GUI_EXPORT QWindowsScreen
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QWindowsScreen, 1, QScreen)
|
||||
virtual HMONITOR handle() const = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if QT_CONFIG(wayland) || defined(Q_QDOC)
|
||||
struct Q_GUI_EXPORT QWaylandScreen
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QWaylandScreen, 1, QScreen)
|
||||
virtual wl_output *output() const = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_QDOC)
|
||||
struct Q_GUI_EXPORT QAndroidScreen
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QAndroidScreen, 1, QScreen)
|
||||
virtual int displayId() const = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // QNativeInterface::Private
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -703,8 +703,23 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height)
|
||||
result.setDevicePixelRatio(result.devicePixelRatio() * factor);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn template <typename QNativeInterface> QNativeInterface *QScreen::nativeInterface() const
|
||||
|
||||
Returns a native interface of the given type for the screen.
|
||||
|
||||
This function provides access to platform specific functionality
|
||||
of QScreen, as defined in the QNativeInterface namespace:
|
||||
|
||||
\annotatedlist native-interfaces-qscreen
|
||||
|
||||
If the requested interface is not available a \nullptr is returned.
|
||||
*/
|
||||
|
||||
void *QScreen::resolveInterface(const char *name, int revision) const
|
||||
{
|
||||
using namespace QNativeInterface;
|
||||
using namespace QNativeInterface::Private;
|
||||
|
||||
auto *platformScreen = handle();
|
||||
|
@ -147,5 +147,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QScreen *);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include <QtGui/qscreen_platform.h>
|
||||
|
||||
#endif // QSCREEN_H
|
||||
|
||||
|
61
src/gui/kernel/qscreen_platform.h
Normal file
61
src/gui/kernel/qscreen_platform.h
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#ifndef QSCREEN_PLATFORM_H
|
||||
#define QSCREEN_PLATFORM_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is part of the native interface APIs. Usage of
|
||||
// this API may make your code source and binary incompatible
|
||||
// with future versions of Qt.
|
||||
//
|
||||
|
||||
#include <QtGui/qtguiglobal.h>
|
||||
|
||||
#include <QtCore/qnativeinterface.h>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
#include <QtGui/qwindowdefs_win.h>
|
||||
#endif
|
||||
|
||||
#if QT_CONFIG(wayland)
|
||||
struct wl_output;
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QNativeInterface {
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_QDOC)
|
||||
struct Q_GUI_EXPORT QWindowsScreen
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QWindowsScreen, 1, QScreen)
|
||||
virtual HMONITOR handle() const = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if QT_CONFIG(wayland) || defined(Q_QDOC)
|
||||
struct Q_GUI_EXPORT QWaylandScreen
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QWaylandScreen, 1, QScreen)
|
||||
virtual wl_output *output() const = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_QDOC)
|
||||
struct Q_GUI_EXPORT QAndroidScreen
|
||||
{
|
||||
QT_DECLARE_NATIVE_INTERFACE(QAndroidScreen, 1, QScreen)
|
||||
virtual int displayId() const = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace QNativeInterface
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
@ -35,6 +35,20 @@ QOffscreenSurface *QNativeInterface::QAndroidOffscreenSurface::fromNative(ANati
|
||||
&QAndroidOffScreenIntegration::createOffscreenSurface>(nativeSurface);
|
||||
}
|
||||
|
||||
QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QAndroidScreen);
|
||||
/*!
|
||||
\class QNativeInterface::QAndroidScreen
|
||||
\since 6.7
|
||||
\brief Native interface to a screen.
|
||||
|
||||
Accessed through QScreen::nativeInterface().
|
||||
\inmodule QtGui
|
||||
\ingroup native-interfaces
|
||||
\ingroup native-interfaces-qscreen
|
||||
*/
|
||||
/*!
|
||||
\fn int QNativeInterface::QAndroidScreen::displayId() const;
|
||||
\return The Id of the underlying Android display.
|
||||
*/
|
||||
QT_DEFINE_NATIVE_INTERFACE(QAndroidScreen);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -280,15 +280,20 @@ QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QEvdevKeyMapper);
|
||||
QT_DEFINE_NATIVE_INTERFACE(QWaylandApplication);
|
||||
|
||||
/*!
|
||||
\class QNativeInterface::Private::QWaylandScreen
|
||||
\since 6.5
|
||||
\internal
|
||||
\brief Native interface to QPlatformScreen.
|
||||
\class QNativeInterface::QWaylandScreen
|
||||
\since 6.7
|
||||
\brief Native interface to a screen on Wayland.
|
||||
|
||||
Accessed through QScreen::nativeInterface().
|
||||
\inmodule QtGui
|
||||
\ingroup native-interfaces
|
||||
\ingroup native-interfaces-qscreen
|
||||
*/
|
||||
|
||||
QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWaylandScreen);
|
||||
/*!
|
||||
\fn wl_output *QNativeInterface::QWaylandScreen::output() const
|
||||
\return the underlying wl_output of this QScreen.
|
||||
*/
|
||||
QT_DEFINE_NATIVE_INTERFACE(QWaylandScreen);
|
||||
|
||||
/*!
|
||||
\class QNativeInterface::QWaylandWindow
|
||||
|
@ -89,14 +89,20 @@ QOpenGLContext *QNativeInterface::QWGLContext::fromNative(HGLRC context, HWND wi
|
||||
QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWindowsApplication);
|
||||
|
||||
/*!
|
||||
\class QNativeInterface::Private::QWindowsScreen
|
||||
\since 6.5
|
||||
\internal
|
||||
\brief Native interface to QScreen, to be retrieved from QPlatformIntegration.
|
||||
\class QNativeInterface::QWindowsScreen
|
||||
\since 6.7
|
||||
\brief Native interface to a screen.
|
||||
|
||||
Accessed through QScreen::nativeInterface().
|
||||
\inmodule QtGui
|
||||
\ingroup native-interfaces
|
||||
\ingroup native-interfaces-qscreen
|
||||
*/
|
||||
QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWindowsScreen);
|
||||
/*!
|
||||
* \fn HWMONITOR QNativeInterface::QWindowsScreen::handle() const;
|
||||
* \return The underlying HWMONITOR of the screen.
|
||||
*/
|
||||
QT_DEFINE_NATIVE_INTERFACE(QWindowsScreen);
|
||||
/*!
|
||||
\enum QNativeInterface::Private::QWindowsApplication::TouchWindowTouchType
|
||||
|
||||
|
@ -11,15 +11,16 @@
|
||||
#include <QWaitCondition>
|
||||
#include <QtCore/QJniObject>
|
||||
#include <qpa/qplatformscreen.h>
|
||||
#include <qpa/qplatformscreen_p.h>
|
||||
#include <QtGui/qscreen_platform.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAndroidPlatformWindow;
|
||||
|
||||
class QAndroidPlatformScreen: public QObject,
|
||||
public QPlatformScreen,
|
||||
public QNativeInterface::Private::QAndroidScreen
|
||||
|
||||
class QAndroidPlatformScreen : public QObject,
|
||||
public QPlatformScreen,
|
||||
public QNativeInterface::QAndroidScreen
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qscopedpointer.h>
|
||||
#include <qpa/qplatformscreen.h>
|
||||
#include <qpa/qplatformscreen_p.h>
|
||||
#include <QtGui/qscreen_platform.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -41,8 +41,7 @@ struct QWindowsScreenData
|
||||
std::optional<int> deviceIndex = std::nullopt;
|
||||
};
|
||||
|
||||
class QWindowsScreen : public QPlatformScreen
|
||||
, public QNativeInterface::Private::QWindowsScreen
|
||||
class QWindowsScreen : public QPlatformScreen, public QNativeInterface::QWindowsScreen
|
||||
{
|
||||
public:
|
||||
#ifndef QT_NO_CURSOR
|
||||
|
Loading…
x
Reference in New Issue
Block a user