summaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2022-12-16 17:17:31 +0000
committerGitHub <noreply@github.com>2022-12-16 17:17:31 +0000
commit98a4fa2b0d79298fa29b048a3ba15c3bf5aed8cd (patch)
tree64e78342cf08e5f9ad87bd5f6ea36233133be7bb /src/debug
parent7c33c7fc64203c17b4f3625a16ae6b4774992c0e (diff)
Added clang format (#1239)
* clang-format stuff and format files
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/HyprCtl.cpp277
-rw-r--r--src/debug/HyprCtl.hpp15
-rw-r--r--src/debug/HyprDebugOverlay.cpp30
-rw-r--r--src/debug/HyprDebugOverlay.hpp28
-rw-r--r--src/debug/Log.cpp31
-rw-r--r--src/debug/Log.hpp15
6 files changed, 186 insertions, 210 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 10a7febd..b445b112 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -20,7 +20,7 @@ std::string monitorsRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& m : g_pCompositor->m_vMonitors) {
result += getFormat(
-R"#({
+ R"#({
"id": %i,
"name": "%s",
"description": "%s",
@@ -39,19 +39,11 @@ R"#({
"focused": %s,
"dpmsStatus": %s
},)#",
- m->ID,
- escapeJSONStrings(m->szName).c_str(),
- escapeJSONStrings(m->output->description ? m->output->description : "").c_str(),
- (int)m->vecPixelSize.x, (int)m->vecPixelSize.y,
- m->refreshRate,
- (int)m->vecPosition.x, (int)m->vecPosition.y,
- m->activeWorkspace, escapeJSONStrings(g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName).c_str(),
- (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y,
- m->scale,
- (int)m->transform,
- (m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false"),
- (m->dpmsStatus ? "true" : "false")
- );
+ m->ID, escapeJSONStrings(m->szName).c_str(), escapeJSONStrings(m->output->description ? m->output->description : "").c_str(), (int)m->vecPixelSize.x,
+ (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->activeWorkspace,
+ escapeJSONStrings(g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName).c_str(), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y,
+ (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false"),
+ (m->dpmsStatus ? "true" : "false"));
}
// remove trailing comma
@@ -60,8 +52,12 @@ R"#({
result += "]";
} else {
for (auto& m : g_pCompositor->m_vMonitors) {
- result += getFormat("Monitor %s (ID %i):\n\t%ix%i@%f at %ix%i\n\tdescription: %s\n\tactive workspace: %i (%s)\n\treserved: %i %i %i %i\n\tscale: %.2f\n\ttransform: %i\n\tfocused: %s\n\tdpmsStatus: %i\n\n",
- m->szName.c_str(), m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, (m->output->description ? m->output->description : ""), m->activeWorkspace, g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName.c_str(), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->dpmsStatus);
+ result += getFormat("Monitor %s (ID %i):\n\t%ix%i@%f at %ix%i\n\tdescription: %s\n\tactive workspace: %i (%s)\n\treserved: %i %i %i %i\n\tscale: %.2f\n\ttransform: "
+ "%i\n\tfocused: %s\n\tdpmsStatus: %i\n\n",
+ m->szName.c_str(), m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y,
+ (m->output->description ? m->output->description : ""), m->activeWorkspace, g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName.c_str(),
+ (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale,
+ (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->dpmsStatus);
}
}
@@ -74,16 +70,16 @@ static std::string getGroupedData(CWindow* w, HyprCtl::eHyprCtlOutputFormat form
return isJson ? "" : "0";
SLayoutMessageHeader header;
- header.pWindow = w;
+ header.pWindow = w;
const auto groupMembers = std::any_cast<std::deque<CWindow*>>(g_pLayoutManager->getCurrentLayout()->layoutMessage(header, "groupinfo"));
if (groupMembers.empty())
return isJson ? "" : "0";
- const auto comma = isJson ? ", " : ",";
- const auto fmt = isJson ? "\"0x%x\"" : "%x";
+ const auto comma = isJson ? ", " : ",";
+ const auto fmt = isJson ? "\"0x%x\"" : "%x";
std::ostringstream result;
- bool first = true;
+ bool first = true;
for (auto& gw : groupMembers) {
if (first)
first = false;
@@ -99,7 +95,7 @@ static std::string getGroupedData(CWindow* w, HyprCtl::eHyprCtlOutputFormat form
static std::string getWindowData(CWindow* w, HyprCtl::eHyprCtlOutputFormat format) {
if (format == HyprCtl::FORMAT_JSON) {
return getFormat(
-R"#({
+ R"#({
"address": "0x%x",
"at": [%i, %i],
"size": [%i, %i],
@@ -119,25 +115,29 @@ R"#({
"grouped": [%s],
"swallowing": %s
},)#",
- w,
- (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y,
- (int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y,
- w->m_iWorkspaceID, escapeJSONStrings(w->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName : std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID))).c_str(),
- ((int)w->m_bIsFloating == 1 ? "true" : "false"),
- w->m_iMonitorID,
- escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)).c_str(),
- escapeJSONStrings(g_pXWaylandManager->getTitle(w)).c_str(),
- w->getPID(),
- ((int)w->m_bIsX11 == 1 ? "true" : "false"),
- (w->m_bPinned ? "true" : "false"),
- (w->m_bIsFullscreen ? "true" : "false"),
- (w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0),
- getGroupedData(w, format).c_str(),
- (w->m_pSwallowed ? getFormat("\"0x%x\"", w->m_pSwallowed).c_str() : "null")
- );
+ w, (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y, (int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y, w->m_iWorkspaceID,
+ escapeJSONStrings(w->m_iWorkspaceID == -1 ? "" :
+ g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName :
+ std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)))
+ .c_str(),
+ ((int)w->m_bIsFloating == 1 ? "true" : "false"), w->m_iMonitorID, escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)).c_str(),
+ escapeJSONStrings(g_pXWaylandManager->getTitle(w)).c_str(), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"),
+ (w->m_bIsFullscreen ? "true" : "false"),
+ (w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0),
+ getGroupedData(w, format).c_str(), (w->m_pSwallowed ? getFormat("\"0x%x\"", w->m_pSwallowed).c_str() : "null"));
} else {
- return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: %s\n\tpid: %i\n\txwayland: %i\n\tpinned: %i\n\tfullscreen: %i\n\tfullscreenmode: %i\n\tgrouped: %s\n\tswallowing: %x\n\n",
- w, w->m_szTitle.c_str(), (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y, (int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y, w->m_iWorkspaceID, (w->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName.c_str() : std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)).c_str()), (int)w->m_bIsFloating, w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w).c_str(), g_pXWaylandManager->getTitle(w).c_str(), w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned, (int)w->m_bIsFullscreen, (w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0), getGroupedData(w, format).c_str(), w->m_pSwallowed);
+ return getFormat(
+ "Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: %s\n\tpid: %i\n\txwayland: %i\n\tpinned: "
+ "%i\n\tfullscreen: %i\n\tfullscreenmode: %i\n\tgrouped: %s\n\tswallowing: %x\n\n",
+ w, w->m_szTitle.c_str(), (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y, (int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y,
+ w->m_iWorkspaceID,
+ (w->m_iWorkspaceID == -1 ? "" :
+ g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName.c_str() :
+ std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)).c_str()),
+ (int)w->m_bIsFloating, w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w).c_str(), g_pXWaylandManager->getTitle(w).c_str(), w->getPID(), (int)w->m_bIsX11,
+ (int)w->m_bPinned, (int)w->m_bIsFullscreen,
+ (w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0),
+ getGroupedData(w, format).c_str(), w->m_pSwallowed);
}
}
@@ -154,7 +154,7 @@ std::string clientsRequest(HyprCtl::eHyprCtlOutputFormat format) {
// remove trailing comma
if (result != "[")
- result.pop_back();
+ result.pop_back();
result += "]";
} else {
@@ -176,7 +176,7 @@ std::string workspacesRequest(HyprCtl::eHyprCtlOutputFormat format) {
const auto PLASTW = w->getLastFocusedWindow();
result += getFormat(
-R"#({
+ R"#({
"id": %i,
"name": "%s",
"monitor": "%s",
@@ -185,14 +185,9 @@ R"#({
"lastwindow": "0x%x",
"lastwindowtitle": "%s"
},)#",
- w->m_iID,
- escapeJSONStrings(w->m_szName).c_str(),
- escapeJSONStrings(g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName).c_str(),
- g_pCompositor->getWindowsOnWorkspace(w->m_iID),
- ((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"),
- PLASTW,
- PLASTW ? escapeJSONStrings(PLASTW->m_szTitle).c_str() : ""
- );
+ w->m_iID, escapeJSONStrings(w->m_szName).c_str(), escapeJSONStrings(g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName).c_str(),
+ g_pCompositor->getWindowsOnWorkspace(w->m_iID), ((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"), PLASTW,
+ PLASTW ? escapeJSONStrings(PLASTW->m_szTitle).c_str() : "");
}
// remove trailing comma
@@ -202,8 +197,9 @@ R"#({
} else {
for (auto& w : g_pCompositor->m_vWorkspaces) {
const auto PLASTW = w->getLastFocusedWindow();
- result += getFormat("workspace ID %i (%s) on monitor %s:\n\twindows: %i\n\thasfullscreen: %i\n\tlastwindow: 0x%x\n\tlastwindowtitle: %s\n\n",
- w->m_iID, w->m_szName.c_str(), g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName.c_str(), g_pCompositor->getWindowsOnWorkspace(w->m_iID), (int)w->m_bHasFullscreenWindow, PLASTW, PLASTW ? PLASTW->m_szTitle.c_str() : "");
+ result += getFormat("workspace ID %i (%s) on monitor %s:\n\twindows: %i\n\thasfullscreen: %i\n\tlastwindow: 0x%x\n\tlastwindowtitle: %s\n\n", w->m_iID,
+ w->m_szName.c_str(), g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName.c_str(), g_pCompositor->getWindowsOnWorkspace(w->m_iID),
+ (int)w->m_bHasFullscreenWindow, PLASTW, PLASTW ? PLASTW->m_szTitle.c_str() : "");
}
}
return result;
@@ -216,7 +212,7 @@ std::string activeWindowRequest(HyprCtl::eHyprCtlOutputFormat format) {
return format == HyprCtl::FORMAT_JSON ? "{}" : "Invalid";
auto result = getWindowData(PWINDOW, format);
-
+
if (format == HyprCtl::FORMAT_JSON)
result.pop_back();
@@ -231,23 +227,21 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& mon : g_pCompositor->m_vMonitors) {
result += getFormat(
-R"#("%s": {
+ R"#("%s": {
"levels": {
)#",
- escapeJSONStrings(mon->szName).c_str()
- );
+ escapeJSONStrings(mon->szName).c_str());
int layerLevel = 0;
for (auto& level : mon->m_aLayerSurfaceLists) {
result += getFormat(
-R"#(
+ R"#(
"%i": [
)#",
- layerLevel
- );
+ layerLevel);
for (auto& layer : level) {
result += getFormat(
-R"#( {
+ R"#( {
"address": "0x%x",
"x": %i,
"y": %i,
@@ -255,13 +249,7 @@ R"#( {
"h": %i,
"namespace": "%s"
},)#",
- layer.get(),
- layer->geometry.x,
- layer->geometry.y,
- layer->geometry.width,
- layer->geometry.height,
- escapeJSONStrings(layer->szNamespace).c_str()
- );
+ layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, escapeJSONStrings(layer->szNamespace).c_str());
}
// remove trailing comma
@@ -294,7 +282,8 @@ R"#( {
result += getFormat("\tLayer level %i:\n", layerLevel);
for (auto& layer : level) {
- result += getFormat("\t\tLayer %x: xywh: %i %i %i %i, namespace: %s\n", layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, layer->szNamespace.c_str());
+ result += getFormat("\t\tLayer %x: xywh: %i %i %i %i, namespace: %s\n", layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width,
+ layer->geometry.height, layer->szNamespace.c_str());
}
layerLevel++;
@@ -315,15 +304,13 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& m : g_pInputManager->m_lMice) {
result += getFormat(
-R"#( {
+ R"#( {
"address": "0x%x",
"name": "%s",
"defaultSpeed": %f
},)#",
- &m,
- escapeJSONStrings(m.name).c_str(),
- wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f
- );
+ &m, escapeJSONStrings(m.name).c_str(),
+ wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f);
}
// remove trailing comma
@@ -334,7 +321,7 @@ R"#( {
for (auto& k : g_pInputManager->m_lKeyboards) {
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k);
result += getFormat(
-R"#( {
+ R"#( {
"address": "0x%x",
"name": "%s",
"rules": "%s",
@@ -345,16 +332,9 @@ R"#( {
"active_keymap": "%s",
"main": %s
},)#",
- &k,
- escapeJSONStrings(k.name).c_str(),
- escapeJSONStrings(k.currentRules.rules).c_str(),
- escapeJSONStrings(k.currentRules.model).c_str(),
- escapeJSONStrings(k.currentRules.layout).c_str(),
- escapeJSONStrings(k.currentRules.variant).c_str(),
- escapeJSONStrings(k.currentRules.options).c_str(),
- escapeJSONStrings(KM).c_str(),
- (k.active ? "true" : "false")
- );
+ &k, escapeJSONStrings(k.name).c_str(), escapeJSONStrings(k.currentRules.rules).c_str(), escapeJSONStrings(k.currentRules.model).c_str(),
+ escapeJSONStrings(k.currentRules.layout).c_str(), escapeJSONStrings(k.currentRules.variant).c_str(), escapeJSONStrings(k.currentRules.options).c_str(),
+ escapeJSONStrings(KM).c_str(), (k.active ? "true" : "false"));
}
// remove trailing comma
@@ -365,7 +345,7 @@ R"#( {
for (auto& d : g_pInputManager->m_lTabletPads) {
result += getFormat(
-R"#( {
+ R"#( {
"address": "0x%x",
"type": "tabletPad",
"belongsTo": {
@@ -373,33 +353,26 @@ R"#( {
"name": "%s"
}
},)#",
- &d,
- d.pTabletParent,
- escapeJSONStrings(d.pTabletParent ? d.pTabletParent->name : "").c_str()
- );
+ &d, d.pTabletParent, escapeJSONStrings(d.pTabletParent ? d.pTabletParent->name : "").c_str());
}
for (auto& d : g_pInputManager->m_lTablets) {
result += getFormat(
-R"#( {
+ R"#( {
"address": "0x%x",
"name": "%s"
},)#",
- &d,
- escapeJSONStrings(d.name).c_str()
- );
+ &d, escapeJSONStrings(d.name).c_str());
}
for (auto& d : g_pInputManager->m_lTabletTools) {
result += getFormat(
-R"#( {
+ R"#( {
"address": "0x%x",
"type": "tabletTool",
"belongsTo": "0x%x"
},)#",
- &d,
- d.wlrTabletTool ? d.wlrTabletTool->data : 0
- );
+ &d, d.wlrTabletTool ? d.wlrTabletTool->data : 0);
}
// remove trailing comma
@@ -410,13 +383,11 @@ R"#( {
for (auto& d : g_pInputManager->m_lTouchDevices) {
result += getFormat(
-R"#( {
+ R"#( {
"address": "0x%x",
"name": "%s"
},)#",
- &d,
- d.name.c_str()
- );
+ &d, d.name.c_str());
}
// remove trailing comma
@@ -428,13 +399,11 @@ R"#( {
for (auto& d : g_pInputManager->m_lSwitches) {
result += getFormat(
-R"#( {
+ R"#( {
"address": "0x%x",
"name": "%s"
},)#",
- &d,
- d.pWlrDevice ? d.pWlrDevice->name : ""
- );
+ &d, d.pWlrDevice ? d.pWlrDevice->name : "");
}
// remove trailing comma
@@ -448,14 +417,18 @@ R"#( {
result += "mice:\n";
for (auto& m : g_pInputManager->m_lMice) {
- result += getFormat("\tMouse at %x:\n\t\t%s\n\t\t\tdefault speed: %f\n", &m, m.name.c_str(), (wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f));
+ result += getFormat(
+ "\tMouse at %x:\n\t\t%s\n\t\t\tdefault speed: %f\n", &m, m.name.c_str(),
+ (wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f));
}
result += "\n\nKeyboards:\n";
for (auto& k : g_pInputManager->m_lKeyboards) {
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k);
- result += getFormat("\tKeyboard at %x:\n\t\t%s\n\t\t\trules: r \"%s\", m \"%s\", l \"%s\", v \"%s\", o \"%s\"\n\t\t\tactive keymap: %s\n\t\t\tmain: %s\n", &k, k.name.c_str(), k.currentRules.rules.c_str(), k.currentRules.model.c_str(), k.currentRules.layout.c_str(), k.currentRules.variant.c_str(), k.currentRules.options.c_str(), KM.c_str(), (k.active ? "yes" : "no"));
+ result += getFormat("\tKeyboard at %x:\n\t\t%s\n\t\t\trules: r \"%s\", m \"%s\", l \"%s\", v \"%s\", o \"%s\"\n\t\t\tactive keymap: %s\n\t\t\tmain: %s\n", &k,
+ k.name.c_str(), k.currentRules.rules.c_str(), k.currentRules.model.c_str(), k.currentRules.layout.c_str(), k.currentRules.variant.c_str(),
+ k.currentRules.options.c_str(), KM.c_str(), (k.active ? "yes" : "no"));
}
result += "\n\nTablets:\n";
@@ -491,7 +464,8 @@ R"#( {
std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
- std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + GIT_DIRTY + " (" + removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str() + ").\nflags: (if any)\n";
+ std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + GIT_DIRTY + " (" +
+ removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str() + ").\nflags: (if any)\n";
#ifdef LEGACY_RENDERER
result += "legacyrenderer\n";
@@ -500,7 +474,7 @@ std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
result += "debug\n";
#endif
#ifdef HYPRLAND_DEBUG
- result += "debug\n";
+ result += "debug\n";
#endif
#ifdef NO_XWAYLAND
result += "no xwayland\n";
@@ -509,12 +483,13 @@ std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
return result;
} else {
std::string result = getFormat(
-R"#({
+ R"#({
"branch": "%s",
"commit": "%s",
"dirty": %s,
"commit_message": "%s",
- "flags": [)#", GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str());
+ "flags": [)#",
+ GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str());
#ifdef LEGACY_RENDERER
result += "\"legacyrenderer\",";
@@ -523,7 +498,7 @@ R"#({
result += "\"debug\",";
#endif
#ifdef HYPRLAND_DEBUG
- result += "\"debug\",";
+ result += "\"debug\",";
#endif
#ifdef NO_XWAYLAND
result += "\"no xwayland\",";
@@ -563,9 +538,9 @@ std::string dispatchKeyword(std::string in) {
// get rid of the keyword keyword
in = in.substr(in.find_first_of(' ') + 1);
- const auto COMMAND = in.substr(0, in.find_first_of(' '));
+ const auto COMMAND = in.substr(0, in.find_first_of(' '));
- const auto VALUE = in.substr(in.find_first_of(' ') + 1);
+ const auto VALUE = in.substr(in.find_first_of(' ') + 1);
std::string retval = g_pConfigManager->parseKeyword(COMMAND, VALUE, true);
@@ -573,14 +548,14 @@ std::string dispatchKeyword(std::string in) {
g_pConfigManager->m_bWantsMonitorReload = true; // for monitor keywords
if (COMMAND.contains("input") || COMMAND.contains("device:")) {
- g_pInputManager->setKeyboardLayout(); // update kb layout
- g_pInputManager->setPointerConfigs(); // update mouse cfgs
+ g_pInputManager->setKeyboardLayout(); // update kb layout
+ g_pInputManager->setPointerConfigs(); // update mouse cfgs
g_pInputManager->setTouchDeviceConfigs(); // update touch device cfgs
}
if (COMMAND.contains("general:layout"))
- g_pLayoutManager->switchToLayout(g_pConfigManager->getString("general:layout")); // update layout
-
+ g_pLayoutManager->switchToLayout(g_pConfigManager->getString("general:layout")); // update layout
+
if (COMMAND.contains("decoration:screen_shader"))
g_pHyprOpenGL->m_bReloadScreenShader = true;
@@ -592,7 +567,7 @@ std::string dispatchKeyword(std::string in) {
return retval;
}
-std::string reloadRequest(std::string request) {
+std::string reloadRequest(const std::string& request) {
const auto REQMODE = request.substr(request.find_last_of(' ') + 1);
@@ -628,7 +603,8 @@ std::string cursorPosRequest(HyprCtl::eHyprCtlOutputFormat format) {
"x": %i,
"y": %i
}
-)#", (int)CURSORPOS.x, (int)CURSORPOS.y);
+)#",
+ (int)CURSORPOS.x, (int)CURSORPOS.y);
}
return "error";
@@ -639,11 +615,11 @@ std::string getReply(std::string);
std::string dispatchBatch(std::string request) {
// split by ;
- request = request.substr(9);
+ request = request.substr(9);
std::string curitem = "";
- std::string reply = "";
+ std::string reply = "";
- auto nextItem = [&]() {
+ auto nextItem = [&]() {
auto idx = request.find_first_of(';');
if (idx != std::string::npos) {
@@ -671,7 +647,7 @@ std::string dispatchBatch(std::string request) {
std::string dispatchSetCursor(std::string request) {
std::string curitem = "";
- auto nextItem = [&]() {
+ auto nextItem = [&]() {
auto idx = request.find_first_of(' ');
if (idx != std::string::npos) {
@@ -718,20 +694,21 @@ std::string dispatchSetCursor(std::string request) {
return "ok";
}
-std::string switchXKBLayoutRequest(std::string request) {
- CVarList vars(request, 0, ' ');
+std::string switchXKBLayoutRequest(const std::string& request) {
+ CVarList vars(request, 0, ' ');
- const auto KB = vars[1];
+ const auto KB = vars[1];
const auto CMD = vars[2];
// get kb
- const auto PKEYBOARD = std::find_if(g_pInputManager->m_lKeyboards.begin(), g_pInputManager->m_lKeyboards.end(), [&] (const SKeyboard& other) { return other.name == g_pInputManager->deviceNameToInternalString(KB); });
+ const auto PKEYBOARD = std::find_if(g_pInputManager->m_lKeyboards.begin(), g_pInputManager->m_lKeyboards.end(),
+ [&](const SKeyboard& other) { return other.name == g_pInputManager->deviceNameToInternalString(KB); });
if (PKEYBOARD == g_pInputManager->m_lKeyboards.end())
return "device not found";
- const auto PWLRKEYBOARD = wlr_keyboard_from_input_device(PKEYBOARD->keyboard);
- const auto LAYOUTS = xkb_keymap_num_layouts(PWLRKEYBOARD->keymap);
+ const auto PWLRKEYBOARD = wlr_keyboard_from_input_device(PKEYBOARD->keyboard);
+ const auto LAYOUTS = xkb_keymap_num_layouts(PWLRKEYBOARD->keymap);
xkb_layout_index_t activeLayout = 0;
while (activeLayout < LAYOUTS) {
if (xkb_state_layout_index_is_active(PWLRKEYBOARD->xkb_state, activeLayout, XKB_STATE_LAYOUT_EFFECTIVE))
@@ -741,23 +718,23 @@ std::string switchXKBLayoutRequest(std::string request) {
}
if (CMD == "next") {
- wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked, activeLayout > LAYOUTS ? 0 : activeLayout + 1);
+ wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked,
+ activeLayout > LAYOUTS ? 0 : activeLayout + 1);
} else if (CMD == "prev") {
- wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked, activeLayout == 0 ? LAYOUTS - 1 : activeLayout - 1);
+ wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked,
+ activeLayout == 0 ? LAYOUTS - 1 : activeLayout - 1);
} else {
-
+
int requestedLayout = 0;
try {
requestedLayout = std::stoi(CMD);
- } catch (std::exception& e) {
- return "invalid arg 2";
- }
+ } catch (std::exception& e) { return "invalid arg 2"; }
if (requestedLayout < 0 || (uint64_t)requestedLayout > LAYOUTS - 1) {
return "layout idx out of range of " + std::to_string(LAYOUTS);
}
- wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked, requestedLayout);
+ wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked, requestedLayout);
}
return "ok";
@@ -766,7 +743,7 @@ std::string switchXKBLayoutRequest(std::string request) {
std::string dispatchGetOption(std::string request, HyprCtl::eHyprCtlOutputFormat format) {
std::string curitem = "";
- auto nextItem = [&]() {
+ auto nextItem = [&]() {
auto idx = request.find_first_of(' ');
if (idx != std::string::npos) {
@@ -789,10 +766,11 @@ std::string dispatchGetOption(std::string request, HyprCtl::eHyprCtlOutputFormat
return "no such option";
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL)
- return getFormat("option %s\n\tint: %lld\n\tfloat: %f\n\tstr: \"%s\"\n\tdata: %x", curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(), PCFGOPT->data.get());
+ return getFormat("option %s\n\tint: %lld\n\tfloat: %f\n\tstr: \"%s\"\n\tdata: %x", curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(),
+ PCFGOPT->data.get());
else {
return getFormat(
-R"#(
+ R"#(
{
"option": "%s",
"int": %lld,
@@ -800,8 +778,8 @@ R"#(
"str": "%s",
"data": "0x%x"
}
-)#", curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(), PCFGOPT->data.get()
- );
+)#",
+ curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(), PCFGOPT->data.get());
}
}
@@ -839,7 +817,7 @@ void createOutputIter(wlr_backend* backend, void* data) {
std::string dispatchOutput(std::string request) {
std::string curitem = "";
- auto nextItem = [&]() {
+ auto nextItem = [&]() {
auto idx = request.find_first_of(' ');
if (idx != std::string::npos) {
@@ -863,7 +841,7 @@ std::string dispatchOutput(std::string request) {
const auto NAME = curitem;
if (MODE == "create" || MODE == "add") {
- std::pair<std::string, bool> result = { NAME, false };
+ std::pair<std::string, bool> result = {NAME, false};
wlr_multi_for_each_backend(g_pCompositor->m_sWLRBackend, createOutputIter, &result);
@@ -951,13 +929,13 @@ int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
return 0;
sockaddr_in clientAddress;
- socklen_t clientSize = sizeof(clientAddress);
+ socklen_t clientSize = sizeof(clientAddress);
- const auto ACCEPTEDCONNECTION = accept(HyprCtl::iSocketFD, (sockaddr*)&clientAddress, &clientSize);
+ const auto ACCEPTEDCONNECTION = accept(HyprCtl::iSocketFD, (sockaddr*)&clientAddress, &clientSize);
- char readBuffer[1024];
+ char readBuffer[1024];
- auto messageSize = read(ACCEPTEDCONNECTION, readBuffer, 1024);
+ auto messageSize = read(ACCEPTEDCONNECTION, readBuffer, 1024);
readBuffer[messageSize == 1024 ? 1023 : messageSize] = '\0';
std::string request(readBuffer);
@@ -997,7 +975,10 @@ void HyprCtl::startHyprCtlSocket() {
strcpy(SERVERADDRESS.sun_path, socketPath.c_str());
- bind(iSocketFD, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS));
+ if (bind(iSocketFD, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) {
+ Debug::log(ERR, "Couldn't start the Hyprland Socket. (2) IPC will not work.");
+ return;
+ }
// 10 max queued.
listen(iSocketFD, 10);
diff --git a/src/debug/HyprCtl.hpp b/src/debug/HyprCtl.hpp
index 0dd4f741..26859692 100644
--- a/src/debug/HyprCtl.hpp
+++ b/src/debug/HyprCtl.hpp
@@ -5,20 +5,21 @@
#include "../helpers/MiscFunctions.hpp"
namespace HyprCtl {
- void startHyprCtlSocket();
+ void startHyprCtlSocket();
// very simple thread-safe request method
- inline bool requestMade = false;
- inline bool requestReady = false;
- inline std::string request = "";
+ inline bool requestMade = false;
+ inline bool requestReady = false;
+ inline std::string request = "";
- inline std::ifstream requestStream;
+ inline std::ifstream requestStream;
inline wl_event_source* hyprCtlTickSource = nullptr;
- inline int iSocketFD = -1;
+ inline int iSocketFD = -1;
- enum eHyprCtlOutputFormat {
+ enum eHyprCtlOutputFormat
+ {
FORMAT_NORMAL = 0,
FORMAT_JSON
};
diff --git a/src/debug/HyprDebugOverlay.cpp b/src/debug/HyprDebugOverlay.cpp
index 4fc370b6..e73b8b3f 100644
--- a/src/debug/HyprDebugOverlay.cpp
+++ b/src/debug/HyprDebugOverlay.cpp
@@ -38,10 +38,10 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
if (!m_pMonitor)
return 0;
- int yOffset = offset;
+ int yOffset = offset;
cairo_text_extents_t cairoExtents;
- float maxX = 0;
- std::string text = "";
+ float maxX = 0;
+ std::string text = "";
// get avg fps
float avgFrametime = 0;
@@ -62,7 +62,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
}
avgRenderTimeNoOverlay /= m_dLastRenderTimes.size() == 0 ? 1 : m_dLastRenderTimes.size();
- const float FPS = 1.f / (avgFrametime / 1000.f); // frametimes are in ms
+ const float FPS = 1.f / (avgFrametime / 1000.f); // frametimes are in ms
const float idealFPS = m_dLastFrametimes.size();
cairo_select_font_face(g_pDebugOverlay->m_pCairo, "Noto Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
@@ -75,7 +75,8 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
text = m_pMonitor->szName;
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
- if (cairoExtents.width > maxX) maxX = cairoExtents.width;
+ if (cairoExtents.width > maxX)
+ maxX = cairoExtents.width;
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 16);
@@ -91,7 +92,8 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
text = std::string(std::to_string((int)FPS) + " FPS");
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
- if (cairoExtents.width > maxX) maxX = cairoExtents.width;
+ if (cairoExtents.width > maxX)
+ maxX = cairoExtents.width;
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 10);
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 1.f, 1.f);
@@ -101,26 +103,30 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
text = std::string("Avg Frametime: " + std::to_string((int)avgFrametime) + "." + std::to_string((int)(avgFrametime * 10.f) % 10) + "ms");
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
- if (cairoExtents.width > maxX) maxX = cairoExtents.width;
+ if (cairoExtents.width > maxX)
+ maxX = cairoExtents.width;
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
text = std::string("Avg Rendertime: " + std::to_string((int)avgRenderTime) + "." + std::to_string((int)(avgRenderTime * 10.f) % 10) + "ms");
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
- if (cairoExtents.width > maxX) maxX = cairoExtents.width;
+ if (cairoExtents.width > maxX)
+ maxX = cairoExtents.width;
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
text = std::string("Avg Rendertime (no overlay): " + std::to_string((int)avgRenderTimeNoOverlay) + "." + std::to_string((int)(avgRenderTimeNoOverlay * 10.f) % 10) + "ms");
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
- if (cairoExtents.width > maxX) maxX = cairoExtents.width;
+ if (cairoExtents.width > maxX)
+ maxX = cairoExtents.width;
yOffset += 11;
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
- m_wbLastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset - 1, (int)maxX + 2, yOffset - offset + 2};
+ m_wbLastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset - 1, (int)maxX + 2,
+ yOffset - offset + 2};
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
return yOffset - offset;
@@ -144,7 +150,7 @@ void CHyprDebugOverlay::draw() {
if (!m_pCairoSurface || !m_pCairo) {
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
- m_pCairo = cairo_create(m_pCairoSurface);
+ m_pCairo = cairo_create(m_pCairoSurface);
}
// clear the pixmap
@@ -176,6 +182,6 @@ void CHyprDebugOverlay::draw() {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecSize.x, PMONITOR->vecSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
- wlr_box pMonBox = {0,0,PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
+ wlr_box pMonBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 255.f);
}
diff --git a/src/debug/HyprDebugOverlay.hpp b/src/debug/HyprDebugOverlay.hpp
index 2573a6e1..e1e399a7 100644
--- a/src/debug/HyprDebugOverlay.hpp
+++ b/src/debug/HyprDebugOverlay.hpp
@@ -8,38 +8,36 @@
#include <unordered_map>
class CHyprMonitorDebugOverlay {
-public:
- int draw(int offset);
+ public:
+ int draw(int offset);
void renderData(CMonitor* pMonitor, float µs);
void renderDataNoOverlay(CMonitor* pMonitor, float µs);
void frameData(CMonitor* pMonitor);
-private:
- std::deque<float> m_dLastFrametimes;
- std::deque<float> m_dLastRenderTimes;
- std::deque<float> m_dLastRenderTimesNoOverlay;
+ private:
+ std::deque<float> m_dLastFrametimes;
+ std::deque<float> m_dLastRenderTimes;
+ std::deque<float> m_dLastRenderTimesNoOverlay;
std::chrono::high_resolution_clock::time_point m_tpLastFrame;
- CMonitor* m_pMonitor = nullptr;
- wlr_box m_wbLastDrawnBox;
+ CMonitor* m_pMonitor = nullptr;
+ wlr_box m_wbLastDrawnBox;
};
class CHyprDebugOverlay {
-public:
-
+ public:
void draw();
void renderData(CMonitor*, float µs);
void renderDataNoOverlay(CMonitor*, float µs);
void frameData(CMonitor*);
-private:
-
+ private:
std::unordered_map<CMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
- cairo_surface_t* m_pCairoSurface = nullptr;
- cairo_t* m_pCairo = nullptr;
+ cairo_surface_t* m_pCairoSurface = nullptr;
+ cairo_t* m_pCairo = nullptr;
- CTexture m_tTexture;
+ CTexture m_tTexture;
friend class CHyprMonitorDebugOverlay;
};
diff --git a/src/debug/Log.cpp b/src/debug/Log.cpp
index dab8f0a7..7800b831 100644
--- a/src/debug/Log.cpp
+++ b/src/debug/Log.cpp
@@ -5,12 +5,12 @@
#include <fstream>
#include <iostream>
-void Debug::init(std::string IS) {
+void Debug::init(const std::string& IS) {
logFile = "/tmp/hypr/" + IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
}
void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) {
- char* outputStr = nullptr;
+ char* outputStr = nullptr;
std::ofstream ofs;
ofs.open(logFile, std::ios::out | std::ios::app);
@@ -35,28 +35,17 @@ void Debug::log(LogLevel level, const char* fmt, ...) {
ofs.open(logFile, std::ios::out | std::ios::app);
switch (level) {
- case LOG:
- ofs << "[LOG] ";
- break;
- case WARN:
- ofs << "[WARN] ";
- break;
- case ERR:
- ofs << "[ERR] ";
- break;
- case CRIT:
- ofs << "[CRITICAL] ";
- break;
- case INFO:
- ofs << "[INFO] ";
- break;
- default:
- break;
+ case LOG: ofs << "[LOG] "; break;
+ case WARN: ofs << "[WARN] "; break;
+ case ERR: ofs << "[ERR] "; break;
+ case CRIT: ofs << "[CRITICAL] "; break;
+ case INFO: ofs << "[INFO] "; break;
+ default: break;
}
// print date and time to the ofs
if (disableTime && !*disableTime) {
- auto timet = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
+ auto timet = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
const auto MILLIS = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() % 1000;
ofs << std::put_time(std::localtime(&timet), "[%H:%M:%S:");
@@ -71,7 +60,7 @@ void Debug::log(LogLevel level, const char* fmt, ...) {
ofs << "] ";
}
- char* outputStr = nullptr;
+ char* outputStr = nullptr;
va_list args;
va_start(args, fmt);
diff --git a/src/debug/Log.hpp b/src/debug/Log.hpp
index 8f8f615c..98d176af 100644
--- a/src/debug/Log.hpp
+++ b/src/debug/Log.hpp
@@ -4,9 +4,10 @@
#define LOGMESSAGESIZE 1024
-enum LogLevel {
+enum LogLevel
+{
NONE = -1,
- LOG = 0,
+ LOG = 0,
WARN,
ERR,
CRIT,
@@ -14,11 +15,11 @@ enum LogLevel {
};
namespace Debug {
- void init(std::string IS);
- void log(LogLevel level, const char* fmt, ...);
- void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
+ void init(const std::string& IS);
+ void log(LogLevel level, const char* fmt, ...);
+ void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
inline std::string logFile;
- inline int64_t* disableLogs = nullptr;
- inline int64_t* disableTime = nullptr;
+ inline int64_t* disableLogs = nullptr;
+ inline int64_t* disableTime = nullptr;
}; \ No newline at end of file