Return QScreen's HMONITOR handle via QPlatformNativeInterface
It is needed to be able to fetch extra information about the display via DXGI interface. Change-Id: Id83982eb07ade157719e430d0abcc2613409a343 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
parent
06b8644953
commit
2841d5bf64
|
|
@ -40,6 +40,7 @@
|
|||
#include "qwindowsnativeinterface.h"
|
||||
#include "qwindowsclipboard.h"
|
||||
#include "qwindowswindow.h"
|
||||
#include "qwindowsscreen.h"
|
||||
#include "qwindowscontext.h"
|
||||
#include "qwindowscursor.h"
|
||||
#include "qwindowsopenglcontext.h"
|
||||
|
|
@ -124,6 +125,21 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void *QWindowsNativeInterface::nativeResourceForScreen(const QByteArray &resource, QScreen *screen)
|
||||
{
|
||||
if (!screen || !screen->handle()) {
|
||||
qWarning("%s: '%s' requested for null screen or screen without handle.", __FUNCTION__, resource.constData());
|
||||
return nullptr;
|
||||
}
|
||||
QWindowsScreen *bs = static_cast<QWindowsScreen *>(screen->handle());
|
||||
int type = resourceType(resource);
|
||||
if (type == HandleType)
|
||||
return bs->handle();
|
||||
|
||||
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
void *QWindowsNativeInterface::nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public:
|
|||
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
|
||||
#endif
|
||||
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
|
||||
void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override;
|
||||
#ifndef QT_NO_CURSOR
|
||||
void *nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) override;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -321,6 +321,11 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
|
|||
}
|
||||
}
|
||||
|
||||
HMONITOR QWindowsScreen::handle() const
|
||||
{
|
||||
return m_data.hMonitor;
|
||||
}
|
||||
|
||||
QRect QWindowsScreen::virtualGeometry(const QPlatformScreen *screen) // cf QScreen::virtualGeometry()
|
||||
{
|
||||
QRect result;
|
||||
|
|
|
|||
|
|
@ -104,6 +104,8 @@ public:
|
|||
|
||||
inline void handleChanges(const QWindowsScreenData &newData);
|
||||
|
||||
HMONITOR handle() const;
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
QPlatformCursor *cursor() const override { return m_cursor.data(); }
|
||||
const CursorPtr &cursorPtr() const { return m_cursor; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue