From 72ca9268cef8bd9fbe78fa6f2516d261748304f4 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 16 Jan 2020 22:15:24 +0200 Subject: [PATCH] [wayland] Provide correct input geometry for client-side decorated clients Summary: Currently, the input geometry for client-side decorated clients matches the frame geometry, which makes it impossible for a user to resize such clients by just dragging invisible area near window borders. BUG: 416346 Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: cblack, ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D26716 --- input.cpp | 4 +++- xdgshellclient.cpp | 9 +++++++++ xdgshellclient.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/input.cpp b/input.cpp index c552cb28e0..27d1e926d2 100644 --- a/input.cpp +++ b/input.cpp @@ -2207,7 +2207,9 @@ static bool acceptsInput(Toplevel *t, const QPoint &pos) if (input.isEmpty()) { return true; } - return input.translated(t->pos()).contains(pos); + // TODO: What about sub-surfaces sticking outside the main surface? + const QPoint localPoint = pos - t->bufferGeometry().topLeft(); + return input.contains(localPoint); } Toplevel *InputRedirection::findToplevel(const QPoint &pos) diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp index 58bb1ee050..e01c796b96 100644 --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -295,6 +295,15 @@ void XdgShellClient::deleteClient(XdgShellClient *c) delete c; } +QRect XdgShellClient::inputGeometry() const +{ + if (isDecorated()) { + return AbstractClient::inputGeometry(); + } + // TODO: What about sub-surfaces sticking outside the main surface? + return m_bufferGeometry; +} + QRect XdgShellClient::bufferGeometry() const { return m_bufferGeometry; diff --git a/xdgshellclient.h b/xdgshellclient.h index 9c23aacd4b..fdefa3764f 100644 --- a/xdgshellclient.h +++ b/xdgshellclient.h @@ -58,6 +58,7 @@ public: XdgShellClient(KWayland::Server::XdgShellPopupInterface *surface); ~XdgShellClient() override; + QRect inputGeometry() const override; QRect bufferGeometry() const override; QStringList activities() const override; QPoint clientContentPos() const override;