mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-17 21:13:48 -07:00
logging: implement std::formatter for some types (#3380)
This commit is contained in:
@@ -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, "]");
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user