socket2: Add 5 IPC event with support for workspace ID (#5022)

- `moveworkspacev2`:    returns workspaceID,workspaceName,monitorName
- `movewindowv2`:       returns windowAddress,workspaceID,workspaceName
- `createWorkspacev2`:  returns workspaceID,workspaceName
- `destroyWorkspacev2`: returns workspaceID,workspaceName
- `workspacev2`:        returns workspaceID,workspaceName

- Include workspaceID as a parameter in CWorkspace constructor to support `createWorkspacev2`.

Resolves #4929
This commit is contained in:
Aaron
2024-03-09 01:39:53 +08:00
committed by GitHub
parent 4c34e4aac2
commit 5920c6a6b8
5 changed files with 12 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
#include "../Compositor.hpp"
#include "../config/ConfigValue.hpp"
CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
CWorkspace::CWorkspace(int id, int monitorID, std::string name, bool special) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
if (!PMONITOR) {
@@ -11,6 +11,7 @@ CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
}
m_iMonitorID = monitorID;
m_iID = id;
m_szName = name;
m_bIsSpecialWorkspace = special;
@@ -30,6 +31,7 @@ CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
m_szName = RULEFORTHIS.defaultName.value();
g_pEventManager->postEvent({"createworkspace", m_szName});
g_pEventManager->postEvent({"createworkspacev2", std::format("{},{}", m_iID, m_szName)});
EMIT_HOOK_EVENT("createWorkspace", this);
}
@@ -39,6 +41,7 @@ CWorkspace::~CWorkspace() {
Debug::log(LOG, "Destroying workspace ID {}", m_iID);
g_pEventManager->postEvent({"destroyworkspace", m_szName});
g_pEventManager->postEvent({"destroyworkspacev2", std::format("{},{}", m_iID, m_szName)});
EMIT_HOOK_EVENT("destroyWorkspace", this);
}