diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-04-30 11:26:43 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-30 22:43:49 +0200 |
commit | 2e44a9e4918cd6d9d7f33f61330c456249dd9b0f (patch) | |
tree | a4f81644f729077ff54c4b9617a7ae9577b5d435 /src/plugins/platforms/windows/qwindowscontext.h | |
parent | ae7bbe34005d704f0c1fd3ca0335095c1df48cde (diff) |
Windows: Start using High DPI API available from Windows 8.1 onwards.
Dynamically load shcore.dll, use SetProcessDpiAwareness() instead
of SetProcessDPIAware() when available. Add command line parameter
to control level.
Task-number: QTBUG-37347
Change-Id: I1259b0943b41e50066e7e3870ed3136afd8f18fe
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.h')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index f5dbd072c7..d565a5feab 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -126,6 +126,22 @@ struct QWindowsShell32DLL SHGetStockIconInfo sHGetStockIconInfo; SHGetImageList sHGetImageList; }; + +// Shell scaling library (Windows 8.1 onwards) +struct QWindowsShcoreDLL { + QWindowsShcoreDLL(); + void init(); + inline bool isValid() const { return getProcessDpiAwareness && setProcessDpiAwareness && getDpiForMonitor; } + + typedef HRESULT (WINAPI *GetProcessDpiAwareness)(HANDLE,int); + typedef HRESULT (WINAPI *SetProcessDpiAwareness)(int); + typedef HRESULT (WINAPI *GetDpiForMonitor)(HMONITOR,int,UINT *,UINT *); + + GetProcessDpiAwareness getProcessDpiAwareness; + SetProcessDpiAwareness setProcessDpiAwareness; + GetDpiForMonitor getDpiForMonitor; +}; + #endif // Q_OS_WINCE class QWindowsContext @@ -184,6 +200,7 @@ public: void setWindowCreationContext(const QSharedPointer<QWindowCreationContext> &ctx); void setTabletAbsoluteRange(int a); + void setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness); // Returns a combination of SystemInfoFlags unsigned systemInfo() const; @@ -197,6 +214,7 @@ public: #ifndef Q_OS_WINCE static QWindowsUser32DLL user32dll; static QWindowsShell32DLL shell32dll; + static QWindowsShcoreDLL shcoredll; #endif static QByteArray comErrorString(HRESULT hr); |