Merge remote-tracking branch 'qt/5.12' into 5.12.5
Conflicts: src/client/qwaylandwindow.cpp Change-Id: I89fefe5bfc247eeaad3981850efa0faaab3cb145
This commit is contained in:
commit
2bb9acf847
@ -172,9 +172,9 @@ void QWaylandDisplay::checkError() const
|
||||
int ecode = wl_display_get_error(mDisplay);
|
||||
if ((ecode == EPIPE || ecode == ECONNRESET)) {
|
||||
// special case this to provide a nicer error
|
||||
qWarning("The Wayland connection broke. Did the Wayland compositor die?");
|
||||
qFatal("The Wayland connection broke. Did the Wayland compositor die?");
|
||||
} else {
|
||||
qErrnoWarning(ecode, "The Wayland connection experienced a fatal error");
|
||||
qFatal("The Wayland connection experienced a fatal error: %s", strerror(ecode));
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,25 +184,16 @@ void QWaylandDisplay::flushRequests()
|
||||
wl_display_read_events(mDisplay);
|
||||
}
|
||||
|
||||
if (wl_display_dispatch_pending(mDisplay) < 0) {
|
||||
if (wl_display_dispatch_pending(mDisplay) < 0)
|
||||
checkError();
|
||||
exitWithError();
|
||||
}
|
||||
|
||||
wl_display_flush(mDisplay);
|
||||
}
|
||||
|
||||
void QWaylandDisplay::blockingReadEvents()
|
||||
{
|
||||
if (wl_display_dispatch(mDisplay) < 0) {
|
||||
if (wl_display_dispatch(mDisplay) < 0)
|
||||
checkError();
|
||||
exitWithError();
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandDisplay::exitWithError()
|
||||
{
|
||||
::exit(1);
|
||||
}
|
||||
|
||||
wl_event_queue *QWaylandDisplay::createEventQueue()
|
||||
@ -231,10 +222,9 @@ void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::function<bo
|
||||
else
|
||||
wl_display_cancel_read(mDisplay);
|
||||
|
||||
if (wl_display_dispatch_queue_pending(mDisplay, queue) < 0) {
|
||||
if (wl_display_dispatch_queue_pending(mDisplay, queue) < 0)
|
||||
checkError();
|
||||
exitWithError();
|
||||
}
|
||||
|
||||
if (!condition())
|
||||
break;
|
||||
}
|
||||
|
@ -191,7 +191,6 @@ public slots:
|
||||
|
||||
private:
|
||||
void waitForScreens();
|
||||
void exitWithError();
|
||||
void checkError() const;
|
||||
|
||||
void handleWaylandSync();
|
||||
|
@ -301,11 +301,14 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co
|
||||
return GenericWaylandTheme::createUnixTheme(name);
|
||||
}
|
||||
|
||||
// May be called from non-GUI threads
|
||||
QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() const
|
||||
{
|
||||
if (!mClientBufferIntegrationInitialized)
|
||||
// Do an inexpensive check first to avoid locking whenever possible
|
||||
if (Q_UNLIKELY(!mClientBufferIntegrationInitialized))
|
||||
const_cast<QWaylandIntegration *>(this)->initializeClientBufferIntegration();
|
||||
|
||||
Q_ASSERT(mClientBufferIntegrationInitialized);
|
||||
return mClientBufferIntegration && mClientBufferIntegration->isValid() ? mClientBufferIntegration.data() : nullptr;
|
||||
}
|
||||
|
||||
@ -325,9 +328,12 @@ QWaylandShellIntegration *QWaylandIntegration::shellIntegration() const
|
||||
return mShellIntegration.data();
|
||||
}
|
||||
|
||||
// May be called from non-GUI threads
|
||||
void QWaylandIntegration::initializeClientBufferIntegration()
|
||||
{
|
||||
mClientBufferIntegrationInitialized = true;
|
||||
QMutexLocker lock(&mClientBufferInitLock);
|
||||
if (mClientBufferIntegrationInitialized)
|
||||
return;
|
||||
|
||||
QString targetKey;
|
||||
bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION");
|
||||
@ -345,17 +351,20 @@ void QWaylandIntegration::initializeClientBufferIntegration()
|
||||
|
||||
if (targetKey.isEmpty()) {
|
||||
qWarning("Failed to determine what client buffer integration to use");
|
||||
return;
|
||||
} else {
|
||||
QStringList keys = QWaylandClientBufferIntegrationFactory::keys();
|
||||
if (keys.contains(targetKey)) {
|
||||
mClientBufferIntegration.reset(QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()));
|
||||
}
|
||||
if (mClientBufferIntegration)
|
||||
mClientBufferIntegration->initialize(mDisplay.data());
|
||||
else
|
||||
qWarning("Failed to load client buffer integration: %s\n", qPrintable(targetKey));
|
||||
}
|
||||
|
||||
QStringList keys = QWaylandClientBufferIntegrationFactory::keys();
|
||||
if (keys.contains(targetKey)) {
|
||||
mClientBufferIntegration.reset(QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()));
|
||||
}
|
||||
if (mClientBufferIntegration)
|
||||
mClientBufferIntegration->initialize(mDisplay.data());
|
||||
else
|
||||
qWarning("Failed to load client buffer integration: %s\n", qPrintable(targetKey));
|
||||
// This must be set last to make sure other threads don't use the
|
||||
// integration before initialization is complete.
|
||||
mClientBufferIntegrationInitialized = true;
|
||||
}
|
||||
|
||||
void QWaylandIntegration::initializeServerBufferIntegration()
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <QtCore/QScopedPointer>
|
||||
#include <QtCore/QMutex>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -148,6 +149,7 @@ private:
|
||||
QScopedPointer<QPlatformAccessibility> mAccessibility;
|
||||
#endif
|
||||
bool mFailed = false;
|
||||
QMutex mClientBufferInitLock;
|
||||
bool mClientBufferIntegrationInitialized = false;
|
||||
bool mServerBufferIntegrationInitialized = false;
|
||||
bool mShellIntegrationInitialized = false;
|
||||
|
@ -211,8 +211,11 @@ void QWaylandWindow::initWindow()
|
||||
void QWaylandWindow::initializeWlSurface()
|
||||
{
|
||||
Q_ASSERT(!isInitialized());
|
||||
QWriteLocker lock(&mSurfaceLock);
|
||||
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
|
||||
{
|
||||
QWriteLocker lock(&mSurfaceLock);
|
||||
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
|
||||
}
|
||||
emit wlSurfaceCreated();
|
||||
}
|
||||
|
||||
bool QWaylandWindow::shouldCreateShellSurface() const
|
||||
@ -248,6 +251,7 @@ void QWaylandWindow::reset(bool sendDestroyEvent)
|
||||
delete mSubSurfaceWindow;
|
||||
mSubSurfaceWindow = nullptr;
|
||||
if (isInitialized()) {
|
||||
emit wlSurfaceDestroyed();
|
||||
QWriteLocker lock(&mSurfaceLock);
|
||||
destroy();
|
||||
}
|
||||
|
@ -201,6 +201,10 @@ public:
|
||||
public slots:
|
||||
void applyConfigure();
|
||||
|
||||
signals:
|
||||
void wlSurfaceCreated();
|
||||
void wlSurfaceDestroyed();
|
||||
|
||||
protected:
|
||||
void surface_enter(struct ::wl_output *output) override;
|
||||
void surface_leave(struct ::wl_output *output) override;
|
||||
|
@ -376,7 +376,7 @@ QVector<xkb_keysym_t> QWaylandXkb::toKeysym(QKeyEvent *event)
|
||||
keysyms.append(XKB_KEY_KP_0 + (event->key() - Qt::Key_0));
|
||||
else
|
||||
keysyms.append(toKeysymFromTable(event->key()));
|
||||
} else if (!event->text().isEmpty()) {
|
||||
} else if (!event->text().isEmpty() && event->key() != Qt::Key_Return) {
|
||||
// From libxkbcommon keysym-utf.c:
|
||||
// "We allow to represent any UCS character in the range U-00000000 to
|
||||
// U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff."
|
||||
|
Loading…
x
Reference in New Issue
Block a user