summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/offscreen
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/offscreen')
-rw-r--r--src/plugins/platforms/offscreen/CMakeLists.txt11
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.cpp4
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.cpp6
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenwindow.cpp8
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenwindow.h2
5 files changed, 13 insertions, 18 deletions
diff --git a/src/plugins/platforms/offscreen/CMakeLists.txt b/src/plugins/platforms/offscreen/CMakeLists.txt
index 424da0a980..09ad9a384d 100644
--- a/src/plugins/platforms/offscreen/CMakeLists.txt
+++ b/src/plugins/platforms/offscreen/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from offscreen.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QOffscreenIntegrationPlugin Plugin:
@@ -7,7 +8,7 @@
qt_internal_add_plugin(QOffscreenIntegrationPlugin
OUTPUT_NAME qoffscreen
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES offscreen # special case
+ DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES offscreen
SOURCES
main.cpp
qoffscreencommon.cpp qoffscreencommon.h
@@ -22,9 +23,6 @@ qt_internal_add_plugin(QOffscreenIntegrationPlugin
Qt::GuiPrivate
)
-#### Keys ignored in scope 1:.:.:offscreen.pro:<TRUE>:
-# OTHER_FILES = "offscreen.json"
-
## Scopes:
#####################################################################
@@ -34,6 +32,3 @@ qt_internal_extend_target(QOffscreenIntegrationPlugin CONDITION QT_FEATURE_openg
LIBRARIES
X11::X11
)
-
-#### Keys ignored in scope 3:.:.:offscreen.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
-# PLUGIN_EXTENDS = "-"
diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
index 6e063a2b56..923fffb29c 100644
--- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
@@ -189,13 +189,13 @@ QPixmap QOffscreenBackingStore::grabWindow(WId window, const QRect &rect) const
QOffscreenBackingStore *QOffscreenBackingStore::backingStoreForWinId(WId id)
{
- return m_backingStoreForWinIdHash.value(id, 0);
+ return m_backingStoreForWinIdHash.value(id, nullptr);
}
void QOffscreenBackingStore::clearHash()
{
for (auto it = m_windowAreaHash.cbegin(), end = m_windowAreaHash.cend(); it != end; ++it) {
- const auto it2 = qAsConst(m_backingStoreForWinIdHash).find(it.key());
+ const auto it2 = std::as_const(m_backingStoreForWinIdHash).find(it.key());
if (it2.value() == this)
m_backingStoreForWinIdHash.erase(it2);
}
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
index cb02205601..ea8042928a 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
@@ -82,8 +82,8 @@ QOffscreenIntegration::QOffscreenIntegration(const QStringList& paramList)
QOffscreenIntegration::~QOffscreenIntegration()
{
- for (auto screen : std::as_const(m_screens))
- QWindowSystemInterface::handleScreenRemoved(screen);
+ while (!m_screens.isEmpty())
+ QWindowSystemInterface::handleScreenRemoved(m_screens.takeLast());
}
/*
@@ -145,7 +145,7 @@ std::optional<QJsonObject> QOffscreenIntegration::resolveConfigFileConfiguration
QString configPrefix("configfile="_L1);
if (param.startsWith(configPrefix)) {
hasConfigFile = true;
- configFilePath = param.mid(configPrefix.length());
+ configFilePath = param.mid(configPrefix.size());
}
}
if (!hasConfigFile)
diff --git a/src/plugins/platforms/offscreen/qoffscreenwindow.cpp b/src/plugins/platforms/offscreen/qoffscreenwindow.cpp
index b009722e56..1a1471c687 100644
--- a/src/plugins/platforms/offscreen/qoffscreenwindow.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenwindow.cpp
@@ -86,7 +86,7 @@ void QOffscreenWindow::setVisible(bool visible)
if (visible) {
if (window()->type() != Qt::ToolTip)
- QWindowSystemInterface::handleWindowActivated(window(), Qt::ActiveWindowFocusReason);
+ QWindowSystemInterface::handleFocusWindowChanged(window(), Qt::ActiveWindowFocusReason);
if (m_pendingGeometryChangeOnShow) {
m_pendingGeometryChangeOnShow = false;
@@ -122,7 +122,7 @@ void QOffscreenWindow::setVisible(bool visible)
void QOffscreenWindow::requestActivateWindow()
{
if (m_visible)
- QWindowSystemInterface::handleWindowActivated(window(), Qt::ActiveWindowFocusReason);
+ QWindowSystemInterface::handleFocusWindowChanged(window(), Qt::ActiveWindowFocusReason);
}
WId QOffscreenWindow::winId() const
@@ -165,9 +165,9 @@ void QOffscreenWindow::setWindowState(Qt::WindowStates state)
QOffscreenWindow *QOffscreenWindow::windowForWinId(WId id)
{
- return m_windowForWinIdHash.value(id, 0);
+ return m_windowForWinIdHash.value(id, nullptr);
}
-QHash<WId, QOffscreenWindow *> QOffscreenWindow::m_windowForWinIdHash;
+Q_CONSTINIT QHash<WId, QOffscreenWindow *> QOffscreenWindow::m_windowForWinIdHash;
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/offscreen/qoffscreenwindow.h b/src/plugins/platforms/offscreen/qoffscreenwindow.h
index f1a437c64c..d525f2c657 100644
--- a/src/plugins/platforms/offscreen/qoffscreenwindow.h
+++ b/src/plugins/platforms/offscreen/qoffscreenwindow.h
@@ -41,7 +41,7 @@ private:
bool m_frameMarginsRequested;
WId m_winId;
- static QHash<WId, QOffscreenWindow *> m_windowForWinIdHash;
+ Q_CONSTINIT static QHash<WId, QOffscreenWindow *> m_windowForWinIdHash;
};
QT_END_NAMESPACE