Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts: src/client/qwaylandwindow.cpp Change-Id: I80ead87f3e1f36299b1bf9cc9c7db6cd48c0e86f
This commit is contained in:
commit
99a3bfcf9b
@ -154,12 +154,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
|
|||||||
mEventThreadObject->displayConnect();
|
mEventThreadObject->displayConnect();
|
||||||
mDisplay = mEventThreadObject->display(); //blocks until display is available
|
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);
|
struct ::wl_registry *registry = wl_display_get_registry(mDisplay);
|
||||||
wl_proxy_set_queue((struct wl_proxy *)registry, mEventQueue);
|
|
||||||
|
|
||||||
init(registry);
|
init(registry);
|
||||||
|
|
||||||
connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests()));
|
connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests()));
|
||||||
@ -187,7 +182,7 @@ QWaylandDisplay::~QWaylandDisplay(void)
|
|||||||
|
|
||||||
void QWaylandDisplay::flushRequests()
|
void QWaylandDisplay::flushRequests()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) {
|
if (wl_display_dispatch_pending(mDisplay) < 0) {
|
||||||
mEventThreadObject->checkError();
|
mEventThreadObject->checkError();
|
||||||
exitWithError();
|
exitWithError();
|
||||||
}
|
}
|
||||||
@ -198,7 +193,7 @@ void QWaylandDisplay::flushRequests()
|
|||||||
|
|
||||||
void QWaylandDisplay::blockingReadEvents()
|
void QWaylandDisplay::blockingReadEvents()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) {
|
if (wl_display_dispatch(mDisplay) < 0) {
|
||||||
mEventThreadObject->checkError();
|
mEventThreadObject->checkError();
|
||||||
exitWithError();
|
exitWithError();
|
||||||
}
|
}
|
||||||
@ -348,17 +343,16 @@ void QWaylandDisplay::forceRoundTrip()
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
wl_callback *callback = wl_display_sync(mDisplay);
|
wl_callback *callback = wl_display_sync(mDisplay);
|
||||||
wl_proxy_set_queue((struct wl_proxy *)callback, mEventQueue);
|
|
||||||
wl_callback_add_listener(callback, &sync_listener, &done);
|
wl_callback_add_listener(callback, &sync_listener, &done);
|
||||||
flushRequests();
|
flushRequests();
|
||||||
if (QThread::currentThread()->eventDispatcher()) {
|
if (QThread::currentThread()->eventDispatcher()) {
|
||||||
while (!done && ret >= 0) {
|
while (!done && ret >= 0) {
|
||||||
QThread::currentThread()->eventDispatcher()->processEvents(QEventLoop::WaitForMoreEvents);
|
QThread::currentThread()->eventDispatcher()->processEvents(QEventLoop::WaitForMoreEvents);
|
||||||
ret = wl_display_dispatch_queue_pending(mDisplay, mEventQueue);
|
ret = wl_display_dispatch_pending(mDisplay);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (!done && ret >= 0)
|
while (!done && ret >= 0)
|
||||||
ret = wl_display_dispatch_queue(mDisplay, mEventQueue);
|
ret = wl_display_dispatch(mDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -1 && !done)
|
if (ret == -1 && !done)
|
||||||
|
@ -109,7 +109,6 @@ public:
|
|||||||
void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image);
|
void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image);
|
||||||
|
|
||||||
struct wl_display *wl_display() const { return mDisplay; }
|
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(); }
|
struct ::wl_registry *wl_registry() { return object(); }
|
||||||
|
|
||||||
const struct wl_compositor *wl_compositor() const { return mCompositor.object(); }
|
const struct wl_compositor *wl_compositor() const { return mCompositor.object(); }
|
||||||
@ -174,7 +173,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct wl_display *mDisplay;
|
struct wl_display *mDisplay;
|
||||||
struct wl_event_queue *mEventQueue;
|
|
||||||
QtWayland::wl_compositor mCompositor;
|
QtWayland::wl_compositor mCompositor;
|
||||||
struct wl_shm *mShm;
|
struct wl_shm *mShm;
|
||||||
QThread *mEventThread;
|
QThread *mEventThread;
|
||||||
|
@ -80,13 +80,9 @@ void QWaylandEventThread::checkError() const
|
|||||||
|
|
||||||
void QWaylandEventThread::readWaylandEvents()
|
void QWaylandEventThread::readWaylandEvents()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch(m_display) < 0) {
|
if (wl_display_prepare_read(m_display) == 0) {
|
||||||
checkError();
|
wl_display_read_events(m_display);
|
||||||
m_readNotifier->setEnabled(false);
|
|
||||||
emit fatalError();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit newEventsRead();
|
emit newEventsRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,6 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re
|
|||||||
|
|
||||||
if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay")
|
if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay")
|
||||||
return m_integration->display()->wl_display();
|
return m_integration->display()->wl_display();
|
||||||
if (lowerCaseResource == "wl_event_queue")
|
|
||||||
return m_integration->display()->wl_event_queue();
|
|
||||||
if (lowerCaseResource == "compositor")
|
if (lowerCaseResource == "compositor")
|
||||||
return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
|
return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
|
||||||
if (lowerCaseResource == "server_buffer_integration")
|
if (lowerCaseResource == "server_buffer_integration")
|
||||||
|
@ -156,7 +156,8 @@ void QWaylandWindow::initWindow()
|
|||||||
mShellSurface->updateTransientParent(window()->transientParent());
|
mShellSurface->updateTransientParent(window()->transientParent());
|
||||||
}
|
}
|
||||||
} else {
|
} 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)
|
void QWaylandWindow::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (window()->type() == Qt::Popup) {
|
if (mShellSurface) {
|
||||||
QWaylandWindow *parent = transientParent();
|
if (window()->type() == Qt::Popup) {
|
||||||
if (!parent) {
|
QWaylandWindow *parent = transientParent();
|
||||||
// Try with the current focus window. It should be the right one and anyway
|
if (parent) {
|
||||||
// better than having no parent at all.
|
QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface);
|
||||||
parent = mDisplay->lastInputWindow();
|
if (wlshellSurface)
|
||||||
}
|
wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial());
|
||||||
if (parent) {
|
}
|
||||||
QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface);
|
} else if (window()->type() == Qt::ToolTip) {
|
||||||
if (wlshellSurface)
|
if (QWaylandWindow *parent = transientParent()) {
|
||||||
wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial());
|
mShellSurface->updateTransientParent(parent->window());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,7 +645,9 @@ QWaylandWindow *QWaylandWindow::transientParent() const
|
|||||||
// events.
|
// events.
|
||||||
return static_cast<QWaylandWindow *>(topLevelWindow(window()->transientParent())->handle());
|
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)
|
void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e)
|
||||||
|
@ -127,28 +127,33 @@ QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const
|
|||||||
|
|
||||||
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
|
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
|
||||||
{
|
{
|
||||||
if (isInitialized()) {
|
Q_ASSERT(isInitialized());
|
||||||
QByteArray data = url.toString().toUtf8();
|
QByteArray data = url.toString().toUtf8();
|
||||||
|
|
||||||
static const int chunkSize = 128;
|
static const int chunkSize = 128;
|
||||||
while (!data.isEmpty()) {
|
while (!data.isEmpty()) {
|
||||||
QByteArray chunk = data.left(chunkSize);
|
QByteArray chunk = data.left(chunkSize);
|
||||||
data = data.mid(chunkSize);
|
data = data.mid(chunkSize);
|
||||||
open_url(!data.isEmpty(), QString::fromUtf8(chunk));
|
open_url(!data.isEmpty(), QString::fromUtf8(chunk));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url)
|
bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
openUrl_helper(url);
|
if (isInitialized()) {
|
||||||
return true;
|
openUrl_helper(url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return QGenericUnixServices::openUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url)
|
bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url)
|
||||||
{
|
{
|
||||||
openUrl_helper(url);
|
if (isInitialized()) {
|
||||||
return true;
|
openUrl_helper(url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return QGenericUnixServices::openDocument(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <QtCore/QScopedPointer>
|
#include <QtCore/QScopedPointer>
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <qpa/qplatformservices.h>
|
#include <QtPlatformSupport/private/qgenericunixservices_p.h>
|
||||||
|
|
||||||
#include <QtWaylandClient/private/qwayland-windowmanager.h>
|
#include <QtWaylandClient/private/qwayland-windowmanager.h>
|
||||||
#include <QtWaylandClient/private/qwaylandclientexport_p.h>
|
#include <QtWaylandClient/private/qwaylandclientexport_p.h>
|
||||||
@ -52,7 +52,7 @@ class QWaylandDisplay;
|
|||||||
|
|
||||||
class QWaylandWindowManagerIntegrationPrivate;
|
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_OBJECT
|
||||||
Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration)
|
Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration)
|
||||||
|
@ -159,8 +159,7 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent)
|
|||||||
|
|
||||||
// set_transient expects a position relative to the parent
|
// set_transient expects a position relative to the parent
|
||||||
QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
|
QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
|
||||||
QWindow *parentWin = m_window->window()->transientParent();
|
transientPos -= parent->geometry().topLeft();
|
||||||
transientPos -= parentWin->geometry().topLeft();
|
|
||||||
if (parent_wayland_window->decoration()) {
|
if (parent_wayland_window->decoration()) {
|
||||||
transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left());
|
transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left());
|
||||||
transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
|
transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user