Rework workspace rules

This commit is contained in:
vaxerski
2022-10-24 18:36:31 +01:00
parent e0bc952c83
commit 69f1d7b360
4 changed files with 58 additions and 37 deletions

View File

@@ -1875,3 +1875,17 @@ bool CCompositor::cursorOnReservedArea() {
return !VECINRECT(CURSORPOS, XY1.x, XY1.y, XY2.x, XY2.y);
}
CWorkspace* CCompositor::createNewWorkspace(const int& id, const int& monid, const std::string& name) {
const auto NAME = name == "" ? std::to_string(id) : name;
const auto PWORKSPACE = m_vWorkspaces.emplace_back(std::make_unique<CWorkspace>(monid, NAME, id == SPECIAL_WORKSPACE_ID)).get();
// We are required to set the name here immediately
if (id != SPECIAL_WORKSPACE_ID)
wlr_ext_workspace_handle_v1_set_name(PWORKSPACE->m_pWlrHandle, NAME.c_str());
PWORKSPACE->m_iID = id;
PWORKSPACE->m_iMonitorID = monid;
return PWORKSPACE;
}