summaryrefslogtreecommitdiff
path: root/src/desktop
diff options
context:
space:
mode:
authoroutfoxxed <outfoxxed@outfoxxed.me>2025-06-26 09:32:44 -0700
committerGitHub <noreply@github.com>2025-06-26 18:32:44 +0200
commit3bbdf9dc5ad2851f5d9f317362fc16705e4fd990 (patch)
tree025d7a25435925b235f2e94d18e31931b622c0c0 /src/desktop
parent1f337a7a5e22ec45a77e275ce2e6ca165b298358 (diff)
protocols: add ext-workspace implementation (#10818)
Diffstat (limited to 'src/desktop')
-rw-r--r--src/desktop/Workspace.cpp11
-rw-r--r--src/desktop/Workspace.hpp13
2 files changed, 13 insertions, 11 deletions
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp
index 886c52fb..1e5fbfa6 100644
--- a/src/desktop/Workspace.cpp
+++ b/src/desktop/Workspace.cpp
@@ -70,6 +70,8 @@ CWorkspace::~CWorkspace() {
g_pEventManager->postEvent({.event = "destroyworkspacev2", .data = std::format("{},{}", m_id, m_name)});
EMIT_HOOK_EVENT("destroyWorkspace", this);
}
+
+ m_events.destroy.emit();
}
void CWorkspace::startAnim(bool in, bool left, bool instant) {
@@ -185,14 +187,6 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
}
}
-void CWorkspace::setActive(bool on) {
- ; // empty until https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/40
-}
-
-void CWorkspace::moveToMonitor(const MONITORID& id) {
- ; // empty until https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/40
-}
-
PHLWINDOW CWorkspace::getLastFocusedWindow() {
if (!validMapped(m_lastFocusedWindow) || m_lastFocusedWindow->workspaceID() != m_id)
return nullptr;
@@ -650,6 +644,7 @@ void CWorkspace::rename(const std::string& name) {
g_pCompositor->ensurePersistentWorkspacesPresent(std::vector<SWorkspaceRule>{WORKSPACERULE}, m_self.lock());
g_pEventManager->postEvent({.event = "renameworkspace", .data = std::to_string(m_id) + "," + m_name});
+ m_events.rename.emit();
}
void CWorkspace::updateWindows() {
diff --git a/src/desktop/Workspace.hpp b/src/desktop/Workspace.hpp
index 4f109257..5bf38489 100644
--- a/src/desktop/Workspace.hpp
+++ b/src/desktop/Workspace.hpp
@@ -4,6 +4,7 @@
#include <string>
#include "DesktopTypes.hpp"
#include "../helpers/MiscFunctions.hpp"
+#include "../helpers/signal/Signal.hpp"
enum eFullscreenMode : int8_t {
FSMODE_NONE = 0,
@@ -21,6 +22,8 @@ class CWorkspace {
CWorkspace(WORKSPACEID id, PHLMONITOR monitor, std::string name, bool special = false, bool isEmpty = true);
~CWorkspace();
+ WP<CWorkspace> m_self;
+
// Workspaces ID-based have IDs > 0
// and workspaces name-based have IDs starting with -1337
WORKSPACEID m_id = WORKSPACE_INVALID;
@@ -60,8 +63,6 @@ class CWorkspace {
// Inert: destroyed and invalid. If this is true, release the ptr you have.
bool inert();
void startAnim(bool in, bool left, bool instant = false);
- void setActive(bool on);
- void moveToMonitor(const MONITORID&);
MONITORID monitorID();
PHLWINDOW getLastFocusedWindow();
void rememberPrevWorkspace(const PHLWORKSPACE& prevWorkspace);
@@ -83,6 +84,13 @@ class CWorkspace {
void forceReportSizesToWindows();
void updateWindows();
+ struct {
+ CSignal destroy;
+ CSignal rename;
+ CSignal monitorChange;
+ CSignal activeChange;
+ } m_events;
+
private:
void init(PHLWORKSPACE self);
// Previous workspace ID and name is stored during a workspace change, allowing travel
@@ -91,7 +99,6 @@ class CWorkspace {
SP<HOOK_CALLBACK_FN> m_focusedWindowHook;
bool m_inert = true;
- WP<CWorkspace> m_self;
};
inline bool valid(const PHLWORKSPACE& ref) {