xdg-shell: Add support for v2
This commit is contained in:
parent
7f7a46563b
commit
9b4e2dbdf8
2 changed files with 23 additions and 2 deletions
|
@ -16,6 +16,8 @@
|
||||||
namespace KWaylandServer
|
namespace KWaylandServer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static const int s_version = 2;
|
||||||
|
|
||||||
XdgShellInterfacePrivate::XdgShellInterfacePrivate(XdgShellInterface *shell)
|
XdgShellInterfacePrivate::XdgShellInterfacePrivate(XdgShellInterface *shell)
|
||||||
: q(shell)
|
: q(shell)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +113,7 @@ XdgShellInterface::XdgShellInterface(Display *display, QObject *parent)
|
||||||
, d(new XdgShellInterfacePrivate(this))
|
, d(new XdgShellInterfacePrivate(this))
|
||||||
{
|
{
|
||||||
d->display = display;
|
d->display = display;
|
||||||
d->init(*display, 1);
|
d->init(*display, s_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
XdgShellInterface::~XdgShellInterface()
|
XdgShellInterface::~XdgShellInterface()
|
||||||
|
@ -571,7 +573,7 @@ quint32 XdgToplevelInterface::sendConfigure(const QSize &size, const States &sta
|
||||||
{
|
{
|
||||||
// Note that the states listed in the configure event must be an array of uint32_t.
|
// Note that the states listed in the configure event must be an array of uint32_t.
|
||||||
|
|
||||||
uint32_t statesData[4] = { 0 };
|
uint32_t statesData[8] = { 0 };
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (states & State::MaximizedHorizontal && states & State::MaximizedVertical) {
|
if (states & State::MaximizedHorizontal && states & State::MaximizedVertical) {
|
||||||
|
@ -587,6 +589,21 @@ quint32 XdgToplevelInterface::sendConfigure(const QSize &size, const States &sta
|
||||||
statesData[i++] = QtWaylandServer::xdg_toplevel::state_activated;
|
statesData[i++] = QtWaylandServer::xdg_toplevel::state_activated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d->resource()->version() >= XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION) {
|
||||||
|
if (states & State::TiledLeft) {
|
||||||
|
statesData[i++] = QtWaylandServer::xdg_toplevel::state_tiled_left;
|
||||||
|
}
|
||||||
|
if (states & State::TiledTop) {
|
||||||
|
statesData[i++] = QtWaylandServer::xdg_toplevel::state_tiled_top;
|
||||||
|
}
|
||||||
|
if (states & State::TiledRight) {
|
||||||
|
statesData[i++] = QtWaylandServer::xdg_toplevel::state_tiled_right;
|
||||||
|
}
|
||||||
|
if (states & State::TiledBottom) {
|
||||||
|
statesData[i++] = QtWaylandServer::xdg_toplevel::state_tiled_bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const QByteArray xdgStates = QByteArray::fromRawData(reinterpret_cast<char *>(statesData),
|
const QByteArray xdgStates = QByteArray::fromRawData(reinterpret_cast<char *>(statesData),
|
||||||
sizeof(uint32_t) * i);
|
sizeof(uint32_t) * i);
|
||||||
const quint32 serial = xdgSurface()->shell()->display()->nextSerial();
|
const quint32 serial = xdgSurface()->shell()->display()->nextSerial();
|
||||||
|
|
|
@ -205,6 +205,10 @@ public:
|
||||||
FullScreen = 0x4,
|
FullScreen = 0x4,
|
||||||
Resizing = 0x8,
|
Resizing = 0x8,
|
||||||
Activated = 0x10,
|
Activated = 0x10,
|
||||||
|
TiledLeft = 0x20,
|
||||||
|
TiledTop = 0x40,
|
||||||
|
TiledRight = 0x80,
|
||||||
|
TiledBottom = 0x100,
|
||||||
Maximized = MaximizedHorizontal | MaximizedVertical
|
Maximized = MaximizedHorizontal | MaximizedVertical
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(States, State)
|
Q_DECLARE_FLAGS(States, State)
|
||||||
|
|
Loading…
Reference in a new issue