2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
2016-04-21 10:56:02 +00:00
|
|
|
|
2020-03-15 15:19:28 +00:00
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2016-04-21 10:56:02 +00:00
|
|
|
#ifndef KWAYLAND_SERVER_XDGSHELL_INTERFACE_P_H
|
|
|
|
#define KWAYLAND_SERVER_XDGSHELL_INTERFACE_P_H
|
|
|
|
#include "xdgshell_interface.h"
|
|
|
|
#include "global_p.h"
|
|
|
|
#include "generic_shell_surface_p.h"
|
|
|
|
#include "resource_p.h"
|
|
|
|
|
Support XDG v6
Summary:
The main clever part that's not just boring boiler plate is how we
handle the structure change
A surface now has an XDGSurface which then has a an Xdg TopLevel or a
Xdg Popup
We need to fit this into the public API which assumes a surface has a
Surface or a Popup.
The old Surface is similar to the new TopLevel.
The shoehorning works by relying on the fact that a surface without a
role is pretty useless.
Clients create the surface implicitly with the toplevel or implicitly
with the popup.
The server only announced it has a new "XdgSurface" when it gets a new
zxdg_surface_get_toplevel.
----
Popup decisions:
- On popup creation the server should copy the current info from the
positioner and then it gets deleted. Given kwaylands job is to keep
state, we expose all these parameter via popup.
- Due to this positioner is not exposed as a resource anywhere.
- Server API is 100% backwards compatiable.
i.e new code will work identically with v5 clients.
- Client API is not. Grabs are called separately from the constructor,
and the parent surface changed to an xdgsurface, not a raw surface.
V5 code still works as-is, just not with the new constructors.
It seemed better to match the v6 (and what will be the stable v7) than
to try and do hacks and lose functionality.
Given the client needs to change the code to opt into V6 anyway. I don't
think this is a huge problem.
Test Plan: Current test still passes.
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: graesslin, mart, plasma-devel, #frameworks
Tags: #frameworks, #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D6047
2017-09-04 15:38:35 +00:00
|
|
|
#include <QTimer>
|
|
|
|
|
2016-04-21 10:56:02 +00:00
|
|
|
namespace KWayland
|
|
|
|
{
|
|
|
|
namespace Server
|
|
|
|
{
|
|
|
|
|
|
|
|
class XdgShellInterface::Private : public Global::Private
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
XdgShellInterfaceVersion interfaceVersion;
|
|
|
|
|
Support XDG v6
Summary:
The main clever part that's not just boring boiler plate is how we
handle the structure change
A surface now has an XDGSurface which then has a an Xdg TopLevel or a
Xdg Popup
We need to fit this into the public API which assumes a surface has a
Surface or a Popup.
The old Surface is similar to the new TopLevel.
The shoehorning works by relying on the fact that a surface without a
role is pretty useless.
Clients create the surface implicitly with the toplevel or implicitly
with the popup.
The server only announced it has a new "XdgSurface" when it gets a new
zxdg_surface_get_toplevel.
----
Popup decisions:
- On popup creation the server should copy the current info from the
positioner and then it gets deleted. Given kwaylands job is to keep
state, we expose all these parameter via popup.
- Due to this positioner is not exposed as a resource anywhere.
- Server API is 100% backwards compatiable.
i.e new code will work identically with v5 clients.
- Client API is not. Grabs are called separately from the constructor,
and the parent surface changed to an xdgsurface, not a raw surface.
V5 code still works as-is, just not with the new constructors.
It seemed better to match the v6 (and what will be the stable v7) than
to try and do hacks and lose functionality.
Given the client needs to change the code to opt into V6 anyway. I don't
think this is a huge problem.
Test Plan: Current test still passes.
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: graesslin, mart, plasma-devel, #frameworks
Tags: #frameworks, #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D6047
2017-09-04 15:38:35 +00:00
|
|
|
virtual quint32 ping(XdgShellSurfaceInterface * surface) = 0;
|
|
|
|
void setupTimer(quint32 serial);
|
|
|
|
//pingserial/timer correspondence
|
|
|
|
QHash <quint32, QTimer *> pingTimers;
|
|
|
|
|
2016-04-21 10:56:02 +00:00
|
|
|
protected:
|
|
|
|
Private(XdgShellInterfaceVersion interfaceVersion, XdgShellInterface *q, Display *d, const wl_interface *interface, quint32 version);
|
|
|
|
XdgShellInterface *q;
|
|
|
|
};
|
|
|
|
|
|
|
|
class XdgShellSurfaceInterface::Private : public Resource::Private, public GenericShellSurface<XdgShellSurfaceInterface>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~Private();
|
|
|
|
|
|
|
|
virtual void close() = 0;
|
|
|
|
virtual quint32 configure(States states, const QSize &size) = 0;
|
2019-09-05 10:57:35 +00:00
|
|
|
virtual QRect windowGeometry() const = 0;
|
|
|
|
virtual QSize minimumSize() const = 0;
|
|
|
|
virtual QSize maximumSize() const = 0;
|
2016-04-21 10:56:02 +00:00
|
|
|
|
|
|
|
XdgShellSurfaceInterface *q_func() {
|
|
|
|
return reinterpret_cast<XdgShellSurfaceInterface *>(q);
|
|
|
|
}
|
|
|
|
|
|
|
|
QVector<quint32> configureSerials;
|
|
|
|
QPointer<XdgShellSurfaceInterface> parent;
|
|
|
|
XdgShellInterfaceVersion interfaceVersion;
|
|
|
|
|
|
|
|
protected:
|
Support XDG v6
Summary:
The main clever part that's not just boring boiler plate is how we
handle the structure change
A surface now has an XDGSurface which then has a an Xdg TopLevel or a
Xdg Popup
We need to fit this into the public API which assumes a surface has a
Surface or a Popup.
The old Surface is similar to the new TopLevel.
The shoehorning works by relying on the fact that a surface without a
role is pretty useless.
Clients create the surface implicitly with the toplevel or implicitly
with the popup.
The server only announced it has a new "XdgSurface" when it gets a new
zxdg_surface_get_toplevel.
----
Popup decisions:
- On popup creation the server should copy the current info from the
positioner and then it gets deleted. Given kwaylands job is to keep
state, we expose all these parameter via popup.
- Due to this positioner is not exposed as a resource anywhere.
- Server API is 100% backwards compatiable.
i.e new code will work identically with v5 clients.
- Client API is not. Grabs are called separately from the constructor,
and the parent surface changed to an xdgsurface, not a raw surface.
V5 code still works as-is, just not with the new constructors.
It seemed better to match the v6 (and what will be the stable v7) than
to try and do hacks and lose functionality.
Given the client needs to change the code to opt into V6 anyway. I don't
think this is a huge problem.
Test Plan: Current test still passes.
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: graesslin, mart, plasma-devel, #frameworks
Tags: #frameworks, #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D6047
2017-09-04 15:38:35 +00:00
|
|
|
Private(XdgShellInterfaceVersion interfaceVersion, XdgShellSurfaceInterface *q, Global *c, SurfaceInterface *surface, wl_resource *parentResource, const wl_interface *interface, const void *implementation);
|
2016-04-21 10:56:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class XdgShellPopupInterface::Private : public Resource::Private, public GenericShellSurface<XdgShellPopupInterface>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~Private();
|
|
|
|
virtual void popupDone() = 0;
|
2019-09-05 10:57:35 +00:00
|
|
|
virtual QRect windowGeometry() const = 0;
|
2016-04-21 10:56:02 +00:00
|
|
|
|
|
|
|
XdgShellPopupInterface *q_func() {
|
|
|
|
return reinterpret_cast<XdgShellPopupInterface *>(q);
|
|
|
|
}
|
|
|
|
|
Support XDG v6
Summary:
The main clever part that's not just boring boiler plate is how we
handle the structure change
A surface now has an XDGSurface which then has a an Xdg TopLevel or a
Xdg Popup
We need to fit this into the public API which assumes a surface has a
Surface or a Popup.
The old Surface is similar to the new TopLevel.
The shoehorning works by relying on the fact that a surface without a
role is pretty useless.
Clients create the surface implicitly with the toplevel or implicitly
with the popup.
The server only announced it has a new "XdgSurface" when it gets a new
zxdg_surface_get_toplevel.
----
Popup decisions:
- On popup creation the server should copy the current info from the
positioner and then it gets deleted. Given kwaylands job is to keep
state, we expose all these parameter via popup.
- Due to this positioner is not exposed as a resource anywhere.
- Server API is 100% backwards compatiable.
i.e new code will work identically with v5 clients.
- Client API is not. Grabs are called separately from the constructor,
and the parent surface changed to an xdgsurface, not a raw surface.
V5 code still works as-is, just not with the new constructors.
It seemed better to match the v6 (and what will be the stable v7) than
to try and do hacks and lose functionality.
Given the client needs to change the code to opt into V6 anyway. I don't
think this is a huge problem.
Test Plan: Current test still passes.
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: graesslin, mart, plasma-devel, #frameworks
Tags: #frameworks, #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D6047
2017-09-04 15:38:35 +00:00
|
|
|
virtual quint32 configure(const QRect &rect) {
|
|
|
|
Q_UNUSED(rect)
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
QVector<quint32> configureSerials;
|
2016-04-21 10:56:02 +00:00
|
|
|
QPointer<SurfaceInterface> parent;
|
Support XDG v6
Summary:
The main clever part that's not just boring boiler plate is how we
handle the structure change
A surface now has an XDGSurface which then has a an Xdg TopLevel or a
Xdg Popup
We need to fit this into the public API which assumes a surface has a
Surface or a Popup.
The old Surface is similar to the new TopLevel.
The shoehorning works by relying on the fact that a surface without a
role is pretty useless.
Clients create the surface implicitly with the toplevel or implicitly
with the popup.
The server only announced it has a new "XdgSurface" when it gets a new
zxdg_surface_get_toplevel.
----
Popup decisions:
- On popup creation the server should copy the current info from the
positioner and then it gets deleted. Given kwaylands job is to keep
state, we expose all these parameter via popup.
- Due to this positioner is not exposed as a resource anywhere.
- Server API is 100% backwards compatiable.
i.e new code will work identically with v5 clients.
- Client API is not. Grabs are called separately from the constructor,
and the parent surface changed to an xdgsurface, not a raw surface.
V5 code still works as-is, just not with the new constructors.
It seemed better to match the v6 (and what will be the stable v7) than
to try and do hacks and lose functionality.
Given the client needs to change the code to opt into V6 anyway. I don't
think this is a huge problem.
Test Plan: Current test still passes.
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: graesslin, mart, plasma-devel, #frameworks
Tags: #frameworks, #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D6047
2017-09-04 15:38:35 +00:00
|
|
|
QSize initialSize;
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
QRect anchorRect;
|
|
|
|
Qt::Edges anchorEdge;
|
|
|
|
Qt::Edges gravity;
|
|
|
|
PositionerConstraints constraintAdjustments;
|
|
|
|
QPoint anchorOffset;
|
|
|
|
|
2016-04-21 10:56:02 +00:00
|
|
|
XdgShellInterfaceVersion interfaceVersion;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Private(XdgShellInterfaceVersion interfaceVersion, XdgShellPopupInterface *q, XdgShellInterface *c, SurfaceInterface *surface, wl_resource *parentResource, const wl_interface *interface, const void *implementation);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|