xdg-shell: properly check for resource version for TILED and SUSPENDED states

fixes #6535
This commit is contained in:
Vaxry 2024-06-16 16:46:15 +02:00
parent 43c75f17eb
commit 648ac8a00b

View file

@ -136,10 +136,12 @@ CXDGToplevelResource::CXDGToplevelResource(SP<CXdgToplevel> resource_, SP<CXDGSu
wl_array_release(&arr);
}
pendingApply.states.push_back(XDG_TOPLEVEL_STATE_TILED_LEFT);
pendingApply.states.push_back(XDG_TOPLEVEL_STATE_TILED_RIGHT);
pendingApply.states.push_back(XDG_TOPLEVEL_STATE_TILED_TOP);
pendingApply.states.push_back(XDG_TOPLEVEL_STATE_TILED_BOTTOM);
if (resource->version() >= 2) {
pendingApply.states.push_back(XDG_TOPLEVEL_STATE_TILED_LEFT);
pendingApply.states.push_back(XDG_TOPLEVEL_STATE_TILED_RIGHT);
pendingApply.states.push_back(XDG_TOPLEVEL_STATE_TILED_TOP);
pendingApply.states.push_back(XDG_TOPLEVEL_STATE_TILED_BOTTOM);
}
resource->setSetTitle([this](CXdgToplevel* r, const char* t) {
state.title = t;
@ -261,6 +263,9 @@ uint32_t CXDGToplevelResource::setActive(bool active) {
}
uint32_t CXDGToplevelResource::setSuspeneded(bool sus) {
if (resource->version() < 6)
return owner->scheduleConfigure(); // SUSPENDED is since 6
bool set = std::find(pendingApply.states.begin(), pendingApply.states.end(), XDG_TOPLEVEL_STATE_SUSPENDED) != pendingApply.states.end();
if (sus == set)