From 3785defaf12b9d99137b2f4c74ab82c51cf733e1 Mon Sep 17 00:00:00 2001 From: memchr <118117622+memchr@users.noreply.github.com> Date: Wed, 20 Sep 2023 15:25:03 +0000 Subject: logging: implement std::formatter for some types (#3380) --- src/layout/DwindleLayout.hpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/layout/DwindleLayout.hpp') diff --git a/src/layout/DwindleLayout.hpp b/src/layout/DwindleLayout.hpp index 66c117fc..993f8cb7 100644 --- a/src/layout/DwindleLayout.hpp +++ b/src/layout/DwindleLayout.hpp @@ -1,11 +1,12 @@ #pragma once #include "IHyprLayout.hpp" + #include #include -#include "../render/decorations/CHyprGroupBarDecoration.hpp" #include #include +#include class CHyprDwindleLayout; enum eFullscreenMode : uint8_t; @@ -85,3 +86,17 @@ class CHyprDwindleLayout : public IHyprLayout { friend struct SDwindleNodeData; }; + +template +struct std::formatter : std::formatter { + template + auto format(const SDwindleNodeData* 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->isNode && node->pWindow) + std::format_to(out, ", window: {:x}", node->pWindow); + return std::format_to(out, "]"); + } +}; \ No newline at end of file -- cgit v1.2.3