2022-03-20 15:55:47 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2024-02-29 13:03:38 +00:00
|
|
|
#include "../helpers/AnimatedVariable.hpp"
|
2023-08-07 13:35:19 +02:00
|
|
|
#include <string>
|
|
|
|
|
#include "../defines.hpp"
|
2024-04-02 20:32:39 +01:00
|
|
|
#include "DesktopTypes.hpp"
|
2024-06-23 16:43:53 +03:00
|
|
|
#include "../helpers/MiscFunctions.hpp"
|
2022-03-20 15:55:47 +01:00
|
|
|
|
2023-10-22 19:11:03 -03:00
|
|
|
enum eFullscreenMode : int8_t {
|
2024-07-31 17:55:52 +00:00
|
|
|
FSMODE_NONE = 0,
|
|
|
|
|
FSMODE_MAXIMIZED = 1 << 0,
|
|
|
|
|
FSMODE_FULLSCREEN = 1 << 1,
|
|
|
|
|
FSMODE_MAX = (1 << 2) - 1
|
2022-05-29 15:44:30 +02:00
|
|
|
};
|
|
|
|
|
|
2022-08-31 17:02:44 +02:00
|
|
|
class CWindow;
|
|
|
|
|
|
2022-04-11 19:51:37 +02:00
|
|
|
class CWorkspace {
|
2022-12-16 17:17:31 +00:00
|
|
|
public:
|
2024-10-27 18:45:38 +00:00
|
|
|
static PHLWORKSPACE create(WORKSPACEID id, PHLMONITOR monitor, std::string name, bool special = false, bool isEmpty = true);
|
2024-04-02 20:32:39 +01:00
|
|
|
// use create() don't use this
|
2024-10-27 18:45:38 +00:00
|
|
|
CWorkspace(WORKSPACEID id, PHLMONITOR monitor, 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
|
2024-10-27 18:45:38 +00:00
|
|
|
WORKSPACEID m_iID = WORKSPACE_INVALID;
|
|
|
|
|
std::string m_szName = "";
|
|
|
|
|
PHLMONITORREF m_pMonitor;
|
2024-06-23 00:52:42 +03:00
|
|
|
// Previous workspace ID and name is stored during a workspace change, allowing travel
|
2022-08-21 20:21:21 +10:00
|
|
|
// to the previous workspace.
|
2024-06-23 00:52:42 +03:00
|
|
|
SWorkspaceIDName m_sPrevWorkspace, m_sPrevWorkspacePerMonitor;
|
2023-03-13 15:19:25 +00:00
|
|
|
|
2024-06-23 00:52:42 +03:00
|
|
|
bool m_bHasFullscreenWindow = false;
|
2024-07-31 17:55:52 +00:00
|
|
|
eFullscreenMode m_efFullscreenMode = FSMODE_NONE;
|
2022-04-11 19:51:37 +02:00
|
|
|
|
2024-06-23 00:52:42 +03: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 10:09:42 +01:00
|
|
|
// allows damage to propagate.
|
|
|
|
|
bool m_bVisible = false;
|
|
|
|
|
|
2022-05-31 14:01:00 +02:00
|
|
|
// "scratchpad"
|
2022-12-16 17:17:31 +00: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 12:43:12 +01: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 21:09:50 +01:00
|
|
|
bool m_bDefaultFloating = false;
|
|
|
|
|
bool m_bDefaultPseudo = false;
|
|
|
|
|
|
2023-05-03 15:15:56 +01:00
|
|
|
// last monitor (used on reconnect)
|
|
|
|
|
std::string m_szLastMonitor = "";
|
2022-05-26 19:05:32 +02:00
|
|
|
|
2024-08-26 05:25:52 -05:00
|
|
|
bool m_bWasCreatedEmpty = true;
|
2024-05-11 20:03:32 -03:00
|
|
|
|
2024-04-06 19:53:32 +05:00
|
|
|
bool m_bPersistent = false;
|
2024-04-05 19:32:05 +01:00
|
|
|
|
2024-04-02 20:32:39 +01:00
|
|
|
// Inert: destroyed and invalid. If this is true, release the ptr you have.
|
2024-06-23 00:52:42 +03:00
|
|
|
bool inert();
|
2023-10-22 19:11:03 -03:00
|
|
|
|
2024-06-23 00:52:42 +03:00
|
|
|
void startAnim(bool in, bool left, bool instant = false);
|
|
|
|
|
void setActive(bool on);
|
2022-05-30 20:51:45 +02:00
|
|
|
|
2024-08-08 21:01:50 +02:00
|
|
|
void moveToMonitor(const MONITORID&);
|
2024-10-27 18:45:38 +00:00
|
|
|
MONITORID monitorID();
|
2022-09-01 11:46:36 +02:00
|
|
|
|
2024-06-23 00:52:42 +03:00
|
|
|
PHLWINDOW getLastFocusedWindow();
|
|
|
|
|
void rememberPrevWorkspace(const PHLWORKSPACE& prevWorkspace);
|
2023-05-01 15:39:08 +01:00
|
|
|
|
2024-06-23 00:52:42 +03:00
|
|
|
std::string getConfigName();
|
2024-03-19 20:56:20 +00:00
|
|
|
|
2024-06-23 00:52:42 +03:00
|
|
|
bool matchesStaticSelector(const std::string& selector);
|
2024-04-02 12:10:03 +01:00
|
|
|
|
2024-06-23 00:52:42 +03:00
|
|
|
void markInert();
|
|
|
|
|
|
|
|
|
|
SWorkspaceIDName getPrevWorkspaceIDName(bool perMonitor) const;
|
2024-04-02 20:32:39 +01:00
|
|
|
|
2024-04-02 12:10:03 +01:00
|
|
|
private:
|
2024-05-05 17:16:00 +01:00
|
|
|
void init(PHLWORKSPACE self);
|
2024-04-02 20:32:39 +01:00
|
|
|
|
2024-05-05 17:16:00 +01: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 20:32:39 +01:00
|
|
|
|
|
|
|
|
inline bool valid(const PHLWORKSPACE& ref) {
|
|
|
|
|
if (!ref)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return !ref->inert();
|
|
|
|
|
}
|