wayland: Port to ServerSideDecorationInterface::preferredMode()
Currently, the wayland server updates the server side decoration mode, which is counter-intuitive, because it doesn't cache the last preferred mode. With ServerSideDecorationInterface::preferredMode(), it can be simpler.
This commit is contained in:
parent
da53d26543
commit
ab9bfb2993
2 changed files with 5 additions and 11 deletions
|
@ -487,12 +487,6 @@ bool WaylandServer::init(InitializationFlags flags)
|
||||||
if (XdgToplevelClient *client = findXdgToplevelClient(decoration->surface())) {
|
if (XdgToplevelClient *client = findXdgToplevelClient(decoration->surface())) {
|
||||||
client->installServerDecoration(decoration);
|
client->installServerDecoration(decoration);
|
||||||
}
|
}
|
||||||
connect(decoration, &ServerSideDecorationInterface::modeRequested, this,
|
|
||||||
[decoration] (ServerSideDecorationManagerInterface::Mode mode) {
|
|
||||||
// always acknowledge the requested mode
|
|
||||||
decoration->setMode(mode);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -725,7 +725,7 @@ bool XdgToplevelClient::userCanSetFullScreen() const
|
||||||
bool XdgToplevelClient::userCanSetNoBorder() const
|
bool XdgToplevelClient::userCanSetNoBorder() const
|
||||||
{
|
{
|
||||||
if (m_serverDecoration) {
|
if (m_serverDecoration) {
|
||||||
switch (m_serverDecoration->mode()) {
|
switch (m_serverDecoration->preferredMode()) {
|
||||||
case ServerSideDecorationManagerInterface::Mode::Server:
|
case ServerSideDecorationManagerInterface::Mode::Server:
|
||||||
return !isFullScreen() && !isShade();
|
return !isFullScreen() && !isShade();
|
||||||
case ServerSideDecorationManagerInterface::Mode::Client:
|
case ServerSideDecorationManagerInterface::Mode::Client:
|
||||||
|
@ -748,7 +748,7 @@ bool XdgToplevelClient::userCanSetNoBorder() const
|
||||||
bool XdgToplevelClient::noBorder() const
|
bool XdgToplevelClient::noBorder() const
|
||||||
{
|
{
|
||||||
if (m_serverDecoration) {
|
if (m_serverDecoration) {
|
||||||
switch (m_serverDecoration->mode()) {
|
switch (m_serverDecoration->preferredMode()) {
|
||||||
case ServerSideDecorationManagerInterface::Mode::Server:
|
case ServerSideDecorationManagerInterface::Mode::Server:
|
||||||
return m_userNoBorder || isRequestedFullScreen();
|
return m_userNoBorder || isRequestedFullScreen();
|
||||||
case ServerSideDecorationManagerInterface::Mode::Client:
|
case ServerSideDecorationManagerInterface::Mode::Client:
|
||||||
|
@ -1465,9 +1465,9 @@ void XdgToplevelClient::installServerDecoration(ServerSideDecorationInterface *d
|
||||||
updateDecoration(/* check_workspace_pos */ true);
|
updateDecoration(/* check_workspace_pos */ true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(m_serverDecoration, &ServerSideDecorationInterface::modeRequested, this,
|
connect(m_serverDecoration, &ServerSideDecorationInterface::preferredModeChanged, this,
|
||||||
[this] (ServerSideDecorationManagerInterface::Mode mode) {
|
[this] () {
|
||||||
const bool changed = mode != m_serverDecoration->mode();
|
const bool changed = m_serverDecoration->preferredMode() != m_serverDecoration->mode();
|
||||||
if (changed && readyForPainting()) {
|
if (changed && readyForPainting()) {
|
||||||
updateDecoration(/* check_workspace_pos */ true);
|
updateDecoration(/* check_workspace_pos */ true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue