diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 14 | ||||
-rw-r--r-- | src/client/qwaylanddisplay_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandeventthread.cpp | 8 | ||||
-rw-r--r-- | src/client/qwaylandnativeinterface.cpp | 2 | ||||
-rw-r--r-- | src/client/qwaylandwindow.cpp | 30 | ||||
-rw-r--r-- | src/client/qwaylandwindowmanagerintegration.cpp | 31 | ||||
-rw-r--r-- | src/client/qwaylandwindowmanagerintegration_p.h | 4 | ||||
-rw-r--r-- | src/client/qwaylandwlshellsurface.cpp | 3 |
8 files changed, 44 insertions, 50 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index ab69bca32..2d1c81a75 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -154,12 +154,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) mEventThreadObject->displayConnect(); mDisplay = mEventThreadObject->display(); //blocks until display is available - //Create a new even queue for the QtGui thread - mEventQueue = wl_display_create_queue(mDisplay); - struct ::wl_registry *registry = wl_display_get_registry(mDisplay); - wl_proxy_set_queue((struct wl_proxy *)registry, mEventQueue); - init(registry); connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); @@ -187,7 +182,7 @@ QWaylandDisplay::~QWaylandDisplay(void) void QWaylandDisplay::flushRequests() { - if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) { + if (wl_display_dispatch_pending(mDisplay) < 0) { mEventThreadObject->checkError(); exitWithError(); } @@ -198,7 +193,7 @@ void QWaylandDisplay::flushRequests() void QWaylandDisplay::blockingReadEvents() { - if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) { + if (wl_display_dispatch(mDisplay) < 0) { mEventThreadObject->checkError(); exitWithError(); } @@ -348,17 +343,16 @@ void QWaylandDisplay::forceRoundTrip() int ret = 0; bool done = false; wl_callback *callback = wl_display_sync(mDisplay); - wl_proxy_set_queue((struct wl_proxy *)callback, mEventQueue); wl_callback_add_listener(callback, &sync_listener, &done); flushRequests(); if (QThread::currentThread()->eventDispatcher()) { while (!done && ret >= 0) { QThread::currentThread()->eventDispatcher()->processEvents(QEventLoop::WaitForMoreEvents); - ret = wl_display_dispatch_queue_pending(mDisplay, mEventQueue); + ret = wl_display_dispatch_pending(mDisplay); } } else { while (!done && ret >= 0) - ret = wl_display_dispatch_queue(mDisplay, mEventQueue); + ret = wl_display_dispatch(mDisplay); } if (ret == -1 && !done) diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 96d79ddbd..84c79d70d 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -109,7 +109,6 @@ public: void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); struct wl_display *wl_display() const { return mDisplay; } - struct wl_event_queue *wl_event_queue() const { return mEventQueue; } struct ::wl_registry *wl_registry() { return object(); } const struct wl_compositor *wl_compositor() const { return mCompositor.object(); } @@ -174,7 +173,6 @@ private: }; struct wl_display *mDisplay; - struct wl_event_queue *mEventQueue; QtWayland::wl_compositor mCompositor; struct wl_shm *mShm; QThread *mEventThread; diff --git a/src/client/qwaylandeventthread.cpp b/src/client/qwaylandeventthread.cpp index e2e21c9e7..e0a3edcb8 100644 --- a/src/client/qwaylandeventthread.cpp +++ b/src/client/qwaylandeventthread.cpp @@ -80,13 +80,9 @@ void QWaylandEventThread::checkError() const void QWaylandEventThread::readWaylandEvents() { - if (wl_display_dispatch(m_display) < 0) { - checkError(); - m_readNotifier->setEnabled(false); - emit fatalError(); - return; + if (wl_display_prepare_read(m_display) == 0) { + wl_display_read_events(m_display); } - emit newEventsRead(); } diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp index 8170c39f1..0d20075f0 100644 --- a/src/client/qwaylandnativeinterface.cpp +++ b/src/client/qwaylandnativeinterface.cpp @@ -58,8 +58,6 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay") return m_integration->display()->wl_display(); - if (lowerCaseResource == "wl_event_queue") - return m_integration->display()->wl_event_queue(); if (lowerCaseResource == "compositor") return const_cast<wl_compositor *>(m_integration->display()->wl_compositor()); if (lowerCaseResource == "server_buffer_integration") diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index a54979a2f..ed7b656d9 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -156,7 +156,8 @@ void QWaylandWindow::initWindow() mShellSurface->updateTransientParent(window()->transientParent()); } } else { - mShellSurface->setTopLevel(); + if (window()->type() != Qt::ToolTip) + mShellSurface->setTopLevel(); } } @@ -266,17 +267,18 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (window()->type() == Qt::Popup) { - QWaylandWindow *parent = transientParent(); - if (!parent) { - // Try with the current focus window. It should be the right one and anyway - // better than having no parent at all. - parent = mDisplay->lastInputWindow(); - } - if (parent) { - QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface); - if (wlshellSurface) - wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); + if (mShellSurface) { + if (window()->type() == Qt::Popup) { + QWaylandWindow *parent = transientParent(); + if (parent) { + QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface); + if (wlshellSurface) + wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); + } + } else if (window()->type() == Qt::ToolTip) { + if (QWaylandWindow *parent = transientParent()) { + mShellSurface->updateTransientParent(parent->window()); + } } } @@ -643,7 +645,9 @@ QWaylandWindow *QWaylandWindow::transientParent() const // events. return static_cast<QWaylandWindow *>(topLevelWindow(window()->transientParent())->handle()); } - return 0; + // Try with the current focus window. It should be the right one and anyway + // better than having no parent at all. + return mDisplay->lastInputWindow(); } void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) diff --git a/src/client/qwaylandwindowmanagerintegration.cpp b/src/client/qwaylandwindowmanagerintegration.cpp index 56fe7c5a3..5e8a628bf 100644 --- a/src/client/qwaylandwindowmanagerintegration.cpp +++ b/src/client/qwaylandwindowmanagerintegration.cpp @@ -127,28 +127,33 @@ QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url) { - if (isInitialized()) { - QByteArray data = url.toString().toUtf8(); - - static const int chunkSize = 128; - while (!data.isEmpty()) { - QByteArray chunk = data.left(chunkSize); - data = data.mid(chunkSize); - open_url(!data.isEmpty(), QString::fromUtf8(chunk)); - } + Q_ASSERT(isInitialized()); + QByteArray data = url.toString().toUtf8(); + + static const int chunkSize = 128; + while (!data.isEmpty()) { + QByteArray chunk = data.left(chunkSize); + data = data.mid(chunkSize); + open_url(!data.isEmpty(), QString::fromUtf8(chunk)); } } bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url) { - openUrl_helper(url); - return true; + if (isInitialized()) { + openUrl_helper(url); + return true; + } + return QGenericUnixServices::openUrl(url); } bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url) { - openUrl_helper(url); - return true; + if (isInitialized()) { + openUrl_helper(url); + return true; + } + return QGenericUnixServices::openDocument(url); } } diff --git a/src/client/qwaylandwindowmanagerintegration_p.h b/src/client/qwaylandwindowmanagerintegration_p.h index 612cda43e..c5ceb6d5b 100644 --- a/src/client/qwaylandwindowmanagerintegration_p.h +++ b/src/client/qwaylandwindowmanagerintegration_p.h @@ -38,7 +38,7 @@ #include <QtCore/QScopedPointer> #include <wayland-client.h> -#include <qpa/qplatformservices.h> +#include <QtPlatformSupport/private/qgenericunixservices_p.h> #include <QtWaylandClient/private/qwayland-windowmanager.h> #include <QtWaylandClient/private/qwaylandclientexport_p.h> @@ -52,7 +52,7 @@ class QWaylandDisplay; class QWaylandWindowManagerIntegrationPrivate; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QPlatformServices, public QtWayland::qt_windowmanager +class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QGenericUnixServices, public QtWayland::qt_windowmanager { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration) diff --git a/src/client/qwaylandwlshellsurface.cpp b/src/client/qwaylandwlshellsurface.cpp index 8888dbf4d..f7bdc2c99 100644 --- a/src/client/qwaylandwlshellsurface.cpp +++ b/src/client/qwaylandwlshellsurface.cpp @@ -159,8 +159,7 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) // set_transient expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - QWindow *parentWin = m_window->window()->transientParent(); - transientPos -= parentWin->geometry().topLeft(); + transientPos -= parent->geometry().topLeft(); if (parent_wayland_window->decoration()) { transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); |