core: fix workspace persistence tracking (#11239)
This commit is contained in:
parent
5d4b4ecbfb
commit
c63d0003a1
7 changed files with 140 additions and 10 deletions
|
|
@ -44,7 +44,7 @@ void CWorkspace::init(PHLWORKSPACE self) {
|
|||
m_inert = false;
|
||||
|
||||
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(self);
|
||||
m_persistent = WORKSPACERULE.isPersistent;
|
||||
setPersistent(WORKSPACERULE.isPersistent);
|
||||
|
||||
if (self->m_wasCreatedEmpty)
|
||||
if (auto cmd = WORKSPACERULE.onCreatedEmptyRunCmd)
|
||||
|
|
@ -639,7 +639,7 @@ void CWorkspace::rename(const std::string& name) {
|
|||
m_name = name;
|
||||
|
||||
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(m_self.lock());
|
||||
m_persistent = WORKSPACERULE.isPersistent;
|
||||
setPersistent(WORKSPACERULE.isPersistent);
|
||||
|
||||
if (WORKSPACERULE.isPersistent)
|
||||
g_pCompositor->ensurePersistentWorkspacesPresent(std::vector<SWorkspaceRule>{WORKSPACERULE}, m_self.lock());
|
||||
|
|
@ -658,3 +658,19 @@ void CWorkspace::updateWindows() {
|
|||
w->updateDynamicRules();
|
||||
}
|
||||
}
|
||||
|
||||
void CWorkspace::setPersistent(bool persistent) {
|
||||
if (m_persistent == persistent)
|
||||
return;
|
||||
|
||||
m_persistent = persistent;
|
||||
|
||||
if (persistent)
|
||||
m_selfPersistent = m_self.lock();
|
||||
else
|
||||
m_selfPersistent.reset();
|
||||
}
|
||||
|
||||
bool CWorkspace::isPersistent() {
|
||||
return m_persistent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,6 @@ class CWorkspace {
|
|||
|
||||
bool m_wasCreatedEmpty = true;
|
||||
|
||||
bool m_persistent = false;
|
||||
|
||||
// Inert: destroyed and invalid. If this is true, release the ptr you have.
|
||||
bool inert();
|
||||
void startAnim(bool in, bool left, bool instant = false);
|
||||
|
|
@ -83,6 +81,8 @@ class CWorkspace {
|
|||
void rename(const std::string& name = "");
|
||||
void forceReportSizesToWindows();
|
||||
void updateWindows();
|
||||
void setPersistent(bool persistent);
|
||||
bool isPersistent();
|
||||
|
||||
struct {
|
||||
CSignalT<> destroy;
|
||||
|
|
@ -99,6 +99,9 @@ class CWorkspace {
|
|||
|
||||
SP<HOOK_CALLBACK_FN> m_focusedWindowHook;
|
||||
bool m_inert = true;
|
||||
|
||||
SP<CWorkspace> m_selfPersistent; // for persistent workspaces.
|
||||
bool m_persistent = false;
|
||||
};
|
||||
|
||||
inline bool valid(const PHLWORKSPACE& ref) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue