Make use of foreign protocol
Summary: not sure if that is the right "parent" that has to be set, set the transient for surfaces that have setParentOf of an imported set Test Plan: m_XdgForeign->transientFor(surface()) finds the surface is expected, not sure how to test it further Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: luebking, graesslin, davidedmundson, plasma-devel, kwin, #kwin Tags: #plasma Differential Revision: https://phabricator.kde.org/D7521
This commit is contained in:
parent
696028bdb2
commit
735fcc6e95
3 changed files with 30 additions and 0 deletions
|
@ -315,6 +315,11 @@ void ShellClient::init()
|
||||||
getShadow();
|
getShadow();
|
||||||
connect(s, &SurfaceInterface::shadowChanged, this, &Toplevel::getShadow);
|
connect(s, &SurfaceInterface::shadowChanged, this, &Toplevel::getShadow);
|
||||||
|
|
||||||
|
connect(waylandServer(), &WaylandServer::foreignTransientChanged, this, [this](KWayland::Server::SurfaceInterface *child) {
|
||||||
|
if (child == surface()) {
|
||||||
|
setTransient();
|
||||||
|
}
|
||||||
|
});
|
||||||
setTransient();
|
setTransient();
|
||||||
// check whether we have a ServerSideDecoration
|
// check whether we have a ServerSideDecoration
|
||||||
if (ServerSideDecorationInterface *deco = ServerSideDecorationInterface::get(s)) {
|
if (ServerSideDecorationInterface *deco = ServerSideDecorationInterface::get(s)) {
|
||||||
|
@ -1392,6 +1397,9 @@ void ShellClient::setTransient()
|
||||||
if (m_xdgShellPopup) {
|
if (m_xdgShellPopup) {
|
||||||
s = m_xdgShellPopup->transientFor().data();
|
s = m_xdgShellPopup->transientFor().data();
|
||||||
}
|
}
|
||||||
|
if (!s) {
|
||||||
|
s = waylandServer()->findForeignTransientForSurface(surface());
|
||||||
|
}
|
||||||
auto t = waylandServer()->findClient(s);
|
auto t = waylandServer()->findClient(s);
|
||||||
if (t != transientFor()) {
|
if (t != transientFor()) {
|
||||||
// remove from main client
|
// remove from main client
|
||||||
|
|
|
@ -52,6 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <KWayland/Server/outputmanagement_interface.h>
|
#include <KWayland/Server/outputmanagement_interface.h>
|
||||||
#include <KWayland/Server/outputconfiguration_interface.h>
|
#include <KWayland/Server/outputconfiguration_interface.h>
|
||||||
#include <KWayland/Server/xdgshell_interface.h>
|
#include <KWayland/Server/xdgshell_interface.h>
|
||||||
|
#include <KWayland/Server/xdgforeign_interface.h>
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
@ -158,6 +159,11 @@ void WaylandServer::createSurface(T *surface)
|
||||||
} else {
|
} else {
|
||||||
connect(client, &ShellClient::windowShown, this, &WaylandServer::shellClientShown);
|
connect(client, &ShellClient::windowShown, this, &WaylandServer::shellClientShown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//not directly connected as the connection is tied to client instead of this
|
||||||
|
connect(m_XdgForeign, &KWayland::Server::XdgForeignInterface::transientChanged, client, [this](KWayland::Server::SurfaceInterface *child, KWayland::Server::SurfaceInterface *parent) {
|
||||||
|
emit foreignTransientChanged(child);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
|
bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
|
||||||
|
@ -308,9 +314,17 @@ bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
|
||||||
|
|
||||||
m_display->createSubCompositor(m_display)->create();
|
m_display->createSubCompositor(m_display)->create();
|
||||||
|
|
||||||
|
m_XdgForeign = m_display->createXdgForeignInterface(m_display);
|
||||||
|
m_XdgForeign->create();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SurfaceInterface *WaylandServer::findForeignTransientForSurface(SurfaceInterface *surface)
|
||||||
|
{
|
||||||
|
return m_XdgForeign->transientFor(surface);
|
||||||
|
}
|
||||||
|
|
||||||
void WaylandServer::shellClientShown(Toplevel *t)
|
void WaylandServer::shellClientShown(Toplevel *t)
|
||||||
{
|
{
|
||||||
ShellClient *c = dynamic_cast<ShellClient*>(t);
|
ShellClient *c = dynamic_cast<ShellClient*>(t);
|
||||||
|
|
|
@ -56,6 +56,7 @@ class QtSurfaceExtensionInterface;
|
||||||
class OutputManagementInterface;
|
class OutputManagementInterface;
|
||||||
class OutputConfigurationInterface;
|
class OutputConfigurationInterface;
|
||||||
class XdgShellInterface;
|
class XdgShellInterface;
|
||||||
|
class XdgForeignInterface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +113,11 @@ public:
|
||||||
AbstractClient *findAbstractClient(KWayland::Server::SurfaceInterface *surface) const;
|
AbstractClient *findAbstractClient(KWayland::Server::SurfaceInterface *surface) const;
|
||||||
ShellClient *findClient(QWindow *w) const;
|
ShellClient *findClient(QWindow *w) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return a transient parent of a surface imported with the foreign protocol, if any
|
||||||
|
*/
|
||||||
|
KWayland::Server::SurfaceInterface *findForeignTransientForSurface(KWayland::Server::SurfaceInterface *surface);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns file descriptor for Xwayland to connect to.
|
* @returns file descriptor for Xwayland to connect to.
|
||||||
**/
|
**/
|
||||||
|
@ -189,6 +195,7 @@ Q_SIGNALS:
|
||||||
void shellClientRemoved(KWin::ShellClient*);
|
void shellClientRemoved(KWin::ShellClient*);
|
||||||
void terminatingInternalClientConnection();
|
void terminatingInternalClientConnection();
|
||||||
void initialized();
|
void initialized();
|
||||||
|
void foreignTransientChanged(KWayland::Server::SurfaceInterface *child);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupX11ClipboardSync();
|
void setupX11ClipboardSync();
|
||||||
|
@ -232,6 +239,7 @@ private:
|
||||||
KWayland::Server::ClientConnection *client = nullptr;
|
KWayland::Server::ClientConnection *client = nullptr;
|
||||||
QPointer<KWayland::Server::DataDeviceInterface> ddi;
|
QPointer<KWayland::Server::DataDeviceInterface> ddi;
|
||||||
} m_xclipbaordSync;
|
} m_xclipbaordSync;
|
||||||
|
KWayland::Server::XdgForeignInterface *m_XdgForeign = nullptr;
|
||||||
QList<ShellClient*> m_clients;
|
QList<ShellClient*> m_clients;
|
||||||
QList<ShellClient*> m_internalClients;
|
QList<ShellClient*> m_internalClients;
|
||||||
QHash<KWayland::Server::ClientConnection*, quint16> m_clientIds;
|
QHash<KWayland::Server::ClientConnection*, quint16> m_clientIds;
|
||||||
|
|
Loading…
Reference in a new issue