summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2017-10-27 10:37:21 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2017-10-27 10:37:21 +0200
commit62293cefae129bbfebb0317b39d059b0abb1a16a (patch)
tree159080c98a85baa02e34776cf2618642ae55d456 /src/client
parentc2b272ac73617a8d5ff25151534feda95ace63ee (diff)
parent523cf490b4c46916c6f5253c666a492f5cce2aad (diff)
Merge remote-tracking branch 'qt/5.10' into dev
Diffstat (limited to 'src/client')
-rw-r--r--src/client/qwaylandbuffer.cpp2
-rw-r--r--src/client/qwaylandbuffer_p.h6
-rw-r--r--src/client/qwaylandwindow.cpp29
-rw-r--r--src/client/qwaylandwlshellsurface.cpp6
4 files changed, 26 insertions, 17 deletions
diff --git a/src/client/qwaylandbuffer.cpp b/src/client/qwaylandbuffer.cpp
index a0fcc532f..076a0d57d 100644
--- a/src/client/qwaylandbuffer.cpp
+++ b/src/client/qwaylandbuffer.cpp
@@ -66,7 +66,7 @@ void QWaylandBuffer::init(wl_buffer *buf)
void QWaylandBuffer::release(void *data, wl_buffer *)
{
- static_cast<QWaylandBuffer *>(data)->mBusy = false;
+ static_cast<QWaylandBuffer *>(data)->mBusy--;
}
const wl_buffer_listener QWaylandBuffer::listener = {
diff --git a/src/client/qwaylandbuffer_p.h b/src/client/qwaylandbuffer_p.h
index 9e8cba2e4..b3513d151 100644
--- a/src/client/qwaylandbuffer_p.h
+++ b/src/client/qwaylandbuffer_p.h
@@ -73,14 +73,14 @@ public:
virtual QSize size() const = 0;
virtual int scale() const { return 1; }
- void setBusy() { mBusy = true; }
- bool busy() const { return mBusy; }
+ void setBusy() { mBusy++; }
+ bool busy() const { return mBusy > 0; }
protected:
struct wl_buffer *mBuffer;
private:
- bool mBusy;
+ int mBusy;
static void release(void *data, wl_buffer *);
static const wl_buffer_listener listener;
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index a39ff9918..48f0d213a 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -261,6 +261,8 @@ void QWaylandWindow::reset(bool sendDestroyEvent)
wl_callback_destroy(mFrameCallback);
mFrameCallback = nullptr;
}
+
+ mMask = QRegion();
}
QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface)
@@ -791,22 +793,27 @@ QWaylandAbstractDecoration *QWaylandWindow::decoration() const
return mWindowDecoration;
}
-static QWindow *topLevelWindow(QWindow *window)
+static QWaylandWindow *closestShellSurfaceWindow(QWindow *window)
{
- while (QWindow *parent = window->parent())
- window = parent;
- return window;
+ while (window) {
+ auto w = static_cast<QWaylandWindow *>(window->handle());
+ if (w->shellSurface())
+ return w;
+ window = window->transientParent() ? window->transientParent() : window->parent();
+ }
+ return nullptr;
}
QWaylandWindow *QWaylandWindow::transientParent() const
{
- // Take the top level window here, since the transient parent may be a QWidgetWindow
- // or some other window without a shell surface, which is then not able to get mouse
- // events.
- if (auto transientParent = window()->transientParent())
- return static_cast<QWaylandWindow *>(topLevelWindow(transientParent)->handle());
- else if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup))
- return static_cast<QWaylandWindow *>(topLevelWindow(QGuiApplication::focusWindow())->handle());
+ // Take the closest window with a shell surface, since the transient parent may be a
+ // QWidgetWindow or some other window without a shell surface, which is then not able to
+ // get mouse events.
+ if (auto transientParent = closestShellSurfaceWindow(window()->transientParent()))
+ return transientParent;
+
+ if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup))
+ return closestShellSurfaceWindow(QGuiApplication::focusWindow());
return nullptr;
}
diff --git a/src/client/qwaylandwlshellsurface.cpp b/src/client/qwaylandwlshellsurface.cpp
index cc5163a22..cd10958d9 100644
--- a/src/client/qwaylandwlshellsurface.cpp
+++ b/src/client/qwaylandwlshellsurface.cpp
@@ -185,6 +185,7 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent)
|| testShowWithoutActivating(m_window->window()))
flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
+ Q_ASSERT(parent_wayland_window->object());
set_transient(parent_wayland_window->object(),
transientPos.x(),
transientPos.y(),
@@ -211,15 +212,16 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic
transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
}
+ Q_ASSERT(parent_wayland_window->object());
set_popup(device->wl_seat(), serial, parent_wayland_window->object(),
transientPos.x(), transientPos.y(), 0);
}
void QWaylandWlShellSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent)
{
- if (type == Qt::Popup && transientParent)
+ if (type == Qt::Popup && transientParent && transientParent->object())
setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial());
- else if (transientParent)
+ else if (transientParent && transientParent->object())
updateTransientParent(transientParent->window());
else
setTopLevel();