From 61d50cbc96e5331218a6a4e5614f50211f06c718 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Jan 2019 08:54:38 +0100 Subject: Windows/Direct2d QPA: Use nullptr Change-Id: I6ce01caa58de78e0eb61e243ee1e7b05cc1f5568 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowswindow.cpp | 52 ++++++++++++------------ 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 54a4f237ff..c5d57be2ad 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -347,7 +347,7 @@ static bool applyBlurBehindWindow(HWND hwnd) if (DwmIsCompositionEnabled(&compositionEnabled) != S_OK) return false; - DWM_BLURBEHIND blurBehind = {0, 0, 0, 0}; + DWM_BLURBEHIND blurBehind = {0, 0, nullptr, 0}; if (compositionEnabled) { blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; @@ -403,12 +403,12 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bo if (hasAlpha && !accelerated && (flags & Qt::FramelessWindowHint)) { // Non-GL windows with alpha: Use blend function to update. BLENDFUNCTION blend = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA}; - UpdateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); + UpdateLayeredWindow(hwnd, nullptr, nullptr, nullptr, nullptr, nullptr, 0, &blend, ULW_ALPHA); } else { SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA); } } else if (IsWindowVisible(hwnd)) { // Repaint when switching from layered. - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); } } @@ -764,7 +764,7 @@ QWindowsWindowData style, pos.x(), pos.y(), context->frameWidth, context->frameHeight, - parentHandle, NULL, appinst, NULL); + parentHandle, nullptr, appinst, nullptr); qCDebug(lcQpaWindows).nospace() << "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: " << context->obtainedGeometry << ' ' << context->margins; @@ -898,7 +898,7 @@ bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, co ncp->rgrc[0].top += customMargins.top(); ncp->rgrc[0].right -= customMargins.right(); ncp->rgrc[0].bottom -= customMargins.bottom(); - result = 0; + result = nullptr; qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << oldClientArea << '+' << customMargins << "-->" << ncp->rgrc[0] << ' ' << ncp->rgrc[1] << ' ' << ncp->rgrc[2] << ' ' << ncp->lppos->cx << ',' << ncp->lppos->cy; @@ -973,7 +973,7 @@ QWindowsBaseWindow *QWindowsBaseWindow::baseWindowOf(const QWindow *w) HWND QWindowsBaseWindow::handleOf(const QWindow *w) { const QWindowsBaseWindow *bw = QWindowsBaseWindow::baseWindowOf(w); - return bw ? bw->handle() : HWND(0); + return bw ? bw->handle() : HWND(nullptr); } bool QWindowsBaseWindow::isTopLevel_sys() const @@ -999,7 +999,7 @@ QMargins QWindowsBaseWindow::frameMargins_sys() const void QWindowsBaseWindow::hide_sys() // Normal hide, do not activate other windows. { - SetWindowPos(handle(),0 , 0, 0, 0, 0, + SetWindowPos(handle(), nullptr , 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } @@ -1068,7 +1068,7 @@ QWindowsForeignWindow::QWindowsForeignWindow(QWindow *window, HWND hwnd) void QWindowsForeignWindow::setParent(const QPlatformWindow *newParentWindow) { const bool wasTopLevel = isTopLevel_sys(); - const HWND newParent = newParentWindow ? reinterpret_cast(newParentWindow->winId()) : HWND(0); + const HWND newParent = newParentWindow ? reinterpret_cast(newParentWindow->winId()) : HWND(nullptr); const bool isTopLevel = !newParent; const DWORD oldStyle = style(); qCDebug(lcQpaWindows) << __FUNCTION__ << window() << "newParent=" @@ -1299,7 +1299,7 @@ void QWindowsWindow::destroyWindow() #endif DestroyWindow(m_data.hwnd); context->removeWindow(m_data.hwnd); - m_data.hwnd = 0; + m_data.hwnd = nullptr; } } @@ -1348,7 +1348,7 @@ void QWindowsWindow::setDropSiteEnabled(bool dropEnabled) CoLockObjectExternal(m_dropTarget, false, true); m_dropTarget->Release(); RevokeDragDrop(m_data.hwnd); - m_dropTarget = 0; + m_dropTarget = nullptr; } #endif // QT_CONFIG(clipboard) && QT_CONFIG(draganddrop) } @@ -1491,7 +1491,7 @@ void QWindowsWindow::updateTransientParent() const return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow(). // Update transient parent. const HWND oldTransientParent = GetWindow(m_data.hwnd, GW_OWNER); - HWND newTransientParent = 0; + HWND newTransientParent = nullptr; if (const QWindow *tp = window()->transientParent()) if (const QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(tp)) if (!tw->testFlag(WithinDestroy)) // Prevent destruction by parent window (QTBUG-35499, QTBUG-36666) @@ -1584,7 +1584,7 @@ void QWindowsWindow::show_sys() const if (fakedMaximize) { setStyle(style() & ~WS_MAXIMIZEBOX); - SetWindowPos(m_data.hwnd, 0, 0, 0, 0, 0, + SetWindowPos(m_data.hwnd, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); } @@ -1604,7 +1604,7 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) { // Use GetAncestor instead of GetParent, as GetParent can return owner window for toplevels HWND oldParentHWND = parentHwnd(); - HWND newParentHWND = 0; + HWND newParentHWND = nullptr; if (parent) { const QWindowsWindow *parentW = static_cast(parent); newParentHWND = parentW->handle(); @@ -1614,13 +1614,13 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) // NULL handle means desktop window, which also has its proper handle -> disambiguate HWND desktopHwnd = GetDesktopWindow(); if (oldParentHWND == desktopHwnd) - oldParentHWND = 0; + oldParentHWND = nullptr; if (newParentHWND == desktopHwnd) - newParentHWND = 0; + newParentHWND = nullptr; if (newParentHWND != oldParentHWND) { - const bool wasTopLevel = oldParentHWND == 0; - const bool isTopLevel = newParentHWND == 0; + const bool wasTopLevel = oldParentHWND == nullptr; + const bool isTopLevel = newParentHWND == nullptr; setFlag(WithinSetParent); SetParent(m_data.hwnd, newParentHWND); @@ -1847,7 +1847,7 @@ void QWindowsWindow::releaseDC() { if (m_hdc) { ReleaseDC(handle(), m_hdc); - m_hdc = 0; + m_hdc = nullptr; } } @@ -1881,7 +1881,7 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, // GL software rendering (QTBUG-58178) and Windows 7/Aero off with some AMD cards // (QTBUG-60527) need InvalidateRect() to suppress artifacts while resizing. if (testFlag(OpenGLSurface) && (isSoftwareGl() || !dwmIsCompositionEnabled())) - InvalidateRect(hwnd, 0, false); + InvalidateRect(hwnd, nullptr, false); BeginPaint(hwnd, &ps); @@ -1889,7 +1889,7 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, if (Q_UNLIKELY(!dwmIsCompositionEnabled()) && ((testFlag(OpenGLSurface) && testFlag(OpenGLDoubleBuffered)) || testFlag(VulkanSurface))) { - SelectClipRgn(ps.hdc, NULL); + SelectClipRgn(ps.hdc, nullptr); } // If the a window is obscured by another window (such as a child window) @@ -2100,7 +2100,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowStates newState) // it before applying the normal geometry. if (windowVisibility_sys(m_data.hwnd) == QWindow::Maximized) ShowWindow(m_data.hwnd, SW_SHOWNOACTIVATE); - SetWindowPos(m_data.hwnd, 0, m_savedFrameGeometry.x(), m_savedFrameGeometry.y(), + SetWindowPos(m_data.hwnd, nullptr, m_savedFrameGeometry.x(), m_savedFrameGeometry.y(), m_savedFrameGeometry.width(), m_savedFrameGeometry.height(), swpf); if (!wasSync) clearFlag(SynchronousGeometryChangeEvent); @@ -2286,7 +2286,7 @@ static HRGN qRegionToWinRegion(const QRegion ®ion) void QWindowsWindow::setMask(const QRegion ®ion) { if (region.isEmpty()) { - SetWindowRgn(m_data.hwnd, 0, true); + SetWindowRgn(m_data.hwnd, nullptr, true); return; } const HRGN winRegion = qRegionToWinRegion(region); @@ -2319,7 +2319,7 @@ void QWindowsWindow::requestActivateWindow() if (QGuiApplication::applicationState() != Qt::ApplicationActive && QWindowsNativeInterface::windowActivationBehavior() == QWindowsWindowFunctions::AlwaysActivateWindow) { if (const HWND foregroundWindow = GetForegroundWindow()) { - foregroundThread = GetWindowThreadProcessId(foregroundWindow, NULL); + foregroundThread = GetWindowThreadProcessId(foregroundWindow, nullptr); if (foregroundThread && foregroundThread != currentThread) attached = AttachThreadInput(foregroundThread, currentThread, TRUE) == TRUE; if (attached) { @@ -2353,7 +2353,7 @@ bool QWindowsWindow::setKeyboardGrabEnabled(bool grab) context->setKeyGrabber(window()); } else { if (context->keyGrabber() == window()) - context->setKeyGrabber(0); + context->setKeyGrabber(nullptr); } return true; } @@ -2653,7 +2653,7 @@ static HICON createHIcon(const QIcon &icon, int xSize, int ySize) if (!pm.isNull()) return qt_pixmapToWinHICON(pm); } - return 0; + return nullptr; } void QWindowsWindow::setWindowIcon(const QIcon &icon) @@ -2711,7 +2711,7 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins) newFrame.moveTo(topLeft); qCDebug(lcQpaWindows) << __FUNCTION__ << oldCustomMargins << "->" << newCustomMargins << currentFrameGeometry << "->" << newFrame; - SetWindowPos(m_data.hwnd, 0, newFrame.x(), newFrame.y(), newFrame.width(), newFrame.height(), SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE); + SetWindowPos(m_data.hwnd, nullptr, newFrame.x(), newFrame.y(), newFrame.width(), newFrame.height(), SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE); } } -- cgit v1.2.3