summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-08-20 11:33:34 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2018-09-11 10:50:07 +0000
commit8be3eb7f2881b639b8f6b924908f3e11c0cbe0b7 (patch)
treee1d750654dadf0cda2fd2997bc5ccdfd18886efb /src/client
parent2ed4d4232532a573153a234f913b11fc624b6e9d (diff)
Client: Clean up hardware integration initialization
If QT_WAYLAND_DISABLE_HW_INTEGRATION is set, clients no longer bind to the qt_hardware_integration interface. [ChangeLog][QPA plugin] The environment variables, QT_WAYLAND_CLIENT_BUFFER_INTEGRATION and QT_WAYLAND_SERVER_BUFFER_INTEGRATION, now takes precedence over what is communicated through the qt_hardware_integration wayland interface. Change-Id: Iff68ccc151781c3c2ad6def8497bca65e89a0b20 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client')
-rw-r--r--src/client/qwaylanddisplay.cpp11
-rw-r--r--src/client/qwaylandintegration.cpp57
2 files changed, 36 insertions, 32 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index c57dc13ad..8a29ffc99 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -272,10 +272,13 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat())));
}
} else if (interface == QStringLiteral("qt_hardware_integration")) {
- mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id));
- // make a roundtrip here since we need to receive the events sent by
- // qt_hardware_integration before creating windows
- forceRoundTrip();
+ bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION");
+ if (!disableHardwareIntegration) {
+ mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id));
+ // make a roundtrip here since we need to receive the events sent by
+ // qt_hardware_integration before creating windows
+ forceRoundTrip();
+ }
} else if (interface == QLatin1String("zxdg_output_manager_v1")) {
mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, 1));
for (auto *screen : qAsConst(mScreens))
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
index e935ef31f..d2fa8568c 100644
--- a/src/client/qwaylandintegration.cpp
+++ b/src/client/qwaylandintegration.cpp
@@ -329,16 +329,13 @@ void QWaylandIntegration::initializeClientBufferIntegration()
{
mClientBufferIntegrationInitialized = true;
- QString targetKey;
- bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION");
- disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration();
- if (disableHardwareIntegration) {
- QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION");
- if (clientBufferIntegrationName.isEmpty())
- clientBufferIntegrationName = QByteArrayLiteral("wayland-egl");
- targetKey = QString::fromLocal8Bit(clientBufferIntegrationName);
- } else {
- targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration();
+ QString targetKey = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"));
+
+ if (targetKey.isEmpty()) {
+ if (mDisplay->hardwareIntegration())
+ targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration();
+ else
+ targetKey = QLatin1Literal("wayland-egl");
}
if (targetKey.isEmpty()) {
@@ -347,29 +344,28 @@ void QWaylandIntegration::initializeClientBufferIntegration()
}
QStringList keys = QWaylandClientBufferIntegrationFactory::keys();
- if (keys.contains(targetKey)) {
+ qCDebug(lcQpaWayland) << "Available client buffer integrations:" << keys;
+
+ if (keys.contains(targetKey))
mClientBufferIntegration.reset(QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()));
- }
- if (mClientBufferIntegration)
+
+ if (mClientBufferIntegration) {
+ qCDebug(lcQpaWayland) << "Initializing client buffer integration" << targetKey;
mClientBufferIntegration->initialize(mDisplay.data());
- else
- qWarning("Failed to load client buffer integration: %s\n", qPrintable(targetKey));
+ } else {
+ qCWarning(lcQpaWayland) << "Failed to load client buffer integration:" << targetKey;
+ qCWarning(lcQpaWayland) << "Available client buffer integrations:" << keys;
+ }
}
void QWaylandIntegration::initializeServerBufferIntegration()
{
mServerBufferIntegrationInitialized = true;
- QString targetKey;
+ QString targetKey = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"));
- bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION");
- disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration();
- if (disableHardwareIntegration) {
- QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION");
- targetKey = QString::fromLocal8Bit(serverBufferIntegrationName);
- } else {
+ if (targetKey.isEmpty() && mDisplay->hardwareIntegration())
targetKey = mDisplay->hardwareIntegration()->serverBufferIntegration();
- }
if (targetKey.isEmpty()) {
qWarning("Failed to determine what server buffer integration to use");
@@ -377,13 +373,18 @@ void QWaylandIntegration::initializeServerBufferIntegration()
}
QStringList keys = QWaylandServerBufferIntegrationFactory::keys();
- if (keys.contains(targetKey)) {
+ qCDebug(lcQpaWayland) << "Available server buffer integrations:" << keys;
+
+ if (keys.contains(targetKey))
mServerBufferIntegration.reset(QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList()));
- }
- if (mServerBufferIntegration)
+
+ if (mServerBufferIntegration) {
+ qCDebug(lcQpaWayland) << "Initializing server buffer integration" << targetKey;
mServerBufferIntegration->initialize(mDisplay.data());
- else
- qWarning("Failed to load server buffer integration %s\n", qPrintable(targetKey));
+ } else {
+ qCWarning(lcQpaWayland) << "Failed to load server buffer integration: " << targetKey;
+ qCWarning(lcQpaWayland) << "Available server buffer integrations:" << keys;
+ }
}
void QWaylandIntegration::initializeShellIntegration()