summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/openglblacklists/default.json12
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h6
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.cpp17
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp56
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp15
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp14
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp19
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp68
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h3
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp2
-rw-r--r--src/plugins/platforms/windows/windows.pri4
16 files changed, 196 insertions, 40 deletions
diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json
index 1e003e2d15..2672711d3a 100644
--- a/src/plugins/platforms/windows/openglblacklists/default.json
+++ b/src/plugins/platforms/windows/openglblacklists/default.json
@@ -66,6 +66,18 @@
"features": [
"disable_desktopgl", "disable_angle"
]
+ },
+ {
+ "id": 6,
+ "description": "Intel(R) HD Graphics 4000 / 5500 cause crashes on orientation changes in fullscreen mode (QTBUG-49541)",
+ "vendor_id": "0x8086",
+ "device_id": [ "0x0166", "0x1616" ],
+ "os": {
+ "type": "win"
+ },
+ "features": [
+ "disable_rotation"
+ ]
}
]
}
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index 25cfd12b44..1071a2e038 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -236,7 +236,7 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L
// suspended by a shell prompt 'Select' or debugger).
if (QWindowsContext::user32dll.isHungAppWindow
&& QWindowsContext::user32dll.isHungAppWindow(m_nextClipboardViewer)) {
- qWarning("%s: Cowardly refusing to send clipboard message to hung application...", Q_FUNC_INFO);
+ qWarning("Cowardly refusing to send clipboard message to hung application...");
return;
}
// Do not block if the process is being debugged, specifically, if it is
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 82cc1deb23..217444d129 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -177,7 +177,8 @@ QWindowsUser32DLL::QWindowsUser32DLL() :
isHungAppWindow(0), isTouchWindow(0),
registerTouchWindow(0), unregisterTouchWindow(0),
getTouchInputInfo(0), closeTouchInputHandle(0), setProcessDPIAware(0),
- addClipboardFormatListener(0), removeClipboardFormatListener(0)
+ addClipboardFormatListener(0), removeClipboardFormatListener(0),
+ getDisplayAutoRotationPreferences(0), setDisplayAutoRotationPreferences(0)
{
}
@@ -198,6 +199,8 @@ void QWindowsUser32DLL::init()
addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener");
removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener");
}
+ getDisplayAutoRotationPreferences = (GetDisplayAutoRotationPreferences)library.resolve("GetDisplayAutoRotationPreferences");
+ setDisplayAutoRotationPreferences = (SetDisplayAutoRotationPreferences)library.resolve("SetDisplayAutoRotationPreferences");
}
bool QWindowsUser32DLL::initTouch()
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index 641e3ed41f..d08fc8f726 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -94,6 +94,8 @@ struct QWindowsUser32DLL
typedef BOOL (WINAPI *SetProcessDPIAware)();
typedef BOOL (WINAPI *AddClipboardFormatListener)(HWND);
typedef BOOL (WINAPI *RemoveClipboardFormatListener)(HWND);
+ typedef BOOL (WINAPI *GetDisplayAutoRotationPreferences)(DWORD *);
+ typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD);
// Functions missing in Q_CC_GNU stub libraries.
SetLayeredWindowAttributes setLayeredWindowAttributes;
@@ -116,6 +118,10 @@ struct QWindowsUser32DLL
// Clipboard listeners, Windows Vista onwards
AddClipboardFormatListener addClipboardFormatListener;
RemoveClipboardFormatListener removeClipboardFormatListener;
+
+ // Rotation API
+ GetDisplayAutoRotationPreferences getDisplayAutoRotationPreferences;
+ SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences;
};
struct QWindowsShell32DLL
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp
index 21eba6da7e..65a9763be6 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp
@@ -118,11 +118,11 @@ void *QWindowsLibEGL::resolve(const char *name)
bool QWindowsLibEGL::init()
{
-#ifdef QT_DEBUG
- const char dllName[] = "libEGLd.dll";
-#else
- const char dllName[] = "libEGL.dll";
+ const char dllName[] = QT_STRINGIFY(LIBEGL_NAME)
+#if defined(QT_DEBUG) && !defined(Q_OS_WINCE)
+ "d"
#endif
+ "";
qCDebug(lcQpaGl) << "Qt: Using EGL from" << dllName;
@@ -178,11 +178,12 @@ void *QWindowsLibGLESv2::resolve(const char *name)
bool QWindowsLibGLESv2::init()
{
-#ifdef QT_DEBUG
- const char dllName[] = "libGLESv2d.dll";
-#else
- const char dllName[] = "libGLESv2.dll";
+
+ const char dllName[] = QT_STRINGIFY(LIBGLESV2_NAME)
+#if defined(QT_DEBUG) && !defined(Q_OS_WINCE)
+ "d"
#endif
+ "";
qCDebug(lcQpaGl) << "Qt: Using OpenGL ES 2.0 from" << dllName;
#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index c31063e1fd..8d1bbc75a6 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -47,6 +47,7 @@
#include <QtCore/QFile>
#include <QtCore/QtEndian>
#include <QtCore/QThreadStorage>
+#include <QtCore/private/qsystemlibrary_p.h>
#include <wchar.h>
@@ -61,6 +62,38 @@
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_DIRECTWRITE
+// ### fixme: Consider direct linking of dwrite.dll once Windows Vista pre SP2 is dropped (QTBUG-49711)
+
+typedef HRESULT (WINAPI *DWriteCreateFactoryType)(DWRITE_FACTORY_TYPE, const IID &, IUnknown **);
+
+static inline DWriteCreateFactoryType resolveDWriteCreateFactory()
+{
+ if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA)
+ return Q_NULLPTR;
+ QSystemLibrary library(QStringLiteral("dwrite"));
+ QFunctionPointer result = library.resolve("DWriteCreateFactory");
+ if (Q_UNLIKELY(!result)) {
+ qWarning("Unable to load dwrite.dll");
+ return Q_NULLPTR;
+ }
+ return reinterpret_cast<DWriteCreateFactoryType>(result);
+}
+
+static IDWriteFactory *createDirectWriteFactory()
+{
+ static const DWriteCreateFactoryType dWriteCreateFactory = resolveDWriteCreateFactory();
+ if (!dWriteCreateFactory)
+ return Q_NULLPTR;
+ IUnknown *result = Q_NULLPTR;
+ if (FAILED(dWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), &result))) {
+ qErrnoWarning("DWriteCreateFactory failed");
+ return Q_NULLPTR;
+ }
+ return reinterpret_cast<IDWriteFactory *>(result);
+}
+#endif // !QT_NO_DIRECTWRITE
+
// Helper classes for creating font engines directly from font data
namespace {
@@ -467,14 +500,9 @@ namespace {
class CustomFontFileLoader
{
public:
- CustomFontFileLoader() : m_directWriteFactory(0), m_directWriteFontFileLoader(0)
+ CustomFontFileLoader() : m_directWriteFactory(createDirectWriteFactory()), m_directWriteFontFileLoader(0)
{
- HRESULT hres = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
- __uuidof(IDWriteFactory),
- reinterpret_cast<IUnknown **>(&m_directWriteFactory));
- if (FAILED(hres)) {
- qErrnoWarning(hres, "%s: DWriteCreateFactory failed.", __FUNCTION__);
- } else {
+ if (m_directWriteFactory) {
m_directWriteFontFileLoader = new DirectWriteFontFileLoader();
m_directWriteFactory->RegisterFontFileLoader(m_directWriteFontFileLoader);
}
@@ -572,15 +600,9 @@ qreal QWindowsFontDatabase::fontSmoothingGamma()
static inline bool initDirectWrite(QWindowsFontEngineData *d)
{
if (!d->directWriteFactory) {
- const HRESULT hr = DWriteCreateFactory(
- DWRITE_FACTORY_TYPE_SHARED,
- __uuidof(IDWriteFactory),
- reinterpret_cast<IUnknown **>(&d->directWriteFactory)
- );
- if (FAILED(hr)) {
- qErrnoWarning("%s: DWriteCreateFactory failed", __FUNCTION__);
+ d->directWriteFactory = createDirectWriteFactory();
+ if (!d->directWriteFactory)
return false;
- }
}
if (!d->directWriteGdiInterop) {
const HRESULT hr = d->directWriteFactory->GetGdiInterop(&d->directWriteGdiInterop);
@@ -1218,11 +1240,13 @@ QT_WARNING_POP
fontFile->Release();
- fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace, pixelSize,
+ fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace,
+ pixelSize,
fontEngineData);
// Get font family from font data
fontEngine->fontDef.family = font.familyName();
+ fontEngine->fontDef.hintingPreference = hintingPreference;
directWriteFontFace->Release();
}
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index b6bc65055f..41fa8c015d 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -1358,6 +1358,12 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at)
QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace,
fontEngine->fontDef.pixelSize,
data);
+ if (fontEngine->fontDef.weight > QFont::Normal)
+ fedw->fontDef.weight = fontEngine->fontDef.weight;
+ if (fontEngine->fontDef.style > QFont::StyleNormal)
+ fedw->fontDef.style = fontEngine->fontDef.style;
+ fedw->fontDef.family = fam;
+ fedw->fontDef.hintingPreference = fontEngine->fontDef.hintingPreference;
return fedw;
} else {
qErrnoWarning("%s: CreateFontFace failed", __FUNCTION__);
@@ -1369,7 +1375,14 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at)
// Get here if original font is not DirectWrite or DirectWrite creation failed for some
// reason
- return new QWindowsFontEngine(fam, lf, data);
+ QFontEngine *fe = new QWindowsFontEngine(fam, lf, data);
+ if (fontEngine->fontDef.weight > QFont::Normal)
+ fe->fontDef.weight = fontEngine->fontDef.weight;
+ if (fontEngine->fontDef.style > QFont::StyleNormal)
+ fe->fontDef.style = fontEngine->fontDef.style;
+ fe->fontDef.family = fam;
+ fe->fontDef.hintingPreference = fontEngine->fontDef.hintingPreference;
+ return fe;
}
bool QWindowsFontEngine::supportsTransformation(const QTransform &transform) const
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index 75449e22ed..593ac7d810 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -196,8 +196,8 @@ namespace {
*/
QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace,
- qreal pixelSize,
- const QSharedPointer<QWindowsFontEngineData> &d)
+ qreal pixelSize,
+ const QSharedPointer<QWindowsFontEngineData> &d)
: QFontEngine(DirectWrite)
, m_fontEngineData(d)
, m_directWriteFontFace(directWriteFontFace)
@@ -547,12 +547,17 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
transform.m21 = xform.m21();
transform.m22 = xform.m22();
+ DWRITE_RENDERING_MODE renderMode =
+ fontDef.hintingPreference == QFont::PreferNoHinting
+ ? DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC
+ : DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL;
+
IDWriteGlyphRunAnalysis *glyphAnalysis = NULL;
HRESULT hr = m_fontEngineData->directWriteFactory->CreateGlyphRunAnalysis(
&glyphRun,
1.0f,
&transform,
- DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC,
+ renderMode,
DWRITE_MEASURING_MODE_NATURAL,
0.0, 0.0,
&glyphAnalysis
@@ -626,7 +631,8 @@ QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t,
QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const
{
QFontEngine *fontEngine = new QWindowsFontEngineDirectWrite(m_directWriteFontFace,
- pixelSize, m_fontEngineData);
+ pixelSize,
+ m_fontEngineData);
fontEngine->fontDef = fontDef;
fontEngine->fontDef.pixelSize = pixelSize;
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index a06707b84c..8d33e2f0db 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -463,7 +463,7 @@ static int choosePixelFormat(HDC hdc, const QSurfaceFormat &format,
PIXELFORMATDESCRIPTOR *obtainedPfd)
{
if (QOpenGLStaticContext::opengl32.moduleIsNotOpengl32()) {
- qWarning("%s: Attempted to use GDI functions with a non-opengl32.dll library", Q_FUNC_INFO);
+ qWarning("Attempted to use GDI functions with a non-opengl32.dll library");
return 0;
}
@@ -1018,7 +1018,7 @@ QByteArray QOpenGLStaticContext::getGlString(unsigned int which)
QOpenGLStaticContext *QOpenGLStaticContext::create(bool softwareRendering)
{
if (!opengl32.init(softwareRendering)) {
- qWarning("%s: Failed to load and resolve WGL/OpenGL functions", Q_FUNC_INFO);
+ qWarning("Failed to load and resolve WGL/OpenGL functions");
return 0;
}
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 81525775c6..5f22ca1887 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -285,6 +285,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
return true;
case AllGLFunctionsQueryable:
return true;
+ case SwitchableWidgetComposition:
+ return true;
default:
return QPlatformIntegration::hasCapability(cap);
}
@@ -341,11 +343,18 @@ QWindowsWindow *QWindowsIntegration::createPlatformWindowHelper(QWindow *window,
QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate()
{
#if defined(QT_OPENGL_DYNAMIC)
+ const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers();
+
QWindowsOpenGLTester::Renderer requestedRenderer = QWindowsOpenGLTester::requestedRenderer();
switch (requestedRenderer) {
case QWindowsOpenGLTester::DesktopGl:
- if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create())
+ if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) {
+ if ((supportedRenderers & QWindowsOpenGLTester::DisableRotationFlag)
+ && !QWindowsScreen::setOrientationPreference(Qt::LandscapeOrientation)) {
+ qCWarning(lcQpaGl, "Unable to disable rotation.");
+ }
return glCtx;
+ }
qCWarning(lcQpaGl, "System OpenGL failed. Falling back to Software OpenGL.");
return QOpenGLStaticContext::create(true);
// If ANGLE is requested, use it, don't try anything else.
@@ -366,10 +375,14 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate()
break;
}
- const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers();
if (supportedRenderers & QWindowsOpenGLTester::DesktopGl) {
- if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create())
+ if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) {
+ if ((supportedRenderers & QWindowsOpenGLTester::DisableRotationFlag)
+ && !QWindowsScreen::setOrientationPreference(Qt::LandscapeOrientation)) {
+ qCWarning(lcQpaGl, "Unable to disable rotation.");
+ }
return glCtx;
+ }
}
if (QWindowsOpenGLTester::Renderers glesRenderers = supportedRenderers & QWindowsOpenGLTester::GlesMask) {
if (QWindowsEGLStaticContext *eglCtx = QWindowsEGLStaticContext::create(glesRenderers))
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index e32a7e32af..fcbe488f93 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -268,7 +268,10 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
result &= ~QWindowsOpenGLTester::AngleRendererD3d9;
}
}
-
+ if (features.contains(QStringLiteral("disable_rotation"))) {
+ qCDebug(lcQpaGl) << "Disabling rotation: " << gpu;
+ result |= DisableRotationFlag;
+ }
srCache->insert(qgpu, result);
return result;
#endif // !Q_OS_WINCE && !QT_NO_OPENGL
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h
index f22031aa4e..0fad3d960e 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.h
+++ b/src/plugins/platforms/windows/qwindowsopengltester.h
@@ -76,7 +76,9 @@ public:
AngleBackendMask = AngleRendererD3d11 | AngleRendererD3d9 | AngleRendererD3d11Warp,
Gles = 0x0010, // ANGLE/unspecified or Generic GLES for Windows CE.
GlesMask = Gles | AngleBackendMask,
- SoftwareRasterizer = 0x0020
+ SoftwareRasterizer = 0x0020,
+ RendererMask = 0x00FF,
+ DisableRotationFlag = 0x0100
};
Q_DECLARE_FLAGS(Renderers, Renderer)
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index e69665e4a9..02696c87cd 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -325,6 +325,74 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
}
}
+enum OrientationPreference // matching Win32 API ORIENTATION_PREFERENCE
+#if defined(Q_COMPILER_CLASS_ENUM) || defined(Q_CC_MSVC)
+ : DWORD
+#endif
+{
+ orientationPreferenceNone = 0,
+ orientationPreferenceLandscape = 0x1,
+ orientationPreferencePortrait = 0x2,
+ orientationPreferenceLandscapeFlipped = 0x4,
+ orientationPreferencePortraitFlipped = 0x8
+};
+
+bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o)
+{
+ bool result = false;
+#ifndef Q_OS_WINCE
+ if (QWindowsContext::user32dll.setDisplayAutoRotationPreferences) {
+ DWORD orientationPreference = 0;
+ switch (o) {
+ case Qt::PrimaryOrientation:
+ orientationPreference = orientationPreferenceNone;
+ break;
+ case Qt::PortraitOrientation:
+ orientationPreference = orientationPreferencePortrait;
+ break;
+ case Qt::LandscapeOrientation:
+ orientationPreference = orientationPreferenceLandscape;
+ break;
+ case Qt::InvertedPortraitOrientation:
+ orientationPreference = orientationPreferencePortraitFlipped;
+ break;
+ case Qt::InvertedLandscapeOrientation:
+ orientationPreference = orientationPreferenceLandscapeFlipped;
+ break;
+ }
+ result = QWindowsContext::user32dll.setDisplayAutoRotationPreferences(orientationPreference);
+ }
+#endif // !Q_OS_WINCE
+ return result;
+}
+
+Qt::ScreenOrientation QWindowsScreen::orientationPreference()
+{
+ Qt::ScreenOrientation result = Qt::PrimaryOrientation;
+#ifndef Q_OS_WINCE
+ if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences) {
+ DWORD orientationPreference = 0;
+ if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences(&orientationPreference)) {
+ switch (orientationPreference) {
+ case orientationPreferenceLandscape:
+ result = Qt::LandscapeOrientation;
+ break;
+ case orientationPreferencePortrait:
+ result = Qt::PortraitOrientation;
+ break;
+ case orientationPreferenceLandscapeFlipped:
+ result = Qt::InvertedLandscapeOrientation;
+ break;
+ case orientationPreferencePortraitFlipped:
+ result = Qt::InvertedPortraitOrientation;
+ break;
+ }
+ }
+ }
+#endif // !Q_OS_WINCE
+ return result;
+}
+
/*!
\brief Queries ClearType settings to check the pixel layout
*/
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index 879cda047e..b46bd88ec6 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -97,6 +97,9 @@ public:
QPixmap grabWindow(WId window, int qX, int qY, int qWidth, int qHeight) const Q_DECL_OVERRIDE;
QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const Q_DECL_OVERRIDE;
+ static Qt::ScreenOrientation orientationPreference();
+ static bool setOrientationPreference(Qt::ScreenOrientation o);
+
inline void handleChanges(const QWindowsScreenData &newData);
#ifndef QT_NO_CURSOR
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index c49682cc26..48484209b5 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1779,7 +1779,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
if ((oldState == Qt::WindowMinimized) != (newState == Qt::WindowMinimized)) {
if (visible)
ShowWindow(m_data.hwnd, (newState == Qt::WindowMinimized) ? SW_MINIMIZE :
- (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
+ (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNORMAL);
}
qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << this << window() << newState;
}
diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri
index 29297116da..67af5c03ef 100644
--- a/src/plugins/platforms/windows/windows.pri
+++ b/src/plugins/platforms/windows/windows.pri
@@ -13,7 +13,6 @@ wince: DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\""
DEFINES *= QT_NO_CAST_FROM_ASCII
contains(QT_CONFIG, directwrite) {
- LIBS *= -ldwrite
SOURCES += $$PWD/qwindowsfontenginedirectwrite.cpp
HEADERS += $$PWD/qwindowsfontenginedirectwrite.h
} else {
@@ -132,3 +131,6 @@ contains(QT_CONFIG, freetype) {
}
contains(QT_CONFIG, accessibility):include($$PWD/accessible/accessible.pri)
+
+DEFINES *= LIBEGL_NAME=$${LIBEGL_NAME}
+DEFINES *= LIBGLESV2_NAME=$${LIBGLESV2_NAME}