Windows QPA plugin: Use member initialization

Use C++ 11 member initialization in value-type structs.

Task-number: QTBUG-51673
Change-Id: I668389b4a0ad1d862a505b740d67357cb9c2a3dc
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
Friedemann Kleint 2016-11-24 15:48:34 +01:00
parent 39fc377bf1
commit 9ef93fa153
29 changed files with 120 additions and 224 deletions

View File

@ -149,8 +149,7 @@ static void cleanClipboardPostRoutine()
QWindowsClipboard *QWindowsClipboard::m_instance = 0; QWindowsClipboard *QWindowsClipboard::m_instance = 0;
QWindowsClipboard::QWindowsClipboard() : QWindowsClipboard::QWindowsClipboard()
m_data(0), m_clipboardViewer(0), m_nextClipboardViewer(0), m_formatListenerRegistered(false)
{ {
QWindowsClipboard::m_instance = this; QWindowsClipboard::m_instance = this;
qAddPostRoutine(cleanClipboardPostRoutine); qAddPostRoutine(cleanClipboardPostRoutine);

View File

@ -83,10 +83,10 @@ private:
static QWindowsClipboard *m_instance; static QWindowsClipboard *m_instance;
QWindowsClipboardRetrievalMimeData m_retrievalData; QWindowsClipboardRetrievalMimeData m_retrievalData;
QWindowsOleDataObject *m_data; QWindowsOleDataObject *m_data = nullptr;
HWND m_clipboardViewer; HWND m_clipboardViewer = 0;
HWND m_nextClipboardViewer; HWND m_nextClipboardViewer = 0;
bool m_formatListenerRegistered; bool m_formatListenerRegistered = false;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -165,15 +165,6 @@ static bool enableNonClientDpiScaling(HWND hwnd)
\internal \internal
\ingroup qt-lighthouse-win \ingroup qt-lighthouse-win
*/ */
QWindowsUser32DLL::QWindowsUser32DLL() :
isTouchWindow(0),
registerTouchWindow(0), unregisterTouchWindow(0),
getTouchInputInfo(0), closeTouchInputHandle(0), setProcessDPIAware(0),
addClipboardFormatListener(0), removeClipboardFormatListener(0),
getDisplayAutoRotationPreferences(0), setDisplayAutoRotationPreferences(0),
enableNonClientDpiScaling(0), getWindowDpiAwarenessContext(0), getAwarenessFromDpiAwarenessContext(0)
{
}
void QWindowsUser32DLL::init() void QWindowsUser32DLL::init()
{ {
@ -206,13 +197,6 @@ bool QWindowsUser32DLL::initTouch()
return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle; return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle;
} }
QWindowsShcoreDLL::QWindowsShcoreDLL()
: getProcessDpiAwareness(0)
, setProcessDpiAwareness(0)
, getDpiForMonitor(0)
{
}
void QWindowsShcoreDLL::init() void QWindowsShcoreDLL::init()
{ {
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1) if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1)
@ -241,14 +225,13 @@ QWindowsContext *QWindowsContext::m_instance = 0;
typedef QHash<HWND, QWindowsWindow *> HandleBaseWindowHash; typedef QHash<HWND, QWindowsWindow *> HandleBaseWindowHash;
struct QWindowsContextPrivate { struct QWindowsContextPrivate {
QWindowsContextPrivate(); QWindowsContextPrivate();
unsigned m_systemInfo; unsigned m_systemInfo = 0;
QSet<QString> m_registeredWindowClassNames; QSet<QString> m_registeredWindowClassNames;
HandleBaseWindowHash m_windows; HandleBaseWindowHash m_windows;
HDC m_displayContext; HDC m_displayContext = 0;
int m_defaultDPI; int m_defaultDPI = 96;
QWindowsKeyMapper m_keyMapper; QWindowsKeyMapper m_keyMapper;
QWindowsMouseHandler m_mouseHandler; QWindowsMouseHandler m_mouseHandler;
QWindowsMimeConverter m_mimeConverter; QWindowsMimeConverter m_mimeConverter;
@ -259,15 +242,13 @@ struct QWindowsContextPrivate {
#endif #endif
const HRESULT m_oleInitializeResult; const HRESULT m_oleInitializeResult;
const QByteArray m_eventType; const QByteArray m_eventType;
QWindow *m_lastActiveWindow; QWindow *m_lastActiveWindow = nullptr;
bool m_asyncExpose; bool m_asyncExpose = false;
}; };
QWindowsContextPrivate::QWindowsContextPrivate() QWindowsContextPrivate::QWindowsContextPrivate()
: m_systemInfo(0) : m_oleInitializeResult(OleInitialize(NULL))
, m_oleInitializeResult(OleInitialize(NULL))
, m_eventType(QByteArrayLiteral("windows_generic_MSG")) , m_eventType(QByteArrayLiteral("windows_generic_MSG"))
, m_lastActiveWindow(0), m_asyncExpose(0)
{ {
QWindowsContext::user32dll.init(); QWindowsContext::user32dll.init();
QWindowsContext::shcoredll.init(); QWindowsContext::shcoredll.init();

View File

@ -80,7 +80,6 @@ class QTouchDevice;
struct QWindowsUser32DLL struct QWindowsUser32DLL
{ {
QWindowsUser32DLL();
inline void init(); inline void init();
inline bool initTouch(); inline bool initTouch();
@ -99,32 +98,31 @@ struct QWindowsUser32DLL
typedef int (WINAPI *GetAwarenessFromDpiAwarenessContext)(int); typedef int (WINAPI *GetAwarenessFromDpiAwarenessContext)(int);
// Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC). // Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC).
IsTouchWindow isTouchWindow; IsTouchWindow isTouchWindow = nullptr;
RegisterTouchWindow registerTouchWindow; RegisterTouchWindow registerTouchWindow = nullptr;
UnregisterTouchWindow unregisterTouchWindow; UnregisterTouchWindow unregisterTouchWindow = nullptr;
GetTouchInputInfo getTouchInputInfo; GetTouchInputInfo getTouchInputInfo = nullptr;
CloseTouchInputHandle closeTouchInputHandle; CloseTouchInputHandle closeTouchInputHandle = nullptr;
// Windows Vista onwards // Windows Vista onwards
SetProcessDPIAware setProcessDPIAware; SetProcessDPIAware setProcessDPIAware = nullptr;
// Clipboard listeners are present on Windows Vista onwards // Clipboard listeners are present on Windows Vista onwards
// but missing in MinGW 4.9 stub libs. Can be removed in MinGW 5. // but missing in MinGW 4.9 stub libs. Can be removed in MinGW 5.
AddClipboardFormatListener addClipboardFormatListener; AddClipboardFormatListener addClipboardFormatListener = nullptr;
RemoveClipboardFormatListener removeClipboardFormatListener; RemoveClipboardFormatListener removeClipboardFormatListener = nullptr;
// Rotation API // Rotation API
GetDisplayAutoRotationPreferences getDisplayAutoRotationPreferences; GetDisplayAutoRotationPreferences getDisplayAutoRotationPreferences = nullptr;
SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences; SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences = nullptr;
EnableNonClientDpiScaling enableNonClientDpiScaling; EnableNonClientDpiScaling enableNonClientDpiScaling = nullptr;
GetWindowDpiAwarenessContext getWindowDpiAwarenessContext; GetWindowDpiAwarenessContext getWindowDpiAwarenessContext = nullptr;
GetAwarenessFromDpiAwarenessContext getAwarenessFromDpiAwarenessContext; GetAwarenessFromDpiAwarenessContext getAwarenessFromDpiAwarenessContext = nullptr;
}; };
// Shell scaling library (Windows 8.1 onwards) // Shell scaling library (Windows 8.1 onwards)
struct QWindowsShcoreDLL { struct QWindowsShcoreDLL {
QWindowsShcoreDLL();
void init(); void init();
inline bool isValid() const { return getProcessDpiAwareness && setProcessDpiAwareness && getDpiForMonitor; } inline bool isValid() const { return getProcessDpiAwareness && setProcessDpiAwareness && getDpiForMonitor; }
@ -132,9 +130,9 @@ struct QWindowsShcoreDLL {
typedef HRESULT (WINAPI *SetProcessDpiAwareness)(int); typedef HRESULT (WINAPI *SetProcessDpiAwareness)(int);
typedef HRESULT (WINAPI *GetDpiForMonitor)(HMONITOR,int,UINT *,UINT *); typedef HRESULT (WINAPI *GetDpiForMonitor)(HMONITOR,int,UINT *,UINT *);
GetProcessDpiAwareness getProcessDpiAwareness; GetProcessDpiAwareness getProcessDpiAwareness = nullptr;
SetProcessDpiAwareness setProcessDpiAwareness; SetProcessDpiAwareness setProcessDpiAwareness = nullptr;
GetDpiForMonitor getDpiForMonitor; GetDpiForMonitor getDpiForMonitor = nullptr;
}; };
class QWindowsContext class QWindowsContext

View File

@ -211,15 +211,6 @@ private:
\ingroup qt-lighthouse-win \ingroup qt-lighthouse-win
*/ */
template <class BaseClass>
QWindowsDialogHelperBase<BaseClass>::QWindowsDialogHelperBase() :
m_nativeDialog(0),
m_ownerWindow(0),
m_timerId(0),
m_thread(0)
{
}
template <class BaseClass> template <class BaseClass>
void QWindowsDialogHelperBase<BaseClass>::cleanupThread() void QWindowsDialogHelperBase<BaseClass>::cleanupThread()
{ {
@ -549,11 +540,11 @@ public:
IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) { return S_OK; } IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) { return S_OK; }
QWindowsNativeFileDialogEventHandler(QWindowsNativeFileDialogBase *nativeFileDialog) : QWindowsNativeFileDialogEventHandler(QWindowsNativeFileDialogBase *nativeFileDialog) :
m_ref(1), m_nativeFileDialog(nativeFileDialog) {} m_nativeFileDialog(nativeFileDialog) {}
virtual ~QWindowsNativeFileDialogEventHandler() {} virtual ~QWindowsNativeFileDialogEventHandler() {}
private: private:
long m_ref; long m_ref = 1;
QWindowsNativeFileDialogBase *m_nativeFileDialog; QWindowsNativeFileDialogBase *m_nativeFileDialog;
}; };
@ -641,19 +632,18 @@ protected:
QWindowsFileDialogSharedData &data() { return m_data; } QWindowsFileDialogSharedData &data() { return m_data; }
private: private:
IFileDialog *m_fileDialog; IFileDialog *m_fileDialog = nullptr;
IFileDialogEvents *m_dialogEvents; IFileDialogEvents *m_dialogEvents = nullptr;
DWORD m_cookie; DWORD m_cookie = 0;
QStringList m_nameFilters; QStringList m_nameFilters;
bool m_hideFiltersDetails; bool m_hideFiltersDetails = false;
bool m_hasDefaultSuffix; bool m_hasDefaultSuffix = false;
QWindowsFileDialogSharedData m_data; QWindowsFileDialogSharedData m_data;
QString m_title; QString m_title;
}; };
QWindowsNativeFileDialogBase::QWindowsNativeFileDialogBase(const QWindowsFileDialogSharedData &data) : QWindowsNativeFileDialogBase::QWindowsNativeFileDialogBase(const QWindowsFileDialogSharedData &data) :
m_fileDialog(0), m_dialogEvents(0), m_cookie(0), m_hideFiltersDetails(false), m_data(data)
m_hasDefaultSuffix(false), m_data(data)
{ {
} }

View File

@ -78,7 +78,7 @@ public:
virtual bool supportsNonModalDialog(const QWindow * /* parent */ = 0) const { return true; } virtual bool supportsNonModalDialog(const QWindow * /* parent */ = 0) const { return true; }
protected: protected:
QWindowsDialogHelperBase(); QWindowsDialogHelperBase() {}
QWindowsNativeDialogBase *nativeDialog() const; QWindowsNativeDialogBase *nativeDialog() const;
inline bool hasNativeDialog() const { return m_nativeDialog; } inline bool hasNativeDialog() const { return m_nativeDialog; }
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
@ -91,9 +91,9 @@ private:
void cleanupThread(); void cleanupThread();
QWindowsNativeDialogBasePtr m_nativeDialog; QWindowsNativeDialogBasePtr m_nativeDialog;
HWND m_ownerWindow; HWND m_ownerWindow = 0;
int m_timerId; int m_timerId = 0;
QThread *m_thread; QThread *m_thread = nullptr;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -494,8 +494,7 @@ QWindowsOleDropSource::GiveFeedback(DWORD dwEffect)
\ingroup qt-lighthouse-win \ingroup qt-lighthouse-win
*/ */
QWindowsOleDropTarget::QWindowsOleDropTarget(QWindow *w) : QWindowsOleDropTarget::QWindowsOleDropTarget(QWindow *w) : m_window(w)
m_refs(1), m_window(w), m_chosenEffect(0), m_lastKeyState(0)
{ {
qCDebug(lcQpaMime) << __FUNCTION__ << this << w; qCDebug(lcQpaMime) << __FUNCTION__ << this << w;
} }
@ -687,10 +686,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
bool QWindowsDrag::m_canceled = false; bool QWindowsDrag::m_canceled = false;
QWindowsDrag::QWindowsDrag() : QWindowsDrag::QWindowsDrag() = default;
m_dropDataObject(0), m_cachedDropTargetHelper(0)
{
}
QWindowsDrag::~QWindowsDrag() QWindowsDrag::~QWindowsDrag()
{ {

View File

@ -77,12 +77,12 @@ public:
private: private:
void handleDrag(QWindow *window, DWORD grfKeyState, const QPoint &, LPDWORD pdwEffect); void handleDrag(QWindow *window, DWORD grfKeyState, const QPoint &, LPDWORD pdwEffect);
ULONG m_refs; ULONG m_refs = 1;
QWindow *const m_window; QWindow *const m_window;
QRect m_answerRect; QRect m_answerRect;
QPoint m_lastPoint; QPoint m_lastPoint;
DWORD m_chosenEffect; DWORD m_chosenEffect = 0;
DWORD m_lastKeyState; DWORD m_lastKeyState = 0;
}; };
class QWindowsDrag : public QPlatformDrag class QWindowsDrag : public QPlatformDrag
@ -110,9 +110,9 @@ private:
static bool m_canceled; static bool m_canceled;
QWindowsDropMimeData m_dropData; QWindowsDropMimeData m_dropData;
IDataObject *m_dropDataObject; IDataObject *m_dropDataObject = nullptr;
IDropTargetHelper* m_cachedDropTargetHelper; IDropTargetHelper* m_cachedDropTargetHelper = nullptr;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -384,8 +384,6 @@ QWindowsEGLContext::QWindowsEGLContext(QWindowsEGLStaticContext *staticContext,
QPlatformOpenGLContext *share) QPlatformOpenGLContext *share)
: m_staticContext(staticContext) : m_staticContext(staticContext)
, m_eglDisplay(staticContext->display()) , m_eglDisplay(staticContext->display())
, m_api(EGL_OPENGL_ES_API)
, m_swapInterval(-1)
{ {
if (!m_staticContext) if (!m_staticContext)
return; return;

View File

@ -167,8 +167,8 @@ private:
EGLDisplay m_eglDisplay; EGLDisplay m_eglDisplay;
EGLConfig m_eglConfig; EGLConfig m_eglConfig;
QSurfaceFormat m_format; QSurfaceFormat m_format;
EGLenum m_api; EGLenum m_api = EGL_OPENGL_ES_API;
int m_swapInterval; int m_swapInterval = -1;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -825,13 +825,6 @@ static inline QOpenGLContextData createDummyWindowOpenGLContextData()
\ingroup qt-lighthouse-win \ingroup qt-lighthouse-win
*/ */
QWindowsOpenGLContextFormat::QWindowsOpenGLContextFormat() :
profile(QSurfaceFormat::NoProfile),
version(0),
options(0)
{
}
QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current() QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current()
{ {
QWindowsOpenGLContextFormat result; QWindowsOpenGLContextFormat result;

View File

@ -72,24 +72,23 @@ struct QWindowsOpenGLAdditionalFormat
struct QOpenGLContextData struct QOpenGLContextData
{ {
QOpenGLContextData(HGLRC r, HWND h, HDC d) : renderingContext(r), hwnd(h), hdc(d) {} QOpenGLContextData(HGLRC r, HWND h, HDC d) : renderingContext(r), hwnd(h), hdc(d) {}
QOpenGLContextData() : renderingContext(0), hwnd(0), hdc(0) {} QOpenGLContextData() {}
HGLRC renderingContext; HGLRC renderingContext = 0;
HWND hwnd; HWND hwnd = 0;
HDC hdc; HDC hdc = 0;
}; };
class QOpenGLStaticContext; class QOpenGLStaticContext;
struct QWindowsOpenGLContextFormat struct QWindowsOpenGLContextFormat
{ {
QWindowsOpenGLContextFormat();
static QWindowsOpenGLContextFormat current(); static QWindowsOpenGLContextFormat current();
void apply(QSurfaceFormat *format) const; void apply(QSurfaceFormat *format) const;
QSurfaceFormat::OpenGLContextProfile profile; QSurfaceFormat::OpenGLContextProfile profile = QSurfaceFormat::NoProfile;
int version; //! majorVersion<<8 + minorVersion int version = 0; //! majorVersion<<8 + minorVersion
QSurfaceFormat::FormatOptions options; QSurfaceFormat::FormatOptions options = 0;
}; };
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM

View File

@ -166,15 +166,8 @@ Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id); // from qlocale_win.cpp
HIMC QWindowsInputContext::m_defaultContext = 0; HIMC QWindowsInputContext::m_defaultContext = 0;
QWindowsInputContext::CompositionContext::CompositionContext() :
hwnd(0), haveCaret(false), position(0), isComposing(false),
factor(1)
{
}
QWindowsInputContext::QWindowsInputContext() : QWindowsInputContext::QWindowsInputContext() :
m_WM_MSIME_MOUSE(RegisterWindowMessage(L"MSIMEMouseOperation")), m_WM_MSIME_MOUSE(RegisterWindowMessage(L"MSIMEMouseOperation")),
m_endCompositionRecursionGuard(false),
m_languageId(currentInputLanguageId()), m_languageId(currentInputLanguageId()),
m_locale(qt_localeFromLCID(m_languageId)) m_locale(qt_localeFromLCID(m_languageId))
{ {

View File

@ -57,15 +57,13 @@ class QWindowsInputContext : public QPlatformInputContext
struct CompositionContext struct CompositionContext
{ {
CompositionContext(); HWND hwnd = 0;
bool haveCaret = false;
HWND hwnd;
bool haveCaret;
QString composition; QString composition;
int position; int position = 0;
bool isComposing; bool isComposing = false;
QPointer<QObject> focusObject; QPointer<QObject> focusObject;
qreal factor; qreal factor = 1;
}; };
public: public:
explicit QWindowsInputContext(); explicit QWindowsInputContext();
@ -104,7 +102,7 @@ private:
const DWORD m_WM_MSIME_MOUSE; const DWORD m_WM_MSIME_MOUSE;
static HIMC m_defaultContext; static HIMC m_defaultContext;
CompositionContext m_compositionContext; CompositionContext m_compositionContext;
bool m_endCompositionRecursionGuard; bool m_endCompositionRecursionGuard = false;
LCID m_languageId; LCID m_languageId;
QLocale m_locale; QLocale m_locale;
}; };

View File

@ -128,9 +128,9 @@ struct QWindowsIntegrationPrivate
explicit QWindowsIntegrationPrivate(const QStringList &paramList); explicit QWindowsIntegrationPrivate(const QStringList &paramList);
~QWindowsIntegrationPrivate(); ~QWindowsIntegrationPrivate();
unsigned m_options; unsigned m_options = 0;
QWindowsContext m_context; QWindowsContext m_context;
QPlatformFontDatabase *m_fontDatabase; QPlatformFontDatabase *m_fontDatabase = nullptr;
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
QWindowsClipboard m_clipboard; QWindowsClipboard m_clipboard;
# ifndef QT_NO_DRAGANDDROP # ifndef QT_NO_DRAGANDDROP
@ -208,8 +208,6 @@ static inline unsigned parseOptions(const QStringList &paramList,
} }
QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramList) QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramList)
: m_options(0)
, m_fontDatabase(0)
{ {
Q_INIT_RESOURCE(openglblacklists); Q_INIT_RESOURCE(openglblacklists);

View File

@ -144,13 +144,11 @@ struct KeyRecord {
static const int QT_MAX_KEY_RECORDINGS = 64; // User has LOTS of fingers... static const int QT_MAX_KEY_RECORDINGS = 64; // User has LOTS of fingers...
struct KeyRecorder struct KeyRecorder
{ {
KeyRecorder() : nrecs(0) {}
inline KeyRecord *findKey(int code, bool remove); inline KeyRecord *findKey(int code, bool remove);
inline void storeKey(int code, int ascii, int state, const QString& text); inline void storeKey(int code, int ascii, int state, const QString& text);
inline void clearKeys(); inline void clearKeys();
int nrecs; int nrecs = 0;
KeyRecord deleted_record; // A copy of last entry removed from records[] KeyRecord deleted_record; // A copy of last entry removed from records[]
KeyRecord records[QT_MAX_KEY_RECORDINGS]; KeyRecord records[QT_MAX_KEY_RECORDINGS];
}; };

View File

@ -1496,9 +1496,7 @@ QString QLastResortMimes::mimeForFormat(const FORMATETC &formatetc) const
\sa QWindowsMime \sa QWindowsMime
*/ */
QWindowsMimeConverter::QWindowsMimeConverter() : m_internalMimeCount(0) QWindowsMimeConverter::QWindowsMimeConverter() = default;
{
}
QWindowsMimeConverter::~QWindowsMimeConverter() QWindowsMimeConverter::~QWindowsMimeConverter()
{ {

View File

@ -96,7 +96,7 @@ private:
void ensureInitialized() const; void ensureInitialized() const;
mutable QList<QWindowsMime *> m_mimes; mutable QList<QWindowsMime *> m_mimes;
mutable int m_internalMimeCount; mutable int m_internalMimeCount = 0;
}; };
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM

View File

@ -185,14 +185,7 @@ static inline QTouchDevice *createTouchDevice()
\ingroup qt-lighthouse-win \ingroup qt-lighthouse-win
*/ */
QWindowsMouseHandler::QWindowsMouseHandler() : QWindowsMouseHandler::QWindowsMouseHandler() = default;
m_windowUnderMouse(0),
m_trackedWindow(0),
m_touchDevice(Q_NULLPTR),
m_leftButtonDown(false),
m_previousCaptureWindow(0)
{
}
QTouchDevice *QWindowsMouseHandler::ensureTouchDevice() QTouchDevice *QWindowsMouseHandler::ensureTouchDevice()
{ {

View File

@ -74,9 +74,8 @@ QT_BEGIN_NAMESPACE
*/ */
QWindowsOleDataObject::QWindowsOleDataObject(QMimeData *mimeData) : QWindowsOleDataObject::QWindowsOleDataObject(QMimeData *mimeData) :
m_refs(1), data(mimeData), data(mimeData),
CF_PERFORMEDDROPEFFECT(RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT)), CF_PERFORMEDDROPEFFECT(RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT))
performedEffect(DROPEFFECT_NONE)
{ {
qCDebug(lcQpaMime) << __FUNCTION__ << mimeData->formats(); qCDebug(lcQpaMime) << __FUNCTION__ << mimeData->formats();
} }
@ -267,8 +266,7 @@ QWindowsOleDataObject::EnumDAdvise(LPENUMSTATDATA FAR*)
\ingroup qt-lighthouse-win \ingroup qt-lighthouse-win
*/ */
QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<FORMATETC> &fmtetcs) : QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<FORMATETC> &fmtetcs)
m_dwRefs(1), m_nIndex(0), m_isNull(false)
{ {
if (QWindowsContext::verbose > 1) if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__ << fmtetcs; qCDebug(lcQpaMime) << __FUNCTION__ << fmtetcs;
@ -285,8 +283,7 @@ QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<FORMATETC> &fmtetcs)
} }
} }
QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<LPFORMATETC> &lpfmtetcs) : QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<LPFORMATETC> &lpfmtetcs)
m_dwRefs(1), m_nIndex(0), m_isNull(false)
{ {
if (QWindowsContext::verbose > 1) if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__; qCDebug(lcQpaMime) << __FUNCTION__;

View File

@ -82,10 +82,10 @@ public:
STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR* ppenumAdvise); STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR* ppenumAdvise);
private: private:
ULONG m_refs; ULONG m_refs = 1;
QPointer<QMimeData> data; QPointer<QMimeData> data;
int CF_PERFORMEDDROPEFFECT; const int CF_PERFORMEDDROPEFFECT;
DWORD performedEffect; DWORD performedEffect = DROPEFFECT_NONE;
}; };
class QWindowsOleEnumFmtEtc : public IEnumFORMATETC class QWindowsOleEnumFmtEtc : public IEnumFORMATETC
@ -111,10 +111,10 @@ public:
private: private:
bool copyFormatEtc(LPFORMATETC dest, const FORMATETC *src) const; bool copyFormatEtc(LPFORMATETC dest, const FORMATETC *src) const;
ULONG m_dwRefs; ULONG m_dwRefs = 1;
ULONG m_nIndex; ULONG m_nIndex = 0;
QVector<LPFORMATETC> m_lpfmtetcs; QVector<LPFORMATETC> m_lpfmtetcs;
bool m_isNull; bool m_isNull = false;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -51,16 +51,14 @@ class QVariant;
struct GpuDescription struct GpuDescription
{ {
GpuDescription() : vendorId(0), deviceId(0), revision(0), subSysId(0) {}
static GpuDescription detect(); static GpuDescription detect();
QString toString() const; QString toString() const;
QVariant toVariant() const; QVariant toVariant() const;
uint vendorId; uint vendorId = 0;
uint deviceId; uint deviceId = 0;
uint revision; uint revision = 0;
uint subSysId; uint subSysId = 0;
QVersionNumber driverVersion; QVersionNumber driverVersion;
QByteArray driverName; QByteArray driverName;
QByteArray description; QByteArray description;

View File

@ -56,13 +56,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QWindowsScreenData::QWindowsScreenData() :
dpi(96, 96), depth(32), format(QImage::Format_ARGB32_Premultiplied),
flags(VirtualDesktop), orientation(Qt::LandscapeOrientation),
refreshRateHz(60)
{
}
static inline QDpi deviceDPI(HDC hdc) static inline QDpi deviceDPI(HDC hdc)
{ {
return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY));
@ -407,10 +400,7 @@ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTy
\ingroup qt-lighthouse-win \ingroup qt-lighthouse-win
*/ */
QWindowsScreenManager::QWindowsScreenManager() : QWindowsScreenManager::QWindowsScreenManager() = default;
m_lastDepth(-1), m_lastHorizontalResolution(0), m_lastVerticalResolution(0)
{
}
/*! /*!
\brief Triggers synchronization of screens (WM_DISPLAYCHANGE). \brief Triggers synchronization of screens (WM_DISPLAYCHANGE).

View File

@ -59,18 +59,16 @@ struct QWindowsScreenData
LockScreen = 0x4 // Temporary screen existing during user change, etc. LockScreen = 0x4 // Temporary screen existing during user change, etc.
}; };
QWindowsScreenData();
QRect geometry; QRect geometry;
QRect availableGeometry; QRect availableGeometry;
QDpi dpi; QDpi dpi{96, 96};
QSizeF physicalSizeMM; QSizeF physicalSizeMM;
int depth; int depth = 32;
QImage::Format format; QImage::Format format = QImage::Format_ARGB32_Premultiplied;
unsigned flags; unsigned flags = VirtualDesktop;
QString name; QString name;
Qt::ScreenOrientation orientation; Qt::ScreenOrientation orientation = Qt::LandscapeOrientation;
qreal refreshRateHz; qreal refreshRateHz = 60;
}; };
class QWindowsScreen : public QPlatformScreen class QWindowsScreen : public QPlatformScreen
@ -140,9 +138,9 @@ private:
void removeScreen(int index); void removeScreen(int index);
WindowsScreenList m_screens; WindowsScreenList m_screens;
int m_lastDepth; int m_lastDepth = -1;
WORD m_lastHorizontalResolution; WORD m_lastHorizontalResolution = 0;
WORD m_lastVerticalResolution; WORD m_lastVerticalResolution = 0;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -44,9 +44,6 @@ QT_BEGIN_NAMESPACE
QWindowsSessionManager::QWindowsSessionManager(const QString &id, const QString &key) QWindowsSessionManager::QWindowsSessionManager(const QString &id, const QString &key)
: QPlatformSessionManager(id, key) : QPlatformSessionManager(id, key)
, m_isActive(false)
, m_blockUserInput(false)
, m_canceled(false)
{ {
} }

View File

@ -75,9 +75,9 @@ public:
bool isActive() const { return m_isActive;} bool isActive() const { return m_isActive;}
private: private:
bool m_isActive; bool m_isActive = false;
bool m_blockUserInput; bool m_blockUserInput = false;
bool m_canceled; bool m_canceled = false;
Q_DISABLE_COPY(QWindowsSessionManager) Q_DISABLE_COPY(QWindowsSessionManager)
}; };

View File

@ -57,9 +57,6 @@ class QRect;
struct QWindowsWinTab32DLL struct QWindowsWinTab32DLL
{ {
QWindowsWinTab32DLL() : wTOpen(0), wTClose(0), wTInfo(0), wTEnable(0), wTOverlap(0), wTPacketsGet(0), wTGet(0),
wTQueueSizeGet(0), wTQueueSizeSet(0) {}
bool init(); bool init();
typedef HCTX (API *PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL); typedef HCTX (API *PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL);
@ -72,15 +69,15 @@ struct QWindowsWinTab32DLL
typedef int (API *PtrWTQueueSizeGet)(HCTX); typedef int (API *PtrWTQueueSizeGet)(HCTX);
typedef BOOL (API *PtrWTQueueSizeSet)(HCTX, int); typedef BOOL (API *PtrWTQueueSizeSet)(HCTX, int);
PtrWTOpen wTOpen; PtrWTOpen wTOpen = nullptr;
PtrWTClose wTClose; PtrWTClose wTClose = nullptr;
PtrWTInfo wTInfo; PtrWTInfo wTInfo = nullptr;
PtrWTEnable wTEnable; PtrWTEnable wTEnable = nullptr;
PtrWTOverlap wTOverlap; PtrWTOverlap wTOverlap = nullptr;
PtrWTPacketsGet wTPacketsGet; PtrWTPacketsGet wTPacketsGet = nullptr;
PtrWTGet wTGet; PtrWTGet wTGet = nullptr;
PtrWTQueueSizeGet wTQueueSizeGet; PtrWTQueueSizeGet wTQueueSizeGet = nullptr;
PtrWTQueueSizeSet wTQueueSizeSet; PtrWTQueueSizeSet wTQueueSizeSet = nullptr;
}; };
struct QWindowsTabletDeviceData struct QWindowsTabletDeviceData

View File

@ -977,9 +977,7 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w,
DWORD style_, DWORD exStyle_) : DWORD style_, DWORD exStyle_) :
geometryHint(w, cm), window(w), style(style_), exStyle(exStyle_), geometryHint(w, cm), window(w), style(style_), exStyle(exStyle_),
requestedGeometry(geometry), obtainedGeometry(geometry), requestedGeometry(geometry), obtainedGeometry(geometry),
margins(QWindowsGeometryHint::frame(style, exStyle)), customMargins(cm), margins(QWindowsGeometryHint::frame(style, exStyle)), customMargins(cm)
frameX(CW_USEDEFAULT), frameY(CW_USEDEFAULT),
frameWidth(CW_USEDEFAULT), frameHeight(CW_USEDEFAULT)
{ {
// Geometry of toplevels does not consider window frames. // Geometry of toplevels does not consider window frames.
// TODO: No concept of WA_wasMoved yet that would indicate a // TODO: No concept of WA_wasMoved yet that would indicate a
@ -1032,17 +1030,8 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w,
QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) : QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) :
QWindowsBaseWindow(aWindow), QWindowsBaseWindow(aWindow),
m_data(data), m_data(data),
m_flags(WithinCreate),
m_hdc(0),
m_windowState(Qt::WindowNoState),
m_opacity(1.0),
m_cursor(new CursorHandle), m_cursor(new CursorHandle),
m_dropTarget(0), m_format(aWindow->requestedFormat())
m_savedStyle(0),
m_format(aWindow->requestedFormat()),
m_iconSmall(0),
m_iconBig(0),
m_surface(0)
{ {
// Clear the creation context as the window can be found in QWindowsContext's map. // Clear the creation context as the window can be found in QWindowsContext's map.
QWindowsContext::instance()->setWindowCreationContext(QSharedPointer<QWindowCreationContext>()); QWindowsContext::instance()->setWindowCreationContext(QSharedPointer<QWindowCreationContext>());

View File

@ -89,22 +89,20 @@ struct QWindowCreationContext
QRect obtainedGeometry; QRect obtainedGeometry;
QMargins margins; QMargins margins;
QMargins customMargins; // User-defined, additional frame for WM_NCCALCSIZE QMargins customMargins; // User-defined, additional frame for WM_NCCALCSIZE
int frameX; // Passed on to CreateWindowEx(), including frame. int frameX = CW_USEDEFAULT; // Passed on to CreateWindowEx(), including frame.
int frameY; int frameY = CW_USEDEFAULT;
int frameWidth; int frameWidth = CW_USEDEFAULT;
int frameHeight; int frameHeight = CW_USEDEFAULT;
}; };
struct QWindowsWindowData struct QWindowsWindowData
{ {
QWindowsWindowData() : hwnd(0), embedded(false) {}
Qt::WindowFlags flags; Qt::WindowFlags flags;
QRect geometry; QRect geometry;
QMargins frame; // Do not use directly for windows, see FrameDirty. QMargins frame; // Do not use directly for windows, see FrameDirty.
QMargins customMargins; // User-defined, additional frame for NCCALCSIZE QMargins customMargins; // User-defined, additional frame for NCCALCSIZE
HWND hwnd; HWND hwnd = 0;
bool embedded; bool embedded = false;
static QWindowsWindowData create(const QWindow *w, static QWindowsWindowData create(const QWindow *w,
const QWindowsWindowData &parameters, const QWindowsWindowData &parameters,
@ -335,20 +333,20 @@ private:
void fireExpose(const QRegion &region, bool force=false); void fireExpose(const QRegion &region, bool force=false);
mutable QWindowsWindowData m_data; mutable QWindowsWindowData m_data;
mutable unsigned m_flags; mutable unsigned m_flags = WithinCreate;
HDC m_hdc; HDC m_hdc = 0;
Qt::WindowState m_windowState; Qt::WindowState m_windowState = Qt::WindowNoState;
qreal m_opacity; qreal m_opacity = 1;
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
CursorHandlePtr m_cursor; CursorHandlePtr m_cursor;
#endif #endif
QWindowsOleDropTarget *m_dropTarget; QWindowsOleDropTarget *m_dropTarget = nullptr;
unsigned m_savedStyle; unsigned m_savedStyle = 0;
QRect m_savedFrameGeometry; QRect m_savedFrameGeometry;
const QSurfaceFormat m_format; const QSurfaceFormat m_format;
HICON m_iconSmall; HICON m_iconSmall = 0;
HICON m_iconBig; HICON m_iconBig = 0;
void *m_surface; void *m_surface = nullptr;
}; };
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM