Warning, /graphics/krita/3rdparty/ext_qt/0006-Return-QScreen-s-HMONITOR-handle-via-QPlatformNative.patch is written in an unsupported language. File is not indexed.
0001 From e24177dde304afbf807b0d71e3d21af50fef548d Mon Sep 17 00:00:00 2001 0002 From: Dmitry Kazakov <dimula73@gmail.com> 0003 Date: Tue, 4 Dec 2018 20:11:34 +0300 0004 Subject: [PATCH 16/47] Return QScreen's HMONITOR handle via 0005 QPlatformNativeInterface 0006 0007 It is needed to be able to fetch extra information about the display via 0008 DXGI interface. 0009 0010 Change-Id: Id83982eb07ade157719e430d0abcc2613409a343 0011 --- 0012 .../windows/qwindowsnativeinterface.cpp | 16 ++++++++++++++++ 0013 .../platforms/windows/qwindowsnativeinterface.h | 1 + 0014 src/plugins/platforms/windows/qwindowsscreen.cpp | 5 +++++ 0015 src/plugins/platforms/windows/qwindowsscreen.h | 2 ++ 0016 4 files changed, 24 insertions(+) 0017 0018 diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp 0019 index ed945ec4b1..1c5be44150 100644 0020 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp 0021 +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp 0022 @@ -40,6 +40,7 @@ 0023 #include "qwindowsnativeinterface.h" 0024 #include "qwindowsclipboard.h" 0025 #include "qwindowswindow.h" 0026 +#include "qwindowsscreen.h" 0027 #include "qwindowscontext.h" 0028 #include "qwindowscursor.h" 0029 #include "qwindowsopenglcontext.h" 0030 @@ -124,6 +125,21 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc 0031 return nullptr; 0032 } 0033 0034 +void *QWindowsNativeInterface::nativeResourceForScreen(const QByteArray &resource, QScreen *screen) 0035 +{ 0036 + if (!screen || !screen->handle()) { 0037 + qWarning("%s: '%s' requested for null screen or screen without handle.", __FUNCTION__, resource.constData()); 0038 + return 0; 0039 + } 0040 + QWindowsScreen *bs = static_cast<QWindowsScreen *>(screen->handle()); 0041 + int type = resourceType(resource); 0042 + if (type == HandleType) 0043 + return bs->handle(); 0044 + 0045 + qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData()); 0046 + return 0; 0047 +} 0048 + 0049 #ifndef QT_NO_CURSOR 0050 void *QWindowsNativeInterface::nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) 0051 { 0052 diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.h b/src/plugins/platforms/windows/qwindowsnativeinterface.h 0053 index e6f8aae8fb..ce395dc5a4 100644 0054 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.h 0055 +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.h 0056 @@ -74,6 +74,7 @@ public: 0057 void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override; 0058 #endif 0059 void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; 0060 + void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override; 0061 #ifndef QT_NO_CURSOR 0062 void *nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) override; 0063 #endif 0064 diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp 0065 index cecd06f5a4..46e107d75e 100644 0066 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp 0067 +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp 0068 @@ -329,6 +329,11 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData) 0069 } 0070 } 0071 0072 +HMONITOR QWindowsScreen::handle() const 0073 +{ 0074 + return m_data.hMonitor; 0075 +} 0076 + 0077 QRect QWindowsScreen::virtualGeometry(const QPlatformScreen *screen) // cf QScreen::virtualGeometry() 0078 { 0079 QRect result; 0080 diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h 0081 index 8ad012512e..3eb2d35b27 100644 0082 --- a/src/plugins/platforms/windows/qwindowsscreen.h 0083 +++ b/src/plugins/platforms/windows/qwindowsscreen.h 0084 @@ -104,6 +104,8 @@ public: 0085 0086 inline void handleChanges(const QWindowsScreenData &newData); 0087 0088 + HMONITOR handle() const; 0089 + 0090 #ifndef QT_NO_CURSOR 0091 QPlatformCursor *cursor() const override { return m_cursor.data(); } 0092 const CursorPtr &cursorPtr() const { return m_cursor; } 0093 -- 0094 2.20.1.windows.1 0095