diff options
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 0216b40e3e..b229ec4080 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -105,22 +105,6 @@ static QByteArray debugWinExStyle(DWORD exStyle) return rc; } -static QByteArray debugWindowStates(Qt::WindowStates s) -{ - - QByteArray rc = "0x"; - rc += QByteArray::number(int(s), 16); - if (s & Qt::WindowMinimized) - rc += " WindowMinimized"; - if (s & Qt::WindowMaximized) - rc += " WindowMaximized"; - if (s & Qt::WindowFullScreen) - rc += " WindowFullScreen"; - if (s & Qt::WindowActive) - rc += " WindowActive"; - return rc; -} - #ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO QDebug operator<<(QDebug d, const MINMAXINFO &i) { @@ -935,16 +919,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) #endif // QT_NO_OPENGL updateDropSite(); -#ifndef Q_OS_WINCE - if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) - && aWindow->type() != Qt::ForeignWindow) { - if (QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, 0)) { - setFlag(TouchRegistered); - } else { - qErrnoWarning("RegisterTouchWindow() failed for window '%s'.", qPrintable(aWindow->objectName())); - } - } -#endif // !Q_OS_WINCE + registerTouchWindow(); setWindowState(aWindow->windowState()); const qreal opacity = qt_window_private(aWindow)->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) @@ -1595,8 +1570,7 @@ QWindowsWindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt, void QWindowsWindow::handleWindowStateChange(Qt::WindowState state) { qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() - << "\n from " << debugWindowStates(m_windowState) - << " to " << debugWindowStates(state); + << "\n from " << m_windowState << " to " << state; setFlag(FrameDirty); m_windowState = state; QWindowSystemInterface::handleWindowStateChanged(window(), state); @@ -1665,7 +1639,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) if (oldState == newState) return; qCDebug(lcQpaWindows) << '>' << __FUNCTION__ << this << window() - << " from " << debugWindowStates(oldState) << " to " << debugWindowStates(newState); + << " from " << oldState << " to " << newState; const bool visible = isVisible(); @@ -1766,7 +1740,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) ShowWindow(m_data.hwnd, (newState == Qt::WindowMinimized) ? SW_MINIMIZE : (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE); } - qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << this << window() << debugWindowStates(newState); + qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << this << window() << newState; } void QWindowsWindow::setStyle(unsigned s) const @@ -2356,6 +2330,35 @@ void *QWindowsWindow::surface(void *nativeConfig) #endif } +void QWindowsWindow::invalidateSurface() +{ + if (m_surface) { + if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext()) + staticOpenGLContext->destroyWindowSurface(m_surface); + m_surface = 0; + } +} + +void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes) +{ + if (!window->handle()) + return; + static_cast<QWindowsWindow *>(window->handle())->registerTouchWindow(touchTypes); +} + +void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes) +{ +#ifndef Q_OS_WINCE + if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) + && window()->type() != Qt::ForeignWindow) { + if (QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, (ULONG)touchTypes)) + setFlag(TouchRegistered); + else + qErrnoWarning("RegisterTouchWindow() failed for window '%s'.", qPrintable(window()->objectName())); + } +#endif // !Q_OS_WINCE +} + void QWindowsWindow::aboutToMakeCurrent() { #ifndef QT_NO_OPENGL |