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();
|
||||
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)
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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)
|
||||
|
@ -127,28 +127,33 @@ QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const
|
||||
|
||||
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
|
||||
{
|
||||
if (isInitialized()) {
|
||||
QByteArray data = url.toString().toUtf8();
|
||||
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));
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user