2022-03-20 15:55:47 +01:00
|
|
|
#pragma once
|
|
|
|
|
2024-02-29 14:03:38 +01:00
|
|
|
#include "../helpers/AnimatedVariable.hpp"
|
2023-08-07 13:35:19 +02:00
|
|
|
#include <string>
|
|
|
|
#include "../defines.hpp"
|
2024-04-02 21:32:39 +02:00
|
|
|
#include "DesktopTypes.hpp"
|
2024-06-23 15:43:53 +02:00
|
|
|
#include "../helpers/MiscFunctions.hpp"
|
2022-03-20 15:55:47 +01:00
|
|
|
|
2023-10-23 00:11:03 +02:00
|
|
|
enum eFullscreenMode : int8_t {
|
2023-09-28 18:49:33 +02:00
|
|
|
FULLSCREEN_INVALID = -1,
|
|
|
|
FULLSCREEN_FULL = 0,
|
2022-05-29 15:44:30 +02:00
|
|
|
FULLSCREEN_MAXIMIZED
|
|
|
|
};
|
|
|
|
|
2022-08-31 17:02:44 +02:00
|
|
|
class CWindow;
|
|
|
|
|
2022-04-11 19:51:37 +02:00
|
|
|
class CWorkspace {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
2024-05-12 01:03:32 +02:00
|
|
|
static PHLWORKSPACE create(int id, int monitorID, std::string name, bool special = false, bool isEmtpy = true);
|
2024-04-02 21:32:39 +02:00
|
|
|
// use create() don't use this
|
2024-05-12 01:03:32 +02:00
|
|
|
CWorkspace(int id, int monitorID, std::string name, bool special = false, bool isEmpty = true);
|
2022-04-11 19:51:37 +02:00
|
|
|
~CWorkspace();
|
|
|
|
|
2022-04-21 16:38:48 +02:00
|
|
|
// Workspaces ID-based have IDs > 0
|
|
|
|
// and workspaces name-based have IDs starting with -1337
|
2022-12-16 18:17:31 +01:00
|
|
|
int m_iID = -1;
|
|
|
|
std::string m_szName = "";
|
|
|
|
uint64_t m_iMonitorID = -1;
|
2024-06-22 23:52:42 +02:00
|
|
|
// Previous workspace ID and name is stored during a workspace change, allowing travel
|
2022-08-21 12:21:21 +02:00
|
|
|
// to the previous workspace.
|
2024-06-22 23:52:42 +02:00
|
|
|
SWorkspaceIDName m_sPrevWorkspace, m_sPrevWorkspacePerMonitor;
|
2023-03-13 16:19:25 +01:00
|
|
|
|
2024-06-22 23:52:42 +02:00
|
|
|
bool m_bHasFullscreenWindow = false;
|
|
|
|
eFullscreenMode m_efFullscreenMode = FULLSCREEN_FULL;
|
2022-04-11 19:51:37 +02:00
|
|
|
|
2024-06-22 23:52:42 +02:00
|
|
|
wl_array m_wlrCoordinateArr;
|
2022-05-12 11:27:31 +02:00
|
|
|
|
|
|
|
// for animations
|
2024-03-02 01:35:17 +01:00
|
|
|
CAnimatedVariable<Vector2D> m_vRenderOffset;
|
|
|
|
CAnimatedVariable<float> m_fAlpha;
|
|
|
|
bool m_bForceRendering = false;
|
2022-05-16 23:13:32 +02:00
|
|
|
|
2024-04-03 11:09:42 +02:00
|
|
|
// allows damage to propagate.
|
|
|
|
bool m_bVisible = false;
|
|
|
|
|
2022-05-31 14:01:00 +02:00
|
|
|
// "scratchpad"
|
2022-12-16 18:17:31 +01:00
|
|
|
bool m_bIsSpecialWorkspace = false;
|
2022-05-31 14:01:00 +02:00
|
|
|
|
2022-08-31 17:02:44 +02:00
|
|
|
// last window
|
2024-04-27 13:43:12 +02:00
|
|
|
PHLWINDOWREF m_pLastFocusedWindow;
|
2022-08-31 17:02:44 +02:00
|
|
|
|
2022-05-26 19:05:32 +02:00
|
|
|
// user-set
|
2023-04-13 22:09:50 +02:00
|
|
|
bool m_bDefaultFloating = false;
|
|
|
|
bool m_bDefaultPseudo = false;
|
|
|
|
|
2023-05-03 16:15:56 +02:00
|
|
|
// last monitor (used on reconnect)
|
|
|
|
std::string m_szLastMonitor = "";
|
2022-05-26 19:05:32 +02:00
|
|
|
|
2024-05-12 01:03:32 +02:00
|
|
|
bool m_bWasCreatedEmtpy = true;
|
|
|
|
|
2024-04-06 16:53:32 +02:00
|
|
|
bool m_bPersistent = false;
|
2024-04-05 20:32:05 +02:00
|
|
|
|
2024-04-02 21:32:39 +02:00
|
|
|
// Inert: destroyed and invalid. If this is true, release the ptr you have.
|
2024-06-22 23:52:42 +02:00
|
|
|
bool inert();
|
2023-10-23 00:11:03 +02:00
|
|
|
|
2024-06-22 23:52:42 +02:00
|
|
|
void startAnim(bool in, bool left, bool instant = false);
|
|
|
|
void setActive(bool on);
|
2022-05-30 20:51:45 +02:00
|
|
|
|
2024-06-22 23:52:42 +02:00
|
|
|
void moveToMonitor(const int&);
|
2022-09-01 11:46:36 +02:00
|
|
|
|
2024-06-22 23:52:42 +02:00
|
|
|
PHLWINDOW getLastFocusedWindow();
|
|
|
|
void rememberPrevWorkspace(const PHLWORKSPACE& prevWorkspace);
|
2023-05-01 16:39:08 +02:00
|
|
|
|
2024-06-22 23:52:42 +02:00
|
|
|
std::string getConfigName();
|
2024-03-19 21:56:20 +01:00
|
|
|
|
2024-06-22 23:52:42 +02:00
|
|
|
bool matchesStaticSelector(const std::string& selector);
|
2024-04-02 13:10:03 +02:00
|
|
|
|
2024-06-22 23:52:42 +02:00
|
|
|
void markInert();
|
|
|
|
|
|
|
|
SWorkspaceIDName getPrevWorkspaceIDName(bool perMonitor) const;
|
2024-04-02 21:32:39 +02:00
|
|
|
|
2024-04-02 13:10:03 +02:00
|
|
|
private:
|
2024-05-05 18:16:00 +02:00
|
|
|
void init(PHLWORKSPACE self);
|
2024-04-02 21:32:39 +02:00
|
|
|
|
2024-05-05 18:16:00 +02:00
|
|
|
SP<HOOK_CALLBACK_FN> m_pFocusedWindowHook;
|
|
|
|
bool m_bInert = true;
|
|
|
|
WP<CWorkspace> m_pSelf;
|
2022-12-10 22:59:16 +01:00
|
|
|
};
|
2024-04-02 21:32:39 +02:00
|
|
|
|
|
|
|
inline bool valid(const PHLWORKSPACE& ref) {
|
|
|
|
if (!ref)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return !ref->inert();
|
|
|
|
}
|