diff options
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxscreen.cpp')
-rw-r--r-- | src/plugins/platforms/qnx/qqnxscreen.cpp | 146 |
1 files changed, 25 insertions, 121 deletions
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 010ae37ac9..9d689da991 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -1,41 +1,7 @@ -/*************************************************************************** -** -** Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include "qqnxglobal.h" @@ -62,13 +28,9 @@ #error Please define QQNX_PHYSICAL_SCREEN_WIDTH and QQNX_PHYSICAL_SCREEN_HEIGHT to values greater than zero #endif -// The default z-order of a window (intended to be overlain) created by -// mmrender. -static const int MMRENDER_DEFAULT_ZORDER = -1; - // The maximum z-order at which a foreign window will be considered // an underlay. -static const int MAX_UNDERLAY_ZORDER = MMRENDER_DEFAULT_ZORDER - 1; +static const int MAX_UNDERLAY_ZORDER = -1; QT_BEGIN_NAMESPACE @@ -90,7 +52,7 @@ static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { const QString envPhySizeStr = qgetenv("QQNX_PHYSICAL_SCREEN_SIZE"); if (!envPhySizeStr.isEmpty()) { - const auto envPhySizeStrList = QStringView{envPhySizeStr}.split(QLatin1Char(',')); + const auto envPhySizeStrList = QStringView{envPhySizeStr}.split(u','); const int envWidth = envPhySizeStrList.size() == 2 ? envPhySizeStrList[0].toInt() : -1; const int envHeight = envPhySizeStrList.size() == 2 ? envPhySizeStrList[1].toInt() : -1; @@ -118,38 +80,6 @@ static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { #endif } -static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> &windows, - const QByteArray &mmWindowId) -{ - Q_FOREACH (QQnxWindow *sibling, windows) { - if (sibling->mmRendererWindowName() == mmWindowId) - return sibling; - - QQnxWindow *mmWindow = findMultimediaWindow(sibling->children(), mmWindowId); - - if (mmWindow) - return mmWindow; - } - - return 0; -} - -static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> &windows, - screen_window_t mmWindowId) -{ - Q_FOREACH (QQnxWindow *sibling, windows) { - if (sibling->mmRendererWindow() == mmWindowId) - return sibling; - - QQnxWindow *mmWindow = findMultimediaWindow(sibling->children(), mmWindowId); - - if (mmWindow) - return mmWindow; - } - - return 0; -} - QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen) : m_screenContext(screenContext), m_display(display), @@ -714,19 +644,6 @@ void QQnxScreen::addUnderlayWindow(screen_window_t window) updateHierarchy(); } -void QQnxScreen::addMultimediaWindow(const QByteArray &id, screen_window_t window) -{ - // find the QnxWindow this mmrenderer window is related to - QQnxWindow *mmWindow = findMultimediaWindow(m_childWindows, id); - - if (!mmWindow) - return; - - mmWindow->setMMRendererWindow(window); - - updateHierarchy(); -} - void QQnxScreen::removeOverlayOrUnderlayWindow(screen_window_t window) { const int numRemoved = m_overlays.removeAll(window) + m_underlays.removeAll(window); @@ -762,32 +679,24 @@ void QQnxScreen::newWindowCreated(void *window) windowName = QByteArray(windowNameBuffer); - if (display == nativeDisplay()) { - // A window was created on this screen. If we don't know about this window yet, it means - // it was not created by Qt, but by some foreign library like the multimedia renderer, which - // creates an overlay window when playing a video. - // - // Treat all foreign windows as overlays, underlays or as windows - // created by the BlackBerry QtMultimedia plugin. - // - // In the case of the BlackBerry QtMultimedia plugin, we need to - // "attach" the foreign created mmrenderer window to the correct - // platform window (usually the one belonging to QVideoWidget) to - // ensure proper z-ordering. - // - // Otherwise, assume that if a foreign window already has a Z-Order both negative and - // less than the default Z-Order installed by mmrender on windows it creates, - // the windows should be treated as an underlay. Otherwise, we treat it as an overlay. - if (!windowName.isEmpty() && windowName.startsWith("MmRendererVideoWindowControl")) { - addMultimediaWindow(windowName, windowHandle); - } else if (!findWindow(windowHandle)) { - if (zorder <= MAX_UNDERLAY_ZORDER) - addUnderlayWindow(windowHandle); - else - addOverlayWindow(windowHandle); - Q_EMIT foreignWindowCreated(windowHandle); - } - } + if (display != nativeDisplay()) + return; + + // A window was created on this screen. If we don't know about this window yet, it means + // it was not created by Qt, but by some foreign library. + // + // Treat all foreign windows as overlays or underlays. A window will + // be treated as an underlay if its Z-order is less or equal than + // MAX_UNDERLAY_ZORDER. Otherwise, it will be treated as an overlay. + if (findWindow(windowHandle)) + return; + + if (zorder <= MAX_UNDERLAY_ZORDER) + addUnderlayWindow(windowHandle); + else + addOverlayWindow(windowHandle); + + Q_EMIT foreignWindowCreated(windowHandle); } void QQnxScreen::windowClosed(void *window) @@ -795,12 +704,7 @@ void QQnxScreen::windowClosed(void *window) Q_ASSERT(thread() == QThread::currentThread()); const screen_window_t windowHandle = reinterpret_cast<screen_window_t>(window); - QQnxWindow *mmWindow = findMultimediaWindow(m_childWindows, windowHandle); - - if (mmWindow) - mmWindow->clearMMRendererWindow(); - else - removeOverlayOrUnderlayWindow(windowHandle); + removeOverlayOrUnderlayWindow(windowHandle); } void QQnxScreen::windowGroupStateChanged(const QByteArray &id, Qt::WindowState state) |