aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/layout/MasterLayout.hpp
diff options
context:
space:
mode:
authormemchr <[email protected]>2023-09-20 15:25:03 +0000
committerGitHub <[email protected]>2023-09-20 16:25:03 +0100
commit3785defaf12b9d99137b2f4c74ab82c51cf733e1 (patch)
treec064adb3ec5eedd612bbc850976bc73ddbe7d15a /src/layout/MasterLayout.hpp
parent6594b50e57935dd66930ccd35dba7a1b4131399d (diff)
downloadHyprland-3785defaf12b9d99137b2f4c74ab82c51cf733e1.tar.gz
Hyprland-3785defaf12b9d99137b2f4c74ab82c51cf733e1.zip
logging: implement std::formatter for some types (#3380)
Diffstat (limited to 'src/layout/MasterLayout.hpp')
-rw-r--r--src/layout/MasterLayout.hpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/layout/MasterLayout.hpp b/src/layout/MasterLayout.hpp
index fd38b915..aa201505 100644
--- a/src/layout/MasterLayout.hpp
+++ b/src/layout/MasterLayout.hpp
@@ -10,8 +10,7 @@
enum eFullscreenMode : uint8_t;
//orientation determines which side of the screen the master area resides
-enum eOrientation : uint8_t
-{
+enum eOrientation : uint8_t {
ORIENTATION_LEFT = 0,
ORIENTATION_TOP,
ORIENTATION_RIGHT,
@@ -33,7 +32,7 @@ struct SMasterNodeData {
int workspaceID = -1;
bool operator==(const SMasterNodeData& rhs) const {
- return pWindow == rhs.pWindow;
+ return pWindow == rhs.pWindow;
}
};
@@ -42,7 +41,7 @@ struct SMasterWorkspaceData {
eOrientation orientation = ORIENTATION_LEFT;
bool operator==(const SMasterWorkspaceData& rhs) const {
- return workspaceID == rhs.workspaceID;
+ return workspaceID == rhs.workspaceID;
}
};
@@ -89,3 +88,19 @@ class CHyprMasterLayout : public IHyprLayout {
friend struct SMasterNodeData;
friend struct SMasterWorkspaceData;
};
+
+template <typename CharT>
+struct std::formatter<SMasterNodeData*, CharT> : std::formatter<CharT> {
+ template <typename FormatContext>
+ auto format(const SMasterNodeData* const& node, FormatContext& ctx) const {
+ auto out = ctx.out();
+ if (!node)
+ return std::format_to(out, "[Node nullptr]");
+ std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->position, node->size);
+ if (node->isMaster)
+ std::format_to(out, ", master");
+ if (node->pWindow)
+ std::format_to(out, ", window: {:x}", node->pWindow);
+ return std::format_to(out, "]");
+ }
+}; \ No newline at end of file