aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2023-09-06 12:51:36 +0200
committerGitHub <[email protected]>2023-09-06 12:51:36 +0200
commit61a71c65ace5124cb26a074715280537e6e34d00 (patch)
treeb54cf4d7a0f8477b2958619384982d31663f128f
parentc3a83daa1e61285a418c39a1d9f29427c2c9a2c3 (diff)
downloadHyprland-61a71c65ace5124cb26a074715280537e6e34d00.tar.gz
Hyprland-61a71c65ace5124cb26a074715280537e6e34d00.zip
internal: Formatter rework (#3186)
-rw-r--r--nix/default.nix3
-rw-r--r--src/Compositor.cpp46
-rw-r--r--src/Window.cpp10
-rw-r--r--src/config/ConfigManager.cpp78
-rw-r--r--src/debug/CrashReporter.cpp44
-rw-r--r--src/debug/HyprCtl.cpp425
-rw-r--r--src/debug/HyprDebugOverlay.cpp10
-rw-r--r--src/debug/Log.cpp58
-rw-r--r--src/debug/Log.hpp74
-rw-r--r--src/debug/TracyDefines.hpp2
-rw-r--r--src/events/Devices.cpp20
-rw-r--r--src/events/Layers.cpp12
-rw-r--r--src/events/Misc.cpp14
-rw-r--r--src/events/Monitors.cpp4
-rw-r--r--src/events/Popups.cpp20
-rw-r--r--src/events/Windows.cpp86
-rw-r--r--src/helpers/AnimatedVariable.cpp4
-rw-r--r--src/helpers/BezierCurve.cpp6
-rw-r--r--src/helpers/MiscFunctions.cpp40
-rw-r--r--src/helpers/MiscFunctions.hpp28
-rw-r--r--src/helpers/Monitor.cpp18
-rw-r--r--src/helpers/SubsurfaceTree.cpp18
-rw-r--r--src/helpers/WLListener.cpp2
-rw-r--r--src/helpers/WLSurface.cpp4
-rw-r--r--src/helpers/Workspace.cpp2
-rw-r--r--src/layout/DwindleLayout.cpp6
-rw-r--r--src/layout/IHyprLayout.cpp4
-rw-r--r--src/layout/MasterLayout.cpp4
-rw-r--r--src/macros.hpp10
-rw-r--r--src/main.cpp2
-rw-r--r--src/managers/EventManager.cpp10
-rw-r--r--src/managers/HookSystemManager.cpp4
-rw-r--r--src/managers/KeybindManager.cpp46
-rw-r--r--src/managers/LayoutManager.cpp4
-rw-r--r--src/managers/SessionLockManager.cpp6
-rw-r--r--src/managers/XWaylandManager.cpp6
-rw-r--r--src/managers/input/IdleInhibitor.cpp2
-rw-r--r--src/managers/input/InputManager.cpp38
-rw-r--r--src/managers/input/Swipe.cpp2
-rw-r--r--src/managers/input/Tablets.cpp2
-rw-r--r--src/plugins/PluginAPI.cpp2
-rw-r--r--src/plugins/PluginSystem.cpp18
-rw-r--r--src/protocols/TextInputV1.cpp2
-rw-r--r--src/protocols/ToplevelExport.cpp8
-rw-r--r--src/protocols/WaylandProtocol.cpp16
-rw-r--r--src/render/Framebuffer.cpp6
-rw-r--r--src/render/OpenGL.cpp16
-rw-r--r--src/render/Renderer.cpp84
48 files changed, 671 insertions, 655 deletions
diff --git a/nix/default.nix b/nix/default.nix
index 96fa12d7..46302e41 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -1,6 +1,7 @@
{
lib,
stdenv,
+ gcc13Stdenv,
pkg-config,
makeWrapper,
meson,
@@ -39,7 +40,7 @@
}:
assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been renamed `enableNvidiaPatches`";
assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
- stdenv.mkDerivation {
+ gcc13Stdenv.mkDerivation {
pname = "hyprland${lib.optionalString enableNvidiaPatches "-nvidia"}${lib.optionalString debug "-debug"}";
inherit version;
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 0c19eac3..3b0cade2 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -10,7 +10,7 @@
#include <ranges>
int handleCritSignal(int signo, void* data) {
- Debug::log(LOG, "Hyprland received signal %d", signo);
+ Debug::log(LOG, "Hyprland received signal {}", signo);
if (signo == SIGTERM || signo == SIGINT || signo == SIGKILL)
g_pCompositor->cleanup();
@@ -53,9 +53,9 @@ CCompositor::CCompositor() {
Debug::init(m_szInstanceSignature);
- Debug::log(LOG, "Instance Signature: %s", m_szInstanceSignature.c_str());
+ Debug::log(LOG, "Instance Signature: {}", m_szInstanceSignature.c_str());
- Debug::log(LOG, "Hyprland PID: %i", m_iHyprlandPID);
+ Debug::log(LOG, "Hyprland PID: {}", m_iHyprlandPID);
Debug::log(LOG, "===== SYSTEM INFO: =====");
@@ -69,7 +69,7 @@ CCompositor::CCompositor() {
setRandomSplash();
- Debug::log(LOG, "\nCurrent splash: %s\n\n", m_szCurrentSplash.c_str());
+ Debug::log(LOG, "\nCurrent splash: {}\n\n", m_szCurrentSplash.c_str());
}
CCompositor::~CCompositor() {
@@ -177,7 +177,7 @@ void CCompositor::initServer() {
int cursorSize = 24;
try {
cursorSize = std::stoi(XCURSORENV);
- } catch (std::exception& e) { Debug::log(ERR, "XCURSOR_SIZE invalid in check #2? (%s)", XCURSORENV); }
+ } catch (std::exception& e) { Debug::log(ERR, "XCURSOR_SIZE invalid in check #2? ({})", XCURSORENV); }
m_sWLRXCursorMgr = wlr_xcursor_manager_create(nullptr, cursorSize);
wlr_xcursor_manager_load(m_sWLRXCursorMgr, 1);
@@ -441,10 +441,10 @@ void CCompositor::startCompositor() {
const auto RETVAL = wl_display_add_socket(m_sWLDisplay, CANDIDATESTR.c_str());
if (RETVAL >= 0) {
m_szWLDisplaySocket = CANDIDATESTR;
- Debug::log(LOG, "wl_display_add_socket for %s succeeded with %i", CANDIDATESTR.c_str(), RETVAL);
+ Debug::log(LOG, "wl_display_add_socket for {} succeeded with {}", CANDIDATESTR.c_str(), RETVAL);
break;
} else {
- Debug::log(WARN, "wl_display_add_socket for %s returned %i: skipping candidate %i", CANDIDATESTR.c_str(), RETVAL, candidate);
+ Debug::log(WARN, "wl_display_add_socket for {} returned {}: skipping candidate {}", CANDIDATESTR.c_str(), RETVAL, candidate);
}
}
@@ -474,7 +474,7 @@ void CCompositor::startCompositor() {
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE",
nullptr);
- Debug::log(LOG, "Running on WAYLAND_DISPLAY: %s", m_szWLDisplaySocket.c_str());
+ Debug::log(LOG, "Running on WAYLAND_DISPLAY: {}", m_szWLDisplaySocket.c_str());
if (!wlr_backend_start(m_sWLRBackend)) {
Debug::log(CRIT, "Backend did not start!");
@@ -912,7 +912,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
// Send an event
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(pWindow) + "," + pWindow->m_szTitle});
- g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", getFormat("%lx", pWindow)});
+ g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", getFormat("{:x}", (uintptr_t)pWindow)});
EMIT_HOOK_EVENT("activeWindow", pWindow);
@@ -943,7 +943,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
// move to front of the window history
const auto HISTORYPIVOT = std::find_if(m_vWindowFocusHistory.begin(), m_vWindowFocusHistory.end(), [&](const auto& other) { return other == pWindow; });
if (HISTORYPIVOT == m_vWindowFocusHistory.end()) {
- Debug::log(ERR, "BUG THIS: Window %lx has no pivot in history", pWindow);
+ Debug::log(ERR, "BUG THIS: Window {:x} has no pivot in history", (uintptr_t)pWindow);
} else {
std::rotate(m_vWindowFocusHistory.begin(), HISTORYPIVOT, HISTORYPIVOT + 1);
}
@@ -988,9 +988,9 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
wl_signal_emit_mutable(&m_sSeat.seat->keyboard_state.events.focus_change, &event);
if (pWindowOwner)
- Debug::log(LOG, "Set keyboard focus to surface %lx, with window name: %s", pSurface, pWindowOwner->m_szTitle.c_str());
+ Debug::log(LOG, "Set keyboard focus to surface {:x}, with window name: {}", (uintptr_t)pSurface, pWindowOwner->m_szTitle.c_str());
else
- Debug::log(LOG, "Set keyboard focus to surface %lx", pSurface);
+ Debug::log(LOG, "Set keyboard focus to surface {:x}", (uintptr_t)pSurface);
g_pXWaylandManager->activateSurface(pSurface, true);
m_pLastFocus = pSurface;
@@ -1930,7 +1930,7 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
if (pWorkspace->m_iMonitorID == pMonitor->ID)
return;
- Debug::log(LOG, "moveWorkspaceToMonitor: Moving %d to monitor %d", pWorkspace->m_iID, pMonitor->ID);
+ Debug::log(LOG, "moveWorkspaceToMonitor: Moving {} to monitor {}", pWorkspace->m_iID, pMonitor->ID);
const auto POLDMON = getMonitorFromID(pWorkspace->m_iMonitorID);
@@ -1957,12 +1957,12 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
}())
nextWorkspaceOnMonitorID++;
- Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with new %d", nextWorkspaceOnMonitorID);
+ Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with new {}", nextWorkspaceOnMonitorID);
g_pCompositor->createNewWorkspace(nextWorkspaceOnMonitorID, POLDMON->ID);
}
- Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with existing %d", nextWorkspaceOnMonitorID);
+ Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with existing {}", nextWorkspaceOnMonitorID);
POLDMON->changeWorkspace(nextWorkspaceOnMonitorID);
}
@@ -1999,7 +1999,7 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
}
if (SWITCHINGISACTIVE && POLDMON == g_pCompositor->m_pLastMonitor) { // if it was active, preserve its' status. If it wasn't, don't.
- Debug::log(LOG, "moveWorkspaceToMonitor: SWITCHINGISACTIVE, active %d -> %d", pMonitor->activeWorkspace, pWorkspace->m_iID);
+ Debug::log(LOG, "moveWorkspaceToMonitor: SWITCHINGISACTIVE, active {} -> {}", pMonitor->activeWorkspace, pWorkspace->m_iID);
if (const auto PWORKSPACE = getWorkspaceByID(pMonitor->activeWorkspace); PWORKSPACE)
getWorkspaceByID(pMonitor->activeWorkspace)->startAnim(false, false);
@@ -2187,13 +2187,13 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
break;
}
case MODE_ADDRESS: {
- std::string addr = getFormat("0x%lx", w.get());
+ std::string addr = getFormat("0x{:x}", (uintptr_t)w.get());
if (matchCheck != addr)
continue;
break;
}
case MODE_PID: {
- std::string pid = getFormat("%d", w->getPID());
+ std::string pid = getFormat("{}", w->getPID());
if (matchCheck != pid)
continue;
break;
@@ -2357,7 +2357,7 @@ void CCompositor::renameWorkspace(const int& id, const std::string& name) {
if (isWorkspaceSpecial(id))
return;
- Debug::log(LOG, "renameWorkspace: Renaming workspace %d to '%s'", id, name.c_str());
+ Debug::log(LOG, "renameWorkspace: Renaming workspace {} to '{}'", id, name.c_str());
PWORKSPACE->m_szName = name;
g_pEventManager->postEvent({"renameworkspace", std::to_string(PWORKSPACE->m_iID) + "," + PWORKSPACE->m_szName});
@@ -2478,14 +2478,14 @@ void CCompositor::arrangeMonitors() {
for (auto& m : m_vMonitors)
toArrange.push_back(m.get());
- Debug::log(LOG, "arrangeMonitors: %llu to arrange", toArrange.size());
+ Debug::log(LOG, "arrangeMonitors: {} to arrange", toArrange.size());
for (auto it = toArrange.begin(); it != toArrange.end();) {
auto m = *it;
if (m->activeMonitorRule.offset != Vector2D{-INT32_MAX, -INT32_MAX}) {
// explicit.
- Debug::log(LOG, "arrangeMonitors: %s explicit [%.2f, %.2f]", m->szName.c_str(), m->activeMonitorRule.offset.x, m->activeMonitorRule.offset.y);
+ Debug::log(LOG, "arrangeMonitors: {} explicit [{:.2f}, {:.2f}]", m->szName.c_str(), m->activeMonitorRule.offset.x, m->activeMonitorRule.offset.y);
m->moveTo(m->activeMonitorRule.offset);
arranged.push_back(m);
@@ -2508,7 +2508,7 @@ void CCompositor::arrangeMonitors() {
}
for (auto& m : toArrange) {
- Debug::log(LOG, "arrangeMonitors: %s auto [%i, %.2f]", m->szName.c_str(), maxOffset, 0);
+ Debug::log(LOG, "arrangeMonitors: {} auto [{}, {:.2f}]", m->szName.c_str(), maxOffset, 0.f);
m->moveTo({maxOffset, 0});
maxOffset += m->vecSize.x;
}
@@ -2517,7 +2517,7 @@ void CCompositor::arrangeMonitors() {
// and set xwayland positions aka auto for all
maxOffset = 0;
for (auto& m : m_vMonitors) {
- Debug::log(LOG, "arrangeMonitors: %s xwayland [%i, %.2f]", m->szName.c_str(), maxOffset, 0);
+ Debug::log(LOG, "arrangeMonitors: {} xwayland [{}, {:.2f}]", m->szName.c_str(), maxOffset, 0.f);
m->vecXWaylandPosition = {maxOffset, 0};
maxOffset += (*PXWLFORCESCALEZERO ? m->vecTransformedSize.x : m->vecSize.x);
}
diff --git a/src/Window.cpp b/src/Window.cpp
index cd599c82..3085dbfd 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -340,7 +340,7 @@ void CWindow::moveToWorkspace(int workspaceID) {
updateSpecialRenderData();
if (PWORKSPACE) {
- g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%lx,%s", this, PWORKSPACE->m_szName.c_str())});
+ g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("{:x},{}", (uintptr_t)this, PWORKSPACE->m_szName)});
EMIT_HOOK_EVENT("moveWindow", (std::vector<void*>{this, PWORKSPACE}));
}
@@ -494,11 +494,11 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
} else if (r.szRule.find("rounding") == 0) {
try {
m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
- } catch (std::exception& e) { Debug::log(ERR, "Rounding rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
+ } catch (std::exception& e) { Debug::log(ERR, "Rounding rule \"{}\" failed with: {}", r.szRule.c_str(), e.what()); }
} else if (r.szRule.find("bordersize") == 0) {
try {
m_sAdditionalConfigData.borderSize = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
- } catch (std::exception& e) { Debug::log(ERR, "Bordersize rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
+ } catch (std::exception& e) { Debug::log(ERR, "Bordersize rule \"{}\" failed with: {}", r.szRule.c_str(), e.what()); }
} else if (r.szRule.find("opacity") == 0) {
try {
CVarList vars(r.szRule, 0, ' ');
@@ -529,7 +529,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
opacityIDX++;
}
}
- } catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
+ } catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"{}\" failed with: {}", r.szRule.c_str(), e.what()); }
} else if (r.szRule == "noanim") {
m_sAdditionalConfigData.forceNoAnims = true;
} else if (r.szRule.find("animation") == 0) {
@@ -546,7 +546,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
} else {
m_sSpecialRenderData.activeBorderColor = configStringToInt(colorPart);
}
- } catch (std::exception& e) { Debug::log(ERR, "BorderColor rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
+ } catch (std::exception& e) { Debug::log(ERR, "BorderColor rule \"{}\" failed with: {}", r.szRule.c_str(), e.what()); }
} else if (r.szRule == "dimaround") {
m_sAdditionalConfigData.dimAround = true;
} else if (r.szRule == "keepaspectratio") {
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 5286dce5..e46785cc 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -328,7 +328,7 @@ void CConfigManager::init() {
struct stat fileStat;
int err = stat(CONFIGPATH.c_str(), &fileStat);
if (err != 0) {
- Debug::log(WARN, "Error at statting config, error %i", errno);
+ Debug::log(WARN, "Error at statting config, error {}", errno);
}
configModifyTimes[CONFIGPATH] = fileStat.st_mtime;
@@ -341,7 +341,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
if (COMMAND.find("device:") != 0 /* devices parsed later */ && COMMAND.find("plugin:") != 0 /* plugins parsed later */) {
if (COMMAND[0] == '$') {
// register a dynamic var
- Debug::log(LOG, "Registered dynamic var \"%s\" -> %s", COMMAND.c_str(), VALUE.c_str());
+ Debug::log(LOG, "Registered dynamic var \"{}\" -> {}", COMMAND.c_str(), VALUE.c_str());
configDynamicVars.emplace_back(std::make_pair<>(COMMAND.substr(1), VALUE));
std::sort(configDynamicVars.begin(), configDynamicVars.end(), [&](const auto& a, const auto& b) { return a.first.length() > b.first.length(); });
@@ -399,21 +399,21 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
try {
CONFIGENTRY->intValue = configStringToInt(VALUE);
} catch (std::exception& e) {
- Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
+ Debug::log(WARN, "Error reading value of {}", COMMAND.c_str());
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. " + e.what();
}
} else if (CONFIGENTRY->floatValue != -__FLT_MAX__) {
try {
CONFIGENTRY->floatValue = stof(VALUE);
} catch (...) {
- Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
+ Debug::log(WARN, "Error reading value of {}", COMMAND.c_str());
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
}
} else if (CONFIGENTRY->strValue != "") {
try {
CONFIGENTRY->strValue = VALUE;
} catch (...) {
- Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
+ Debug::log(WARN, "Error reading value of {}", COMMAND.c_str());
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
}
} else if (CONFIGENTRY->vecValue != Vector2D(-__FLT_MAX__, -__FLT_MAX__)) {
@@ -426,11 +426,11 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
CONFIGENTRY->vecValue = Vector2D(std::stof(X), std::stof(Y));
}
} else {
- Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
+ Debug::log(WARN, "Error reading value of {}", COMMAND.c_str());
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
}
} catch (...) {
- Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
+ Debug::log(WARN, "Error reading value of {}", COMMAND.c_str());
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
}
} else if (CONFIGENTRY->data.get() != nullptr) {
@@ -449,7 +449,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
try {
data->m_fAngle = std::stoi(var.substr(0, var.find("deg"))) * (PI / 180.0); // radians
} catch (...) {
- Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
+ Debug::log(WARN, "Error reading value of {}", COMMAND.c_str());
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
}
@@ -457,7 +457,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
}
if (data->m_vColors.size() >= 10) {
- Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
+ Debug::log(WARN, "Error reading value of {}", COMMAND.c_str());
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. Max colors in a gradient is 10.";
break;
}
@@ -465,13 +465,13 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
try {
data->m_vColors.push_back(CColor(configStringToInt(var)));
} catch (std::exception& e) {
- Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
+ Debug::log(WARN, "Error reading value of {}", COMMAND.c_str());
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. " + e.what();
}
}
if (data->m_vColors.size() == 0) {
- Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
+ Debug::log(WARN, "Error reading value of {}", COMMAND.c_str());
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. No colors provided.";
data->m_vColors.push_back(0); // transparent
@@ -493,7 +493,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
struct stat fileStat;
int err = stat(PATH.c_str(), &fileStat);
if (err != 0) {
- Debug::log(WARN, "Error at ticking config at %s, error %i: %s", PATH.c_str(), err, strerror(err));
+ Debug::log(WARN, "Error at ticking config at {}, error {}: {}", PATH.c_str(), err, strerror(err));
return;
}
@@ -516,7 +516,7 @@ static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
return false;
if (args.size() < 10) {
- Debug::log(ERR, "modeline parse error: expected at least 9 arguments, got %i", args.size() - 1);
+ Debug::log(ERR, "modeline parse error: expected at least 9 arguments, got {}", args.size() - 1);
return false;
}
@@ -550,7 +550,7 @@ static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
if (it != flagsmap.end())
mode.flags |= it->second;
else
- Debug::log(ERR, "invalid flag %s in modeline", it->first.c_str());
+ Debug::log(ERR, "invalid flag {} in modeline", it->first.c_str());
}
snprintf(mode.name, sizeof(mode.name), "%dx%d@%d", mode.hdisplay, mode.vdisplay, mode.vrefresh / 1000);
@@ -573,7 +573,7 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
else if (ARGS[1] == "transform") {
const auto TSF = std::stoi(ARGS[2]);
if (std::clamp(TSF, 0, 7) != TSF) {
- Debug::log(ERR, "invalid transform %i in monitor", TSF);
+ Debug::log(ERR, "invalid transform {} in monitor", TSF);
parseError = "invalid transform";
return;
}
@@ -919,7 +919,7 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str
// verify we support a rule
if (!windowRuleValid(RULE)) {
- Debug::log(ERR, "Invalid rule found: %s", RULE.c_str());
+ Debug::log(ERR, "Invalid rule found: {}", RULE.c_str());
parseError = "Invalid rule found: " + RULE;
return;
}
@@ -944,7 +944,7 @@ void CConfigManager::handleLayerRule(const std::string& command, const std::stri
}
if (!layerRuleValid(RULE)) {
- Debug::log(ERR, "Invalid rule found: %s", RULE.c_str());
+ Debug::log(ERR, "Invalid rule found: {}", RULE.c_str());
parseError = "Invalid rule found: " + RULE;
return;
}
@@ -962,7 +962,7 @@ void CConfigManager::handleWindowRuleV2(const std::string& command, const std::s
const auto VALUE = value.substr(value.find_first_of(',') + 1);
if (!windowRuleValid(RULE) && RULE != "unset") {
- Debug::log(ERR, "Invalid rulev2 found: %s", RULE.c_str());
+ Debug::log(ERR, "Invalid rulev2 found: {}", RULE.c_str());
parseError = "Invalid rulev2 found: " + RULE;
return;
}
@@ -983,7 +983,7 @@ void CConfigManager::handleWindowRuleV2(const std::string& command, const std::s
if (TITLEPOS == std::string::npos && CLASSPOS == std::string::npos && X11POS == std::string::npos && FLOATPOS == std::string::npos && FULLSCREENPOS == std::string::npos &&
PINNEDPOS == std::string::npos && WORKSPACEPOS == std::string::npos) {
- Debug::log(ERR, "Invalid rulev2 syntax: %s", VALUE.c_str());
+ Debug::log(ERR, "Invalid rulev2 syntax: {}", VALUE.c_str());
parseError = "Invalid rulev2 syntax: " + VALUE;
return;
}
@@ -1089,7 +1089,7 @@ void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBl
for (auto& lsl : m->m_aLayerSurfaceLayers) {
for (auto& ls : lsl) {
if (BYADDRESS) {
- if (getFormat("0x%lx", ls.get()) == matchName)
+ if (getFormat("0x{:x}", (uintptr_t)ls.get()) == matchName)
ls->forceBlur = forceBlur;
} else if (ls->szNamespace == matchName)
ls->forceBlur = forceBlur;
@@ -1128,7 +1128,7 @@ void CConfigManager::handleWorkspaceRules(const std::string& command, const std:
auto wsIdent = removeBeginEndSpacesTabs(value.substr(FIRST_DELIM + 1, (WORKSPACE_DELIM - FIRST_DELIM - 1)));
id = getWorkspaceIDFromString(wsIdent, name);
if (id == INT_MAX) {
- Debug::log(ERR, "Invalid workspace identifier found: %s", wsIdent.c_str());
+ Debug::log(ERR, "Invalid workspace identifier found: {}", wsIdent.c_str());
parseError = "Invalid workspace identifier found: " + wsIdent;
return;
}
@@ -1207,7 +1207,7 @@ void CConfigManager::handleSource(const std::string& command, const std::string&
struct stat fileStat;
int err = stat(value.c_str(), &fileStat);
if (err != 0) {
- Debug::log(WARN, "Error at ticking config at %s, error %i: %s", value.c_str(), err, strerror(err));
+ Debug::log(WARN, "Error at ticking config at {}, error {}: {}", value.c_str(), err, strerror(err));
return;
}
@@ -1225,7 +1225,7 @@ void CConfigManager::handleSource(const std::string& command, const std::string&
parseLine(line);
} catch (...) {
Debug::log(ERR, "Error reading line from config. Line:");
- Debug::log(NONE, "%s", line.c_str());
+ Debug::log(NONE, "{}", line.c_str());
parseError += "Config error at line " + std::to_string(linenum) + " (" + configCurrentPath + "): Line parsing error.";
}
@@ -1487,7 +1487,7 @@ void CConfigManager::loadConfigLoadVars() {
// paths
configPaths.clear();
std::string mainConfigPath = getMainConfigPath();
- Debug::log(LOG, "Using config: %s", mainConfigPath.c_str());
+ Debug::log(LOG, "Using config: {}", mainConfigPath.c_str());
configPaths.push_back(mainConfigPath);
std::string configPath = mainConfigPath.substr(0, mainConfigPath.find_last_of('/'));
// find_last_of never returns npos since main_config at least has /hypr/
@@ -1545,7 +1545,7 @@ void CConfigManager::loadConfigLoadVars() {
parseLine(line);
} catch (...) {
Debug::log(ERR, "Error reading line from config. Line:");
- Debug::log(NONE, "%s", line.c_str());
+ Debug::log(NONE, "{}", line.c_str());
parseError += "Config error at line " + std::to_string(linenum) + " (" + mainConfigPath + "): Line parsing error.";
}
@@ -1654,7 +1654,7 @@ void CConfigManager::tick() {
struct stat fileStat;
int err = stat(cf.c_str(), &fileStat);
if (err != 0) {
- Debug::log(WARN, "Error at ticking config at %s, error %i: %s", cf.c_str(), err, strerror(err));
+ Debug::log(WARN, "Error at ticking config at {}, error {}: {}", cf.c_str(), err, strerror(err));
continue;
}
@@ -1687,7 +1687,7 @@ SConfigValue CConfigManager::getConfigValueSafeDevice(const std::string& dev, co
const auto it = deviceConfigs.find(dev);
if (it == deviceConfigs.end()) {
- Debug::log(ERR, "getConfigValueSafeDevice: No device config for %s found???", dev.c_str());
+ Debug::log(ERR, "getConfigValueSafeDevice: No device config for {} found???", dev.c_str());
return SConfigValue();
}
@@ -1771,7 +1771,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const std::string& name, const st
if (found)
return *found;
- Debug::log(WARN, "No rule found for %s, trying to use the first.", name.c_str());
+ Debug::log(WARN, "No rule found for {}, trying to use the first.", name.c_str());
for (auto& r : m_dMonitorRules) {
if (r.name == "") {
@@ -1804,7 +1804,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
std::string title = g_pXWaylandManager->getTitle(pWindow);
std::string appidclass = g_pXWaylandManager->getAppIDClass(pWindow);
- Debug::log(LOG, "Searching for matching rules for %s (title: %s)", appidclass.c_str(), title.c_str());
+ Debug::log(LOG, "Searching for matching rules for {} (title: {})", appidclass.c_str(), title.c_str());
// since some rules will be applied later, we need to store some flags
bool hasFloating = pWindow->m_bIsFloating;
@@ -1827,7 +1827,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
continue;
}
} catch (...) {
- Debug::log(ERR, "Regex error at %s", rule.szValue.c_str());
+ Debug::log(ERR, "Regex error at {}", rule.szValue.c_str());
continue;
}
} else {
@@ -1887,13 +1887,13 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
}
}
} catch (std::exception& e) {
- Debug::log(ERR, "Regex error at %s (%s)", rule.szValue.c_str(), e.what());
+ Debug::log(ERR, "Regex error at {} ({})", rule.szValue.c_str(), e.what());
continue;
}
}
// applies. Read the rule and behave accordingly
- Debug::log(LOG, "Window rule %s -> %s matched %lx [%s]", rule.szRule.c_str(), rule.szValue.c_str(), pWindow, pWindow->m_szTitle.c_str());
+ Debug::log(LOG, "Window rule {} -> {} matched {:x} [{}]", rule.szRule.c_str(), rule.szValue.c_str(), (uintptr_t)pWindow, pWindow->m_szTitle.c_str());
returns.push_back(rule);
@@ -1931,7 +1931,7 @@ std::vector<SLayerRule> CConfigManager::getMatchingRules(SLayerSurface* pLS) {
for (auto& lr : m_dLayerRules) {
if (lr.targetNamespace.find("address:0x") == 0) {
- if (getFormat("address:0x%lx", pLS) != lr.targetNamespace)
+ if (getFormat("address:0x{:x}", (uintptr_t)pLS) != lr.targetNamespace)
continue;
} else {
std::regex NSCHECK(lr.targetNamespace);
@@ -2082,7 +2082,7 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
wlr_output_enable_adaptive_sync(m->output, 0);
if (!wlr_output_commit(m->output))
- Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> false", m->output->name);
+ Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> false", m->output->name);
}
m->vrrActive = false;
return;
@@ -2091,12 +2091,12 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
wlr_output_enable_adaptive_sync(m->output, 1);
if (!wlr_output_test(m->output)) {
- Debug::log(LOG, "Pending output %s does not accept VRR.", m->output->name);
+ Debug::log(LOG, "Pending output {} does not accept VRR.", m->output->name);
wlr_output_enable_adaptive_sync(m->output, 0);
}
if (!wlr_output_commit(m->output))
- Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> true", m->output->name);
+ Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> true", m->output->name);
}
m->vrrActive = true;
return;
@@ -2115,18 +2115,18 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
wlr_output_enable_adaptive_sync(m->output, 1);
if (!wlr_output_test(m->output)) {
- Debug::log(LOG, "Pending output %s does not accept VRR.", m->output->name);
+ Debug::log(LOG, "Pending output {} does not accept VRR.", m->output->name);
wlr_output_enable_adaptive_sync(m->output, 0);
}
if (!wlr_output_commit(m->output))
- Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> true", m->output->name);
+ Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> true", m->output->name);
} else if (!WORKSPACEFULL && m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) {
wlr_output_enable_adaptive_sync(m->output, 0);
if (!wlr_output_commit(m->output))
- Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> false", m->output->name);
+ Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> false", m->output->name);
}
}
};
diff --git a/src/debug/CrashReporter.cpp b/src/debug/CrashReporter.cpp
index a580ecd8..d4b2a431 100644
--- a/src/debug/CrashReporter.cpp
+++ b/src/debug/CrashReporter.cpp
@@ -14,19 +14,19 @@
std::string getRandomMessage() {
const std::vector<std::string> MESSAGES = {"Sorry, didn't mean to...",
- "This was an accident, I swear!",
- "Calm down, it was a misinput! MISINPUT!",
- "Oops",
- "Vaxry is going to be upset.",
- "Who tried dividing by zero?!",
- "Maybe you should try dusting your PC in the meantime?",
- "I tried so hard, and got so far...",
- "I don't feel so good...",
- "*thud*",
- "Well this is awkward.",
- "\"stable\"",
- "I hope you didn't have any unsaved progress.",
- "All these computers..."};
+ "This was an accident, I swear!",
+ "Calm down, it was a misinput! MISINPUT!",
+ "Oops",
+ "Vaxry is going to be upset.",
+ "Who tried dividing by zero?!",
+ "Maybe you should try dusting your PC in the meantime?",
+ "I tried so hard, and got so far...",
+ "I don't feel so good...",
+ "*thud*",
+ "Well this is awkward.",
+ "\"stable\"",
+ "I hope you didn't have any unsaved progress.",
+ "All these computers..."};
std::random_device dev;
std::mt19937 engine(dev());
@@ -45,15 +45,15 @@ void CrashReporter::createAndSaveCrash(int sig) {
finalCrashReport += "--------------------------------------------\n Hyprland Crash Report\n--------------------------------------------\n";
finalCrashReport += getRandomMessage() + "\n\n";
- finalCrashReport += getFormat("Hyprland received signal %d (%s)\n\n", sig, strsignal(sig));
+ finalCrashReport += getFormat("Hyprland received signal {} ({})\n\n", sig, (const char*)strsignal(sig));
- finalCrashReport += getFormat("Version: %s\nTag: %s\n\n", GIT_COMMIT_HASH, GIT_TAG);
+ finalCrashReport += getFormat("Version: {}\nTag: {}\n\n", GIT_COMMIT_HASH, GIT_TAG);
if (g_pPluginSystem && !g_pPluginSystem->getAllPlugins().empty()) {
finalCrashReport += "Hyprland seems to be running with plugins. This crash might not be Hyprland's fault.\nPlugins:\n";
for (auto& p : g_pPluginSystem->getAllPlugins()) {
- finalCrashReport += getFormat("\t%s (%s) %s\n", p->name.c_str(), p->author.c_str(), p->version.c_str());
+ finalCrashReport += getFormat("\t{} ({}) {}\n", p->name.c_str(), p->author.c_str(), p->version.c_str());
}
finalCrashReport += "\n\n";
@@ -65,7 +65,7 @@ void CrashReporter::createAndSaveCrash(int sig) {
uname(&unameInfo);
finalCrashReport +=
- getFormat("\tSystem name: %s\n\tNode name: %s\n\tRelease: %s\n\tVersion: %s\n\n", unameInfo.sysname, unameInfo.nodename, unameInfo.release, unameInfo.version);
+ getFormat("\tSystem name: {}\n\tNode name: {}\n\tRelease: {}\n\tVersion: {}\n\n", unameInfo.sysname, unameInfo.nodename, unameInfo.release, unameInfo.version);
#if defined(__DragonFly__) || defined(__FreeBSD__)
const std::string GPUINFO = execAndGet("pciconf -lv | fgrep -A4 vga");
@@ -75,7 +75,7 @@ void CrashReporter::createAndSaveCrash(int sig) {
finalCrashReport += "GPU:\n\t" + GPUINFO;
- finalCrashReport += getFormat("\n\nos-release:\n\t%s\n\n\n", replaceInString(execAndGet("cat /etc/os-release"), "\n", "\n\t").c_str());
+ finalCrashReport += getFormat("\n\nos-release:\n\t{}\n\n\n", replaceInString(execAndGet("cat /etc/os-release"), "\n", "\n\t").c_str());
finalCrashReport += "Backtrace:\n";
@@ -107,12 +107,12 @@ void CrashReporter::createAndSaveCrash(int sig) {
#endif
for (size_t i = 0; i < CALLSTACK.size(); ++i) {
- finalCrashReport += getFormat("\t#%lu | %s\n", i, CALLSTACK[i].desc.c_str());
+ finalCrashReport += getFormat("\t#{} | {}\n", i, CALLSTACK[i].desc.c_str());
#ifdef __clang__
- const auto CMD = getFormat("llvm-addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)CALLSTACK[i].adr);
+ const auto CMD = getFormat("llvm-addr2line -e {} -f 0x{:x}", FPATH.c_str(), (uint64_t)CALLSTACK[i].adr);
#else
- const auto CMD = getFormat("addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)CALLSTACK[i].adr);
+ const auto CMD = getFormat("addr2line -e {} -f 0x{:x}", FPATH.c_str(), (uint64_t)CALLSTACK[i].adr);
#endif
const auto ADDR2LINE = replaceInString(execAndGet(CMD.c_str()), "\n", "\n\t\t");
finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2);
@@ -156,5 +156,5 @@ void CrashReporter::createAndSaveCrash(int sig) {
ofs.close();
Debug::disableStdout = false;
- Debug::log(CRIT, "Hyprland has crashed :( Consult the crash report at %s for more information.", path.c_str());
+ Debug::log(CRIT, "Hyprland has crashed :( Consult the crash report at {} for more information.", path.c_str());
}
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 2713dee2..a33f66b0 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -38,33 +38,33 @@ std::string monitorsRequest(HyprCtl::eHyprCtlOutputFormat format) {
continue;
result += getFormat(
- R"#({
- "id": %i,
- "name": "%s",
- "description": "%s",
- "make": "%s",
- "model": "%s",
- "serial": "%s",
- "width": %i,
- "height": %i,
- "refreshRate": %f,
- "x": %i,
- "y": %i,
- "activeWorkspace": {
- "id": %i,
- "name": "%s"
- },
- "specialWorkspace": {
- "id": %i,
- "name": "%s"
- },
- "reserved": [%i, %i, %i, %i],
- "scale": %.2f,
- "transform": %i,
- "focused": %s,
- "dpmsStatus": %s,
- "vrr": %s
-},)#",
+ R"#({{
+ "id": {},
+ "name": "{}",
+ "description": "{}",
+ "make": "{}",
+ "model": "{}",
+ "serial": "{}",
+ "width": {},
+ "height": {},
+ "refreshRate": {:.5f},
+ "x": {},
+ "y": {},
+ "activeWorkspace": {{
+ "id": {},
+ "name": "{}"
+ }},
+ "specialWorkspace": {{
+ "id": {},
+ "name": "{}"
+ }},
+ "reserved": [{}, {}, {}, {}],
+ "scale": {:.2f},
+ "transform": {},
+ "focused": {},
+ "dpmsStatus": {},
+ "vrr": {}
+}},)#",
m->ID, escapeJSONStrings(m->szName).c_str(), escapeJSONStrings(m->output->description ? m->output->description : "").c_str(),
(m->output->make ? m->output->make : ""), (m->output->model ? m->output->model : ""), (m->output->serial ? m->output->serial : ""), (int)m->vecPixelSize.x,
(int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->activeWorkspace,
@@ -82,10 +82,10 @@ std::string monitorsRequest(HyprCtl::eHyprCtlOutputFormat format) {
if (!m->output)
continue;
- result += getFormat("Monitor %s (ID %i):\n\t%ix%i@%f at %ix%i\n\tdescription: %s\n\tmake: %s\n\tmodel: %s\n\tserial: %s\n\tactive workspace: %i (%s)\n\tspecial "
- "workspace: %i (%s)\n\treserved: %i "
- "%i %i %i\n\tscale: %.2f\n\ttransform: "
- "%i\n\tfocused: %s\n\tdpmsStatus: %i\n\tvrr: %i\n\n",
+ result += getFormat("Monitor {} (ID {}):\n\t{}x{}@{:.5f} at {}x{}\n\tdescription: {}\n\tmake: {}\n\tmodel: {}\n\tserial: {}\n\tactive workspace: {} ({})\n\tspecial "
+ "workspace: {} ({})\n\treserved: {} "
+ "{} {} {}\n\tscale: {:.2f}\n\ttransform: "
+ "{}\n\tfocused: {}\n\tdpmsStatus: {}\n\tvrr: {}\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->output->make ? m->output->make : ""), (m->output->model ? m->output->model : ""),
(m->output->serial ? m->output->serial : ""), m->activeWorkspace, g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName.c_str(),
@@ -113,7 +113,7 @@ static std::string getGroupedData(CWindow* w, HyprCtl::eHyprCtlOutputFormat form
} while (curr != w);
const auto comma = isJson ? ", " : ",";
- const auto fmt = isJson ? "\"0x%lx\"" : "%lx";
+ const auto fmt = isJson ? "\"0x{:x}\"" : "{:x}";
std::ostringstream result;
bool first = true;
@@ -123,7 +123,7 @@ static std::string getGroupedData(CWindow* w, HyprCtl::eHyprCtlOutputFormat form
else
result << comma;
- result << getFormat(fmt, gw);
+ result << getFormat(fmt, (uintptr_t)gw);
}
return result.str();
@@ -132,57 +132,56 @@ 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"#({
- "address": "0x%lx",
- "mapped": %s,
- "hidden": %s,
- "at": [%i, %i],
- "size": [%i, %i],
- "workspace": {
- "id": %i,
- "name": "%s"
- },
- "floating": %s,
- "monitor": %i,
- "class": "%s",
- "title": "%s",
- "initialClass": "%s",
- "initialTitle": "%s",
- "pid": %i,
- "xwayland": %s,
- "pinned": %s,
- "fullscreen": %s,
- "fullscreenMode": %i,
- "fakeFullscreen": %s,
- "grouped": [%s],
- "swallowing": %s
-},)#",
- w, (w->m_bIsMapped ? "true" : "false"), (w->isHidden() ? "true" : "false"), (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y,
+ R"#({{
+ "address": "0x{:x}",
+ "mapped": {},
+ "hidden": {},
+ "at": [{}, {}],
+ "size": [{}, {}],
+ "workspace": {{
+ "id": {},
+ "name": "{}"
+ }},
+ "floating": {},
+ "monitor": {},
+ "class": "{}",
+ "title": "{}",
+ "initialClass": "{}",
+ "initialTitle": "{}",
+ "pid": {},
+ "xwayland": {},
+ "pinned": {},
+ "fullscreen": {},
+ "fullscreenMode": {},
+ "fakeFullscreen": {},
+ "grouped": [{}],
+ "swallowing": "0x{:x}"
+}},)#",
+ (uintptr_t)w, (w->m_bIsMapped ? "true" : "false"), (w->isHidden() ? "true" : "false"), (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(), escapeJSONStrings(w->m_szInitialClass).c_str(), escapeJSONStrings(w->m_szInitialTitle).c_str(), w->getPID(),
+ std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID))),
+ ((int)w->m_bIsFloating == 1 ? "true" : "false"), w->m_iMonitorID, escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)),
+ escapeJSONStrings(g_pXWaylandManager->getTitle(w)), escapeJSONStrings(w->m_szInitialClass), escapeJSONStrings(w->m_szInitialTitle), 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),
- w->m_bFakeFullscreenState ? "true" : "false", getGroupedData(w, format).c_str(), (w->m_pSwallowed ? getFormat("\"0x%lx\"", w->m_pSwallowed).c_str() : "null"));
+ (w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? (int)g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0),
+ w->m_bFakeFullscreenState ? "true" : "false", getGroupedData(w, format), (uintptr_t)w->m_pSwallowed);
} else {
return getFormat(
- "Window %lx -> %s:\n\tmapped: %i\n\thidden: %i\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\tinitialClass: %s\n\tinitialTitle: %s\n\tpid: "
- "%i\n\txwayland: %i\n\tpinned: "
- "%i\n\tfullscreen: %i\n\tfullscreenmode: %i\n\tfakefullscreen: %i\n\tgrouped: %s\n\tswallowing: %lx\n\n",
- w, w->m_szTitle.c_str(), (int)w->m_bIsMapped, (int)w->isHidden(), (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,
+ "Window {:x} -> {}:\n\tmapped: {}\n\thidden: {}\n\tat: {},{}\n\tsize: {},{}\n\tworkspace: {} ({})\n\tfloating: {}\n\tmonitor: {}\n\tclass: {}\n\ttitle: "
+ "{}\n\tinitialClass: {}\n\tinitialTitle: {}\n\tpid: "
+ "{}\n\txwayland: {}\n\tpinned: "
+ "{}\n\tfullscreen: {}\n\tfullscreenmode: {}\n\tfakefullscreen: {}\n\tgrouped: {}\n\tswallowing: {:x}\n\n",
+ (uintptr_t)w, w->m_szTitle.c_str(), (int)w->m_bIsMapped, (int)w->isHidden(), (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->m_szInitialClass.c_str(),
w->m_szInitialTitle.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),
- (int)w->m_bFakeFullscreenState, getGroupedData(w, format).c_str(), w->m_pSwallowed);
+ (int)w->m_bFakeFullscreenState, getGroupedData(w, format).c_str(), (uintptr_t)w->m_pSwallowed);
}
}
@@ -210,21 +209,21 @@ static std::string getWorkspaceData(CWorkspace* w, HyprCtl::eHyprCtlOutputFormat
const auto PLASTW = w->getLastFocusedWindow();
const auto PMONITOR = g_pCompositor->getMonitorFromID(w->m_iMonitorID);
if (format == HyprCtl::FORMAT_JSON) {
- return getFormat(R"#({
- "id": %i,
- "name": "%s",
- "monitor": "%s",
- "windows": %i,
- "hasfullscreen": %s,
- "lastwindow": "0x%lx",
- "lastwindowtitle": "%s"
-})#",
+ return getFormat(R"#({{
+ "id": {},
+ "name": "{}",
+ "monitor": "{}",
+ "windows": {},
+ "hasfullscreen": {},
+ "lastwindow": "0x{:x}",
+ "lastwindowtitle": "{}"
+}})#",
w->m_iID, escapeJSONStrings(w->m_szName).c_str(), escapeJSONStrings(PMONITOR ? PMONITOR->szName : "?").c_str(),
- g_pCompositor->getWindowsOnWorkspace(w->m_iID), ((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"), PLASTW,
+ g_pCompositor->getWindowsOnWorkspace(w->m_iID), ((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"), (uintptr_t)PLASTW,
PLASTW ? escapeJSONStrings(PLASTW->m_szTitle).c_str() : "");
} else {
- return getFormat("workspace ID %i (%s) on monitor %s:\n\twindows: %i\n\thasfullscreen: %i\n\tlastwindow: 0x%lx\n\tlastwindowtitle: %s\n\n", w->m_iID, w->m_szName.c_str(),
- PMONITOR ? PMONITOR->szName.c_str() : "?", g_pCompositor->getWindowsOnWorkspace(w->m_iID), (int)w->m_bHasFullscreenWindow, PLASTW,
+ return getFormat("workspace ID {} ({}) on monitor {}:\n\twindows: {}\n\thasfullscreen: {}\n\tlastwindow: 0x{:x}\n\tlastwindowtitle: {}\n\n", w->m_iID, w->m_szName.c_str(),
+ PMONITOR ? PMONITOR->szName.c_str() : "?", g_pCompositor->getWindowsOnWorkspace(w->m_iID), (int)w->m_bHasFullscreenWindow, (uintptr_t)PLASTW,
PLASTW ? PLASTW->m_szTitle.c_str() : "");
}
}
@@ -278,8 +277,8 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& mon : g_pCompositor->m_vMonitors) {
result += getFormat(
- R"#("%s": {
- "levels": {
+ R"#("{}": {{
+ "levels": {{
)#",
escapeJSONStrings(mon->szName).c_str());
@@ -287,20 +286,20 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& level : mon->m_aLayerSurfaceLayers) {
result += getFormat(
R"#(
- "%i": [
+ "{}": [
)#",
layerLevel);
for (auto& layer : level) {
result += getFormat(
- R"#( {
- "address": "0x%lx",
- "x": %i,
- "y": %i,
- "w": %i,
- "h": %i,
- "namespace": "%s"
- },)#",
- layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, escapeJSONStrings(layer->szNamespace).c_str());
+ R"#( {{
+ "address": "0x{:x}",
+ "x": {},
+ "y": {},
+ "w": {},
+ "h": {},
+ "namespace": "{}"
+ }},)#",
+ (uintptr_t)layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, escapeJSONStrings(layer->szNamespace).c_str());
}
trimTrailingComma(result);
@@ -324,14 +323,14 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
} else {
for (auto& mon : g_pCompositor->m_vMonitors) {
- result += getFormat("Monitor %s:\n", mon->szName.c_str());
+ result += getFormat("Monitor {}:\n", mon->szName.c_str());
int layerLevel = 0;
static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"};
for (auto& level : mon->m_aLayerSurfaceLayers) {
- result += getFormat("\tLayer level %i (%s):\n", layerLevel, levelNames[layerLevel].c_str());
+ result += getFormat("\tLayer level {} ({}):\n", layerLevel, levelNames[layerLevel].c_str());
for (auto& layer : level) {
- result += getFormat("\t\tLayer %lx: xywh: %i %i %i %i, namespace: %s\n", layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width,
+ result += getFormat("\t\tLayer {:x}: xywh: {} {} {} {}, namespace: {}\n", (uintptr_t)layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width,
layer->geometry.height, layer->szNamespace.c_str());
}
@@ -353,12 +352,12 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& m : g_pInputManager->m_lMice) {
result += getFormat(
- R"#( {
- "address": "0x%lx",
- "name": "%s",
- "defaultSpeed": %f
- },)#",
- &m, escapeJSONStrings(m.name).c_str(),
+ R"#( {{
+ "address": "0x{:x}",
+ "name": "{}",
+ "defaultSpeed": {:.5f}
+ }},)#",
+ (uintptr_t)&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);
}
@@ -369,18 +368,18 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& k : g_pInputManager->m_lKeyboards) {
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k);
result += getFormat(
- R"#( {
- "address": "0x%lx",
- "name": "%s",
- "rules": "%s",
- "model": "%s",
- "layout": "%s",
- "variant": "%s",
- "options": "%s",
- "active_keymap": "%s",
- "main": %s
- },)#",
- &k, escapeJSONStrings(k.name).c_str(), escapeJSONStrings(k.currentRules.rules).c_str(), escapeJSONStrings(k.currentRules.model).c_str(),
+ R"#( {{
+ "address": "0x{:x}",
+ "name": "{}",
+ "rules": "{}",
+ "model": "{}",
+ "layout": "{}",
+ "variant": "{}",
+ "options": "{}",
+ "active_keymap": "{}",
+ "main": {}
+ }},)#",
+ (uintptr_t)&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"));
}
@@ -392,34 +391,34 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& d : g_pInputManager->m_lTabletPads) {
result += getFormat(
- R"#( {
- "address": "0x%lx",
+ R"#( {{
+ "address": "0x{:x}",
"type": "tabletPad",
- "belongsTo": {
- "address": "0x%lx",
- "name": "%s"
- }
- },)#",
- &d, d.pTabletParent, escapeJSONStrings(d.pTabletParent ? d.pTabletParent->name : "").c_str());
+ "belongsTo": {{
+ "address": "0x{:x}",
+ "name": "{}"
+ }}
+ }},)#",
+ (uintptr_t)&d, (uintptr_t)d.pTabletParent, escapeJSONStrings(d.pTabletParent ? d.pTabletParent->name : "").c_str());
}
for (auto& d : g_pInputManager->m_lTablets) {
result += getFormat(
- R"#( {
- "address": "0x%lx",
- "name": "%s"
- },)#",
- &d, escapeJSONStrings(d.name).c_str());
+ R"#( {{
+ "address": "0x{:x}",
+ "name": "{}"
+ }},)#",
+ (uintptr_t)&d, escapeJSONStrings(d.name).c_str());
}
for (auto& d : g_pInputManager->m_lTabletTools) {
result += getFormat(
- R"#( {
- "address": "0x%lx",
+ R"#( {{
+ "address": "0x{:x}",
"type": "tabletTool",
- "belongsTo": "0x%lx"
- },)#",
- &d, d.wlrTabletTool ? d.wlrTabletTool->data : 0);
+ "belongsTo": "0x{:x}"
+ }},)#",
+ (uintptr_t)&d, d.wlrTabletTool ? d.wlrTabletTool->data : 0);
}
trimTrailingComma(result);
@@ -429,11 +428,11 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& d : g_pInputManager->m_lTouchDevices) {
result += getFormat(
- R"#( {
- "address": "0x%lx",
- "name": "%s"
- },)#",
- &d, d.name.c_str());
+ R"#( {{
+ "address": "0x{:x}",
+ "name": "{}"
+ }},)#",
+ (uintptr_t)&d, d.name.c_str());
}
trimTrailingComma(result);
@@ -443,11 +442,11 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& d : g_pInputManager->m_lSwitches) {
result += getFormat(
- R"#( {
- "address": "0x%lx",
- "name": "%s"
- },)#",
- &d, d.pWlrDevice ? d.pWlrDevice->name : "");
+ R"#( {{
+ "address": "0x{:x}",
+ "name": "{}"
+ }},)#",
+ (uintptr_t)&d, d.pWlrDevice ? d.pWlrDevice->name : "");
}
trimTrailingComma(result);
@@ -460,7 +459,7 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& m : g_pInputManager->m_lMice) {
result += getFormat(
- "\tMouse at %lx:\n\t\t%s\n\t\t\tdefault speed: %f\n", &m, m.name.c_str(),
+ "\tMouse at {:x}:\n\t\t{}\n\t\t\tdefault speed: {:.5f}\n", (uintptr_t)&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));
}
@@ -468,35 +467,35 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& k : g_pInputManager->m_lKeyboards) {
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k);
- result += getFormat("\tKeyboard at %lx:\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{}\n\t\t\trules: r \"{}\", m \"{}\", l \"{}\", v \"{}\", o \"{}\"\n\t\t\tactive keymap: {}\n\t\t\tmain: {}\n",
+ (uintptr_t)&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";
for (auto& d : g_pInputManager->m_lTabletPads) {
- result += getFormat("\tTablet Pad at %lx (belongs to %lx -> %s)\n", &d, d.pTabletParent, d.pTabletParent ? d.pTabletParent->name.c_str() : "");
+ result += getFormat("\tTablet Pad at {:x} (belongs to {:x} -> {})\n", (uintptr_t)&d, (uintptr_t)d.pTabletParent, d.pTabletParent ? d.pTabletParent->name.c_str() : "");
}
for (auto& d : g_pInputManager->m_lTablets) {
- result += getFormat("\tTablet at %lx:\n\t\t%s\n", &d, d.name.c_str());
+ result += getFormat("\tTablet at {:x}:\n\t\t{}\n", (uintptr_t)&d, d.name.c_str());
}
for (auto& d : g_pInputManager->m_lTabletTools) {
- result += getFormat("\tTablet Tool at %lx (belongs to %lx)\n", &d, d.wlrTabletTool ? d.wlrTabletTool->data : 0);
+ result += getFormat("\tTablet Tool at {:x} (belongs to {:x})\n", (uintptr_t)&d, d.wlrTabletTool ? d.wlrTabletTool->data : 0);
}
result += "\n\nTouch:\n";
for (auto& d : g_pInputManager->m_lTouchDevices) {
- result += getFormat("\tTouch Device at %lx:\n\t\t%s\n", &d, d.name.c_str());
+ result += getFormat("\tTouch Device at {:x}:\n\t\t{}\n", (uintptr_t)&d, d.name.c_str());
}
result += "\n\nSwitches:\n";
for (auto& d : g_pInputManager->m_lSwitches) {
- result += getFormat("\tSwitch Device at %lx:\n\t\t%s\n", &d, d.pWlrDevice ? d.pWlrDevice->name : "");
+ result += getFormat("\tSwitch Device at {:x}:\n\t\t{}\n", (uintptr_t)&d, d.pWlrDevice ? d.pWlrDevice->name : "");
}
}
@@ -509,14 +508,14 @@ std::string animationsRequest(HyprCtl::eHyprCtlOutputFormat format) {
ret += "animations:\n";
for (auto& ac : g_pConfigManager->getAnimationConfig()) {
- ret += getFormat("\n\tname: %s\n\t\toverriden: %i\n\t\tbezier: %s\n\t\tenabled: %i\n\t\tspeed: %.2f\n\t\tstyle: %s\n", ac.first.c_str(), (int)ac.second.overridden,
+ ret += getFormat("\n\tname: {}\n\t\toverriden: {}\n\t\tbezier: {}\n\t\tenabled: {}\n\t\tspeed: {:.2f}\n\t\tstyle: {}\n", ac.first.c_str(), (int)ac.second.overridden,
ac.second.internalBezier.c_str(), ac.second.internalEnabled, ac.second.internalSpeed, ac.second.internalStyle.c_str());
}
ret += "beziers:\n";
for (auto& bz : g_pAnimationManager->getAllBeziers()) {
- ret += getFormat("\n\tname: %s\n", bz.first.c_str());
+ ret += getFormat("\n\tname: {}\n", bz.first.c_str());
}
} else {
// json
@@ -524,14 +523,14 @@ std::string animationsRequest(HyprCtl::eHyprCtlOutputFormat format) {
ret += "[[";
for (auto& ac : g_pConfigManager->getAnimationConfig()) {
ret += getFormat(R"#(
-{
- "name": "%s",
- "overridden": %s,
- "bezier": "%s",
- "enabled": %s,
- "speed": %.2f,
- "style": "%s"
-},)#",
+{{
+ "name": "{}",
+ "overridden": {},
+ "bezier": "{}",
+ "enabled": {},
+ "speed": {:.2f},
+ "style": "{}"
+}},)#",
ac.first.c_str(), ac.second.overridden ? "true" : "false", ac.second.internalBezier.c_str(), ac.second.internalEnabled ? "true" : "false",
ac.second.internalSpeed, ac.second.internalStyle.c_str());
}
@@ -542,9 +541,9 @@ std::string animationsRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& bz : g_pAnimationManager->getAllBeziers()) {
ret += getFormat(R"#(
-{
- "name": "%s"
-},)#",
+{{
+ "name": "{}"
+}},)#",
bz.first.c_str());
}
@@ -561,15 +560,15 @@ std::string globalShortcutsRequest(HyprCtl::eHyprCtlOutputFormat format) {
const auto SHORTCUTS = g_pProtocolManager->m_pGlobalShortcutsProtocolManager->getAllShortcuts();
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
for (auto& sh : SHORTCUTS)
- ret += getFormat("%s:%s -> %s\n", sh.appid.c_str(), sh.id.c_str(), sh.description.c_str());
+ ret += getFormat("{}:{} -> {}\n", sh.appid.c_str(), sh.id.c_str(), sh.description.c_str());
} else {
ret += "[";
for (auto& sh : SHORTCUTS) {
ret += getFormat(R"#(
-{
- "name": "%s",
- "description": "%s"
-},)#",
+{{
+ "name": "{}",
+ "description": "{}"
+}},)#",
escapeJSONStrings(sh.appid + ":" + sh.id).c_str(), escapeJSONStrings(sh.description).c_str());
}
trimTrailingComma(ret);
@@ -595,7 +594,7 @@ std::string bindsRequest(HyprCtl::eHyprCtlOutputFormat format) {
if (kb.nonConsuming)
ret += "n";
- ret += getFormat("\n\tmodmask: %u\n\tsubmap: %s\n\tkey: %s\n\tkeycode: %d\n\tdispatcher: %s\n\targ: %s\n\n", kb.modmask, kb.submap.c_str(), kb.key.c_str(), kb.keycode,
+ ret += getFormat("\n\tmodmask: {}\n\tsubmap: {}\n\tkey: {}\n\tkeycode: {}\n\tdispatcher: {}\n\targ: {}\n\n", kb.modmask, kb.submap.c_str(), kb.key.c_str(), kb.keycode,
kb.handler.c_str(), kb.arg.c_str());
}
} else {
@@ -604,19 +603,19 @@ std::string bindsRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& kb : g_pKeybindManager->m_lKeybinds) {
ret += getFormat(
R"#(
-{
- "locked": %s,
- "mouse": %s,
- "release": %s,
- "repeat": %s,
- "non_consuming": %s,
- "modmask": %u,
- "submap": "%s",
- "key": "%s",
- "keycode": %i,
- "dispatcher": "%s",
- "arg": "%s"
-},)#",
+{{
+ "locked": {},
+ "mouse": {},
+ "release": {},
+ "repeat": {},
+ "non_consuming": {},
+ "modmask": {},
+ "submap": "{}",
+ "key": "{}",
+ "keycode": {},
+ "dispatcher": "{}",
+ "arg": "{}"
+}},)#",
kb.locked ? "true" : "false", kb.mouse ? "true" : "false", kb.release ? "true" : "false", kb.repeat ? "true" : "false", kb.nonConsuming ? "true" : "false",
kb.modmask, escapeJSONStrings(kb.submap).c_str(), escapeJSONStrings(kb.key).c_str(), kb.keycode, escapeJSONStrings(kb.handler).c_str(),
escapeJSONStrings(kb.arg).c_str());
@@ -653,12 +652,12 @@ std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
return result;
} else {
std::string result = getFormat(
- R"#({
- "branch": "%s",
- "commit": "%s",
- "dirty": %s,
- "commit_message": "%s",
- "tag": "%s",
+ R"#({{
+ "branch": "{}",
+ "commit": "{}",
+ "dirty": {},
+ "commit_message": "{}",
+ "tag": "{}",
"flags": [)#",
GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), escapeJSONStrings(commitMsg).c_str(), GIT_TAG);
@@ -701,7 +700,7 @@ std::string dispatchRequest(std::string in) {
DISPATCHER->second(DISPATCHARG);
- Debug::log(LOG, "Hyprctl: dispatcher %s : %s", DISPATCHSTR.c_str(), DISPATCHARG.c_str());
+ Debug::log(LOG, "Hyprctl: dispatcher {} : {}", DISPATCHSTR.c_str(), DISPATCHARG.c_str());
return "ok";
}
@@ -746,7 +745,7 @@ std::string dispatchKeyword(std::string in) {
}
}
- Debug::log(LOG, "Hyprctl: keyword %s : %s", COMMAND.c_str(), VALUE.c_str());
+ Debug::log(LOG, "Hyprctl: keyword {} : {}", COMMAND.c_str(), VALUE.c_str());
if (retval == "")
return "ok";
@@ -783,13 +782,13 @@ std::string cursorPosRequest(HyprCtl::eHyprCtlOutputFormat format) {
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal().floor();
if (format == HyprCtl::FORMAT_NORMAL) {
- return getFormat("%i, %i", (int)CURSORPOS.x, (int)CURSORPOS.y);
+ return getFormat("{}, {}", (int)CURSORPOS.x, (int)CURSORPOS.y);
} else {
return getFormat(R"#(
-{
- "x": %i,
- "y": %i
-}
+{{
+ "x": {},
+ "y": {}
+}}
)#",
(int)CURSORPOS.x, (int)CURSORPOS.y);
}
@@ -1043,20 +1042,20 @@ 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: %lx", curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(),
- PCFGOPT->data.get());
+ return getFormat("option {}\n\tint: {}\n\tfloat: {:.5f}\n\tstr: \"{}\"\n\tdata: {:x}", curitem, PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue,
+ (uintptr_t)PCFGOPT->data.get());
else {
return getFormat(
R"#(
-{
- "option": "%s",
- "int": %lld,
- "float": %f,
- "str": "%s",
- "data": "0x%lx"
-}
+{{
+ "option": "{}",
+ "int": {}
+ "float": {:.5f},
+ "str": "{}",
+ "data": "0x{:x}"
+}}
)#",
- curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(), PCFGOPT->data.get());
+ curitem, PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue, (uintptr_t)PCFGOPT->data.get());
}
}
@@ -1172,8 +1171,8 @@ std::string dispatchPlugin(std::string request) {
std::string list = "";
for (auto& p : PLUGINS) {
- list += getFormat("\nPlugin %s by %s:\n\tHandle: %lx\n\tVersion: %s\n\tDescription: %s\n", p->name.c_str(), p->author.c_str(), p->m_pHandle, p->version.c_str(),
- p->description.c_str());
+ list += getFormat("\nPlugin {} by {}:\n\tHandle: {:x}\n\tVersion: {}\n\tDescription: {}\n", p->name.c_str(), p->author.c_str(), (uintptr_t)p->m_pHandle,
+ p->version.c_str(), p->description.c_str());
}
return list;
@@ -1338,7 +1337,7 @@ int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
try {
reply = getReply(request);
} catch (std::exception& e) {
- Debug::log(ERR, "Error in request: %s", e.what());
+ Debug::log(ERR, "Error in request: {}", e.what());
reply = "Err: " + std::string(e.what());
}
@@ -1376,7 +1375,7 @@ void HyprCtl::startHyprCtlSocket() {
// 10 max queued.
listen(iSocketFD, 10);
- Debug::log(LOG, "Hypr socket started at %s", socketPath.c_str());
+ Debug::log(LOG, "Hypr socket started at {}", socketPath.c_str());
wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, iSocketFD, WL_EVENT_READABLE, hyprCtlFDTick, nullptr);
}
diff --git a/src/debug/HyprDebugOverlay.cpp b/src/debug/HyprDebugOverlay.cpp
index bd10f680..4eb14cef 100644
--- a/src/debug/HyprDebugOverlay.cpp
+++ b/src/debug/HyprDebugOverlay.cpp
@@ -132,7 +132,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 17;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
- text = std::string(getFormat("%i FPS", (int)FPS));
+ text = getFormat("{} FPS", (int)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)
@@ -143,7 +143,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
- text = std::string(getFormat("Avg Frametime: %.2fms (var %.2fms)", avgFrametime, varFrametime));
+ text = getFormat("Avg Frametime: {:.2f}ms (var {:.2f}ms)", avgFrametime, varFrametime);
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)
@@ -151,7 +151,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
- text = std::string(getFormat("Avg Rendertime: %.2fms (var %.2fms)", avgRenderTime, varRenderTime));
+ text = getFormat("Avg Rendertime: {:.2f}ms (var {:.2f}ms)", avgRenderTime, varRenderTime);
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)
@@ -159,7 +159,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
- text = std::string(getFormat("Avg Rendertime (No Overlay): %.2fms (var %.2fms)", avgRenderTimeNoOverlay, varRenderTimeNoOverlay));
+ text = getFormat("Avg Rendertime (No Overlay): {:.2f}ms (var {:.2f}ms)", avgRenderTimeNoOverlay, varRenderTimeNoOverlay);
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)
@@ -167,7 +167,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
- text = std::string(getFormat("Avg Anim Tick: %.2fms (var %.2fms) (%.2f TPS)", avgAnimMgrTick, varAnimMgrTick, 1.0 / (avgAnimMgrTick / 1000.0)));
+ text = getFormat("Avg Anim Tick: {:.2f}ms (var {:.2f}ms) ({:.2f} TPS)", avgAnimMgrTick, varAnimMgrTick, 1.0 / (avgAnimMgrTick / 1000.0));
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)
diff --git a/src/debug/Log.cpp b/src/debug/Log.cpp
index 4c3a8b2a..8850a0af 100644
--- a/src/debug/Log.cpp
+++ b/src/debug/Log.cpp
@@ -27,61 +27,3 @@ void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) {
if (!disableStdout)
std::cout << output << "\n";
}
-
-void Debug::log(LogLevel level, const char* fmt, ...) {
-
- if (disableLogs && *disableLogs)
- return;
-
- if (level == TRACE && !trace)
- return;
-
- // log to a file
- std::ofstream ofs;
- 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;
- case TRACE: ofs << "[TRACE] "; 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());
- 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:");
-
- if (MILLIS > 99)
- ofs << MILLIS;
- else if (MILLIS > 9)
- ofs << "0" << MILLIS;
- else
- ofs << "00" << MILLIS;
-
- ofs << "] ";
- }
-
- char* outputStr = nullptr;
-
- va_list args;
- va_start(args, fmt);
- vasprintf(&outputStr, fmt, args);
- va_end(args);
-
- std::string output = std::string(outputStr);
- free(outputStr);
-
- ofs << output << "\n";
-
- ofs.close();
-
- // log it to the stdout too.
- if (!disableStdout)
- std::cout << output << "\n";
-}
diff --git a/src/debug/Log.hpp b/src/debug/Log.hpp
index b2d76187..a65bccb1 100644
--- a/src/debug/Log.hpp
+++ b/src/debug/Log.hpp
@@ -1,10 +1,16 @@
#pragma once
#include <string>
#include <wlr/util/log.h>
+#include <format>
+#include <iostream>
+#include <fstream>
+#include <chrono>
+#include "../helpers/MiscFunctions.hpp"
#define LOGMESSAGESIZE 1024
-enum LogLevel {
+enum LogLevel
+{
NONE = -1,
LOG = 0,
WARN,
@@ -15,13 +21,71 @@ enum LogLevel {
};
namespace Debug {
- 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 bool disableStdout = false;
inline bool trace = false;
+
+ void init(const std::string& IS);
+ template <typename... Args>
+ void log(LogLevel level, const std::string& fmt, Args&&... args) {
+ if (disableLogs && *disableLogs)
+ return;
+
+ if (level == TRACE && !trace)
+ return;
+
+ std::string logMsg = "";
+
+ switch (level) {
+ case LOG: logMsg += "[LOG] "; break;
+ case WARN: logMsg += "[WARN] "; break;
+ case ERR: logMsg += "[ERR] "; break;
+ case CRIT: logMsg += "[CRITICAL] "; break;
+ case INFO: logMsg += "[INFO] "; break;
+ case TRACE: logMsg += "[TRACE] "; break;
+ default: break;
+ }
+
+ // log to a file
+ std::ofstream ofs;
+ ofs.open(logFile, std::ios::out | std::ios::app);
+
+ // print date and time to the ofs
+ if (disableTime && !*disableTime) {
+#ifndef _LIBCPP_VERSION
+ logMsg += std::format("[{:%T}] ", std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())});
+#else
+ auto c = std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())};
+ logMsg += std::format("{:%H}:{:%M}:{:%S}", c.hours(), c.minutes(), c.subseconds());
+
+#endif
+ }
+
+ try {
+ logMsg += std::vformat(fmt, std::make_format_args(args...));
+ } catch (std::exception& e) {
+ std::string exceptionMsg = e.what();
+ Debug::log(ERR, "caught exception in Debug::log: {}", exceptionMsg);
+
+ const auto CALLSTACK = getBacktrace();
+
+ Debug::log(LOG, "stacktrace:");
+
+ for (size_t i = 0; i < CALLSTACK.size(); ++i) {
+ Debug::log(NONE, "\t #{} | {}", i, CALLSTACK[i].desc);
+ }
+ }
+
+ ofs << logMsg << "\n";
+
+ ofs.close();
+
+ // log it to the stdout too.
+ if (!disableStdout)
+ std::cout << logMsg << "\n";
+ }
+
+ void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
}; \ No newline at end of file
diff --git a/src/debug/TracyDefines.hpp b/src/debug/TracyDefines.hpp
index b96a71dd..767b1a20 100644
--- a/src/debug/TracyDefines.hpp
+++ b/src/debug/TracyDefines.hpp
@@ -16,7 +16,7 @@ inline PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64v;
inline void loadGLProc(void* pProc, const char* name) {
void* proc = (void*)eglGetProcAddress(name);
if (proc == NULL) {
- Debug::log(CRIT, "[Tracy GPU Profiling] eglGetProcAddress(%s) failed", name);
+ Debug::log(CRIT, "[Tracy GPU Profiling] eglGetProcAddress({}) failed", name);
abort();
}
*(void**)pProc = proc;
diff --git a/src/events/Devices.cpp b/src/events/Devices.cpp
index c80337f8..81f97970 100644
--- a/src/events/Devices.cpp
+++ b/src/events/Devices.cpp
@@ -19,7 +19,7 @@ void Events::listener_keyboardDestroy(void* owner, void* data) {
SKeyboard* PKEYBOARD = (SKeyboard*)owner;
g_pInputManager->destroyKeyboard(PKEYBOARD);
- Debug::log(LOG, "Destroyed keyboard %lx", PKEYBOARD);
+ Debug::log(LOG, "Destroyed keyboard {:x}", (uintptr_t)PKEYBOARD);
}
void Events::listener_keyboardKey(void* owner, void* data) {
@@ -63,30 +63,30 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
switch (DEVICE->type) {
case WLR_INPUT_DEVICE_KEYBOARD:
- Debug::log(LOG, "Attached a keyboard with name %s", DEVICE->name);
+ Debug::log(LOG, "Attached a keyboard with name {}", DEVICE->name);
g_pInputManager->newKeyboard(DEVICE);
break;
case WLR_INPUT_DEVICE_POINTER:
- Debug::log(LOG, "Attached a mouse with name %s", DEVICE->name);
+ Debug::log(LOG, "Attached a mouse with name {}", DEVICE->name);
g_pInputManager->newMouse(DEVICE);
break;
case WLR_INPUT_DEVICE_TOUCH:
- Debug::log(LOG, "Attached a touch device with name %s", DEVICE->name);
+ Debug::log(LOG, "Attached a touch device with name {}", DEVICE->name);
g_pInputManager->newTouchDevice(DEVICE);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
- Debug::log(LOG, "Attached a tablet tool with name %s", DEVICE->name);
+ Debug::log(LOG, "Attached a tablet tool with name {}", DEVICE->name);
g_pInputManager->newTabletTool(DEVICE);
break;
case WLR_INPUT_DEVICE_TABLET_PAD:
- Debug::log(LOG, "Attached a tablet pad with name %s", DEVICE->name);
+ Debug::log(LOG, "Attached a tablet pad with name {}", DEVICE->name);
g_pInputManager->newTabletPad(DEVICE);
break;
case WLR_INPUT_DEVICE_SWITCH:
- Debug::log(LOG, "Attached a switch device with name %s", DEVICE->name);
+ Debug::log(LOG, "Attached a switch device with name {}", DEVICE->name);
g_pInputManager->newSwitch(DEVICE);
break;
- default: Debug::log(WARN, "Unrecognized input device plugged in: %s", DEVICE->name); break;
+ default: Debug::log(WARN, "Unrecognized input device plugged in: {}", DEVICE->name); break;
}
g_pInputManager->updateCapabilities();
@@ -95,7 +95,7 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
void Events::listener_newConstraint(wl_listener* listener, void* data) {
const auto PCONSTRAINT = (wlr_pointer_constraint_v1*)data;
- Debug::log(LOG, "New mouse constraint at %lx", PCONSTRAINT);
+ Debug::log(LOG, "New mouse constraint at {:x}", (uintptr_t)PCONSTRAINT);
g_pInputManager->m_lConstraints.emplace_back();
const auto CONSTRAINT = &g_pInputManager->m_lConstraints.back();
@@ -128,7 +128,7 @@ void Events::listener_destroyConstraint(void* owner, void* data) {
PCONSTRAINT->pMouse->currentConstraint = nullptr;
}
- Debug::log(LOG, "Unconstrained mouse from %lx", PCONSTRAINT->constraint);
+ Debug::log(LOG, "Unconstrained mouse from {:x}", (uintptr_t)PCONSTRAINT->constraint);
g_pInputManager->m_lConstraints.remove(*PCONSTRAINT);
}
diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp
index 4fec9041..0e10ddf7 100644
--- a/src/events/Layers.cpp
+++ b/src/events/Layers.cpp
@@ -26,7 +26,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
return;
}
- Debug::log(LOG, "New LayerSurface has no preferred monitor. Assigning Monitor %s", PMONITOR->szName.c_str());
+ Debug::log(LOG, "New LayerSurface has no preferred monitor. Assigning Monitor {}", PMONITOR->szName.c_str());
WLRLAYERSURFACE->output = PMONITOR->output;
}
@@ -55,14 +55,14 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
layerSurface->forceBlur = g_pConfigManager->shouldBlurLS(layerSurface->szNamespace);
- Debug::log(LOG, "LayerSurface %lx (namespace %s layer %d) created on monitor %s", layerSurface->layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer,
- PMONITOR->szName.c_str());
+ Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)layerSurface->layerSurface, layerSurface->layerSurface->_namespace,
+ (int)layerSurface->layer, PMONITOR->szName.c_str());
}
void Events::listener_destroyLayerSurface(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner;
- Debug::log(LOG, "LayerSurface %lx destroyed", layersurface->layerSurface);
+ Debug::log(LOG, "LayerSurface {:x} destroyed", (uintptr_t)layersurface->layerSurface);
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
@@ -107,7 +107,7 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
void Events::listener_mapLayerSurface(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner;
- Debug::log(LOG, "LayerSurface %lx mapped", layersurface->layerSurface);
+ Debug::log(LOG, "LayerSurface {:x} mapped", (uintptr_t)layersurface->layerSurface);
layersurface->mapped = true;
layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive;
@@ -177,7 +177,7 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
void Events::listener_unmapLayerSurface(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner;
- Debug::log(LOG, "LayerSurface %lx unmapped", layersurface->layerSurface);
+ Debug::log(LOG, "LayerSurface {:x} unmapped", (uintptr_t)layersurface->layerSurface);
g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", std::string(layersurface->layerSurface->_namespace ? layersurface->layerSurface->_namespace : "")});
EMIT_HOOK_EVENT("closeLayer", layersurface);
diff --git a/src/events/Misc.cpp b/src/events/Misc.cpp
index eb1a0e81..0f02e13a 100644
--- a/src/events/Misc.cpp
+++ b/src/events/Misc.cpp
@@ -49,7 +49,7 @@ void Events::listener_readyXWayland(wl_listener* listener, void* data) {
const auto XCBCONNECTION = xcb_connect(g_pXWaylandManager->m_sWLRXWayland->display_name, NULL);
const auto ERR = xcb_connection_has_error(XCBCONNECTION);
if (ERR) {
- Debug::log(LogLevel::ERR, "XWayland -> xcb_connection_has_error failed with %i", ERR);
+ Debug::log(LogLevel::ERR, "XWayland -> xcb_connection_has_error failed with {}", ERR);
return;
}
@@ -58,7 +58,7 @@ void Events::listener_readyXWayland(wl_listener* listener, void* data) {
xcb_intern_atom_reply_t* reply = xcb_intern_atom_reply(XCBCONNECTION, cookie, NULL);
if (!reply) {
- Debug::log(LogLevel::ERR, "XWayland -> Atom failed: %s", ATOM.first.c_str());
+ Debug::log(LogLevel::ERR, "XWayland -> Atom failed: {}", ATOM.first.c_str());
continue;
}
@@ -98,14 +98,14 @@ void Events::listener_startDrag(wl_listener* listener, void* data) {
wlr_drag* wlrDrag = (wlr_drag*)data;
- Debug::log(LOG, "Started drag %lx", wlrDrag);
+ Debug::log(LOG, "Started drag {:x}", (uintptr_t)wlrDrag);
wlrDrag->data = data;
g_pInputManager->m_sDrag.hyprListener_destroy.initCallback(&wlrDrag->events.destroy, &Events::listener_destroyDrag, &g_pInputManager->m_sDrag, "Drag");
if (wlrDrag->icon) {
- Debug::log(LOG, "Drag started with an icon %lx", wlrDrag->icon);
+ Debug::log(LOG, "Drag started with an icon {:x}", (uintptr_t)wlrDrag->icon);
g_pInputManager->m_sDrag.dragIcon = wlrDrag->icon;
wlrDrag->icon->data = g_pInputManager->m_sDrag.dragIcon;
@@ -157,7 +157,7 @@ void Events::listener_commitDragIcon(void* owner, void* data) {
}
void Events::listener_InhibitActivate(wl_listener* listener, void* data) {
- Debug::log(LOG, "Activated exclusive for %lx.", g_pCompositor->m_sSeat.exclusiveClient);
+ Debug::log(LOG, "Activated exclusive for {:x}.", (uintptr_t)g_pCompositor->m_sSeat.exclusiveClient);
g_pInputManager->refocus();
g_pCompositor->m_sSeat.exclusiveClient = g_pCompositor->m_sWLRInhibitMgr->active_client;
@@ -216,14 +216,14 @@ void Events::listener_newSessionLock(wl_listener* listener, void* data) {
}
void Events::listener_setGamma(wl_listener* listener, void* data) {
- Debug::log(LOG, "New Gamma event at %lx", data);
+ Debug::log(LOG, "New Gamma event at {:x}", (uintptr_t)data);
const auto E = (wlr_gamma_control_manager_v1_set_gamma_event*)data;
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(E->output);
if (!PMONITOR) {
- Debug::log(ERR, "Gamma event object references non-existent output %lx ?", E->output);
+ Debug::log(ERR, "Gamma event object references non-existent output {:x} ?", (uintptr_t)E->output);
return;
}
diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp
index 4258b4ec..003895d0 100644
--- a/src/events/Monitors.cpp
+++ b/src/events/Monitors.cpp
@@ -179,14 +179,14 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
if (!pMonitor)
return;
- Debug::log(LOG, "Destroy called for monitor %s", pMonitor->output->name);
+ Debug::log(LOG, "Destroy called for monitor {}", pMonitor->output->name);
pMonitor->onDisconnect();
pMonitor->output = nullptr;
pMonitor->m_bRenderingInitPassed = false;
- Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->szName.c_str());
+ Debug::log(LOG, "Removing monitor {} from realMonitors", pMonitor->szName.c_str());
std::erase_if(g_pCompositor->m_vRealMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; });
}
diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp
index 0c1594a5..fd4c9ea7 100644
--- a/src/events/Popups.cpp
+++ b/src/events/Popups.cpp
@@ -70,8 +70,8 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) {
pHyprPopup->monitor = PMONITOR;
- Debug::log(LOG, "Popup: Unconstrained from lx ly: %f %f, pHyprPopup lx ly: %f %f", (float)PMONITOR->vecPosition.x, (float)PMONITOR->vecPosition.y, (float)pHyprPopup->lx,
- (float)pHyprPopup->ly);
+ Debug::log(LOG, "Popup: Unconstrained from lx ly: {:.5f} {:.5f}, pHyprPopup lx ly: {:.5f} {:.5f}", (float)PMONITOR->vecPosition.x, (float)PMONITOR->vecPosition.y,
+ (float)pHyprPopup->lx, (float)pHyprPopup->ly);
}
void Events::listener_newPopup(void* owner, void* data) {
@@ -79,7 +79,7 @@ void Events::listener_newPopup(void* owner, void* data) {
ASSERT(layersurface);
- Debug::log(LOG, "New layer popup created from surface %lx", layersurface);
+ Debug::log(LOG, "New layer popup created from surface {:x}", (uintptr_t)layersurface);
const auto WLRPOPUP = (wlr_xdg_popup*)data;
@@ -103,7 +103,7 @@ void Events::listener_newPopupXDG(void* owner, void* data) {
if (!PWINDOW->m_bIsMapped)
return;
- Debug::log(LOG, "New layer popup created from XDG window %lx -> %s", PWINDOW, PWINDOW->m_szTitle.c_str());
+ Debug::log(LOG, "New layer popup created from XDG window {:x} -> {}", (uintptr_t)PWINDOW, PWINDOW->m_szTitle.c_str());
const auto WLRPOPUP = (wlr_xdg_popup*)data;
@@ -125,9 +125,9 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) {
ASSERT(PPOPUP);
if (PPOPUP->parentWindow)
- Debug::log(LOG, "New popup created from XDG Window popup %lx -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str());
+ Debug::log(LOG, "New popup created from XDG Window popup {:x} -> {}", (uintptr_t)PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str());
else
- Debug::log(LOG, "New popup created from Non-Window popup %lx", PPOPUP);
+ Debug::log(LOG, "New popup created from Non-Window popup {:x}", (uintptr_t)PPOPUP);
const auto WLRPOPUP = (wlr_xdg_popup*)data;
@@ -148,7 +148,7 @@ void Events::listener_mapPopupXDG(void* owner, void* data) {
ASSERT(PPOPUP);
- Debug::log(LOG, "New XDG Popup mapped at %d %d", (int)PPOPUP->lx, (int)PPOPUP->ly);
+ Debug::log(LOG, "New XDG Popup mapped at {} {}", (int)PPOPUP->lx, (int)PPOPUP->ly);
if (PPOPUP->parentWindow)
PPOPUP->parentWindow->m_lPopupSurfaces.emplace_back(PPOPUP->popup->base->surface);
@@ -168,13 +168,13 @@ void Events::listener_mapPopupXDG(void* owner, void* data) {
if (PPOPUP->monitor)
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(PPOPUP->popup->base->surface, PPOPUP->monitor->scale);
- Debug::log(LOG, "XDG Popup got assigned a surfaceTreeNode %lx", PPOPUP->pSurfaceTree);
+ Debug::log(LOG, "XDG Popup got assigned a surfaceTreeNode {:x}", (uintptr_t)PPOPUP->pSurfaceTree);
}
void Events::listener_repositionPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner;
- Debug::log(LOG, "XDG Popup %lx asks for a reposition", PPOPUP);
+ Debug::log(LOG, "XDG Popup {:x} asks for a reposition", (uintptr_t)PPOPUP);
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
@@ -242,7 +242,7 @@ void Events::listener_destroyPopupXDG(void* owner, void* data) {
ASSERT(PPOPUP);
- Debug::log(LOG, "Destroyed popup XDG %lx", PPOPUP);
+ Debug::log(LOG, "Destroyed popup XDG {:x}", (uintptr_t)PPOPUP);
if (PPOPUP->pSurfaceTree) {
SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree);
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index 888f0447..343466c8 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -134,7 +134,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (PMONITOR)
PWINDOW->m_iMonitorID = PMONITOR->ID;
else {
- Debug::log(ERR, "No monitor in monitor %s rule", MONITORSTR.c_str());
+ Debug::log(ERR, "No monitor in monitor {} rule", MONITORSTR.c_str());
continue;
}
}
@@ -148,8 +148,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
}
PWINDOW->m_iWorkspaceID = PMONITOR->specialWorkspaceID ? PMONITOR->specialWorkspaceID : PMONITOR->activeWorkspace;
- Debug::log(ERR, "Rule monitor, applying to window %lx -> mon: %i, workspace: %i", PWINDOW, PWINDOW->m_iMonitorID, PWINDOW->m_iWorkspaceID);
- } catch (std::exception& e) { Debug::log(ERR, "Rule monitor failed, rule: %s -> %s | err: %s", r.szRule.c_str(), r.szValue.c_str(), e.what()); }
+ Debug::log(ERR, "Rule monitor, applying to window {:x} -> mon: {}, workspace: {}", (uintptr_t)PWINDOW, PWINDOW->m_iMonitorID, PWINDOW->m_iWorkspaceID);
+ } catch (std::exception& e) { Debug::log(ERR, "Rule monitor failed, rule: {} -> {} | err: {}", r.szRule.c_str(), r.szValue.c_str(), e.what()); }
} else if (r.szRule.find("workspace") == 0) {
// check if it isnt unset
const auto WORKSPACERQ = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
@@ -165,7 +165,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (JUSTWORKSPACE == PWORKSPACE->m_szName || JUSTWORKSPACE == "name:" + PWORKSPACE->m_szName)
requestedWorkspace = "";
- Debug::log(LOG, "Rule workspace matched by window %lx, %s applied.", PWINDOW, r.szValue.c_str());
+ Debug::log(LOG, "Rule workspace matched by window {:x}, {} applied.", (uintptr_t)PWINDOW, r.szValue.c_str());
} else if (r.szRule.find("float") == 0) {
PWINDOW->m_bIsFloating = true;
} else if (r.szRule.find("tile") == 0) {
@@ -210,7 +210,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
} else if (IDLERULE == "fullscreen") {
PWINDOW->m_eIdleInhibitMode = IDLEINHIBIT_FULLSCREEN;
} else {
- Debug::log(ERR, "Rule idleinhibit: unknown mode %s", IDLERULE.c_str());
+ Debug::log(ERR, "Rule idleinhibit: unknown mode {}", IDLERULE.c_str());
}
}
PWINDOW->applyDynamicRule(r);
@@ -283,13 +283,13 @@ void Events::listener_mapWindow(void* owner, void* data) {
std::clamp(MAXSIZE.y, 20.0, PMONITOR->vecSize.y) :
(!SIZEYSTR.contains('%') ? std::stoi(SIZEYSTR) : std::stof(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
- Debug::log(LOG, "Rule size, applying to window %lx", PWINDOW);
+ Debug::log(LOG, "Rule size, applying to window {:x}", (uintptr_t)PWINDOW);
PWINDOW->m_vRealSize = Vector2D(SIZEX, SIZEY);
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
PWINDOW->setHidden(false);
- } catch (...) { Debug::log(LOG, "Rule size failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str()); }
+ } catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r.szRule.c_str(), r.szValue.c_str()); }
} else if (r.szRule.find("minsize") == 0) {
try {
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
@@ -303,7 +303,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
PWINDOW->setHidden(false);
- } catch (...) { Debug::log(LOG, "Rule minsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str()); }
+ } catch (...) { Debug::log(LOG, "Rule minsize failed, rule: {} -> {}", r.szRule.c_str(), r.szValue.c_str()); }
} else if (r.szRule.find("maxsize") == 0) {
try {
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
@@ -317,7 +317,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
PWINDOW->setHidden(false);
- } catch (...) { Debug::log(LOG, "Rule maxsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str()); }
+ } catch (...) { Debug::log(LOG, "Rule maxsize failed, rule: {} -> {}", r.szRule.c_str(), r.szValue.c_str()); }
} else if (r.szRule.find("move") == 0) {
try {
auto value = r.szRule.substr(r.szRule.find(' ') + 1);
@@ -373,12 +373,12 @@ void Events::listener_mapWindow(void* owner, void* data) {
}
}
- Debug::log(LOG, "Rule move, applying to window %lx", PWINDOW);
+ Debug::log(LOG, "Rule move, applying to window {:x}", (uintptr_t)PWINDOW);
PWINDOW->m_vRealPosition = Vector2D(posX, posY) + PMONITOR->vecPosition;
PWINDOW->setHidden(false);
- } catch (...) { Debug::log(LOG, "Rule move failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str()); }
+ } catch (...) { Debug::log(LOG, "Rule move failed, rule: {} -> {}", r.szRule.c_str(), r.szValue.c_str()); }
} else if (r.szRule.find("center") == 0) {
auto RESERVEDOFFSET = Vector2D();
const auto ARGS = CVarList(r.szRule, 2, ' ');
@@ -426,7 +426,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_fDimPercent.setValueAndWarp(0);
}
- Debug::log(LOG, "Window got assigned a surfaceTreeNode %lx", PWINDOW->m_pSurfaceTree);
+ Debug::log(LOG, "Window got assigned a surfaceTreeNode {:x}", (uintptr_t)PWINDOW->m_pSurfaceTree);
if (!PWINDOW->m_bIsX11) {
PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xdg->surface->events.commit, &Events::listener_commitWindow, PWINDOW, "XDG Window Late");
@@ -572,12 +572,12 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_bFirstMap = false;
- Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y,
- PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
+ Debug::log(LOG, "Map request dispatched, monitor {}, xywh: {:.5f} {:.5f} {:.5f} {:.5f}", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x,
+ PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName;
- g_pEventManager->postEvent(
- SHyprIPCEvent{"openwindow", getFormat("%lx,%s,%s,%s", PWINDOW, workspaceID.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())});
+ g_pEventManager->postEvent(SHyprIPCEvent{
+ "openwindow", getFormat("{:x},{},{},{}", (uintptr_t)PWINDOW, workspaceID.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())});
EMIT_HOOK_EVENT("openWindow", PWINDOW);
// recalc the values for this window
@@ -589,15 +589,15 @@ void Events::listener_mapWindow(void* owner, void* data) {
void Events::listener_unmapWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
- Debug::log(LOG, "Window %lx unmapped (class %s)", PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
+ Debug::log(LOG, "Window {:x} unmapped (class {})", (uintptr_t)PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
if (!PWINDOW->m_pWLSurface.exists() || !PWINDOW->m_bIsMapped) {
- Debug::log(WARN, "Window %lx unmapped without being mapped??", PWINDOW);
+ Debug::log(WARN, "Window {:x} unmapped without being mapped??", (uintptr_t)PWINDOW);
PWINDOW->m_bFadingOut = false;
return;
}
- g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", getFormat("%lx", PWINDOW)});
+ g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", getFormat("{:x}", (uintptr_t)PWINDOW)});
EMIT_HOOK_EVENT("closeWindow", PWINDOW);
g_pProtocolManager->m_pToplevelExportProtocolManager->onWindowUnmap(PWINDOW);
@@ -669,7 +669,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
if (wasLastWindow) {
const auto PWINDOWCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW);
- Debug::log(LOG, "On closed window, new focused candidate is %lx", PWINDOWCANDIDATE);
+ Debug::log(LOG, "On closed window, new focused candidate is {:x}", (uintptr_t)PWINDOWCANDIDATE);
if (PWINDOWCANDIDATE != g_pCompositor->m_pLastWindow) {
if (!PWINDOWCANDIDATE)
@@ -683,7 +683,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
}
- Debug::log(LOG, "Destroying the SubSurface tree of unmapped window %lx", PWINDOW);
+ Debug::log(LOG, "Destroying the SubSurface tree of unmapped window {:x}", (uintptr_t)PWINDOW);
SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
PWINDOW->m_pSurfaceTree = nullptr;
@@ -750,10 +750,10 @@ void Events::listener_commitWindow(void* owner, void* data) {
void Events::listener_destroyWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
- Debug::log(LOG, "Window %lx destroyed, queueing. (class %s)", PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
+ Debug::log(LOG, "Window {:x} destroyed, queueing. (class {})", (uintptr_t)PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
if (PWINDOW->m_bIsX11)
- Debug::log(LOG, "XWayland class raw: %s", PWINDOW->m_uSurface.xwayland->_class);
+ Debug::log(LOG, "XWayland class raw: {}", PWINDOW->m_uSurface.xwayland->_class ? PWINDOW->m_uSurface.xwayland->_class : "null");
if (PWINDOW == g_pCompositor->m_pLastWindow) {
g_pCompositor->m_pLastWindow = nullptr;
@@ -771,7 +771,7 @@ void Events::listener_destroyWindow(void* owner, void* data) {
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
if (PWINDOW->m_pSurfaceTree) {
- Debug::log(LOG, "Destroying Subsurface tree of %lx in destroyWindow", PWINDOW);
+ Debug::log(LOG, "Destroying Subsurface tree of {:x} in destroyWindow", (uintptr_t)PWINDOW);
SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
PWINDOW->m_pSurfaceTree = nullptr;
}
@@ -780,7 +780,7 @@ void Events::listener_destroyWindow(void* owner, void* data) {
if (!PWINDOW->m_bFadingOut) {
g_pCompositor->removeWindowFromVectorSafe(PWINDOW); // most likely X11 unmanaged or sumn
- Debug::log(LOG, "Unmapped window %lx removed instantly", PWINDOW);
+ Debug::log(LOG, "Unmapped window {:x} removed instantly", (uintptr_t)PWINDOW);
}
}
@@ -791,12 +791,12 @@ void Events::listener_setTitleWindow(void* owner, void* data) {
return;
PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW);
- g_pEventManager->postEvent(SHyprIPCEvent{"windowtitle", getFormat("%lx", PWINDOW)});
+ g_pEventManager->postEvent(SHyprIPCEvent{"windowtitle", getFormat("{:x}", (uintptr_t)PWINDOW)});
EMIT_HOOK_EVENT("windowTitle", PWINDOW);
if (PWINDOW == g_pCompositor->m_pLastWindow) { // if it's the active, let's post an event to update others
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(PWINDOW) + "," + PWINDOW->m_szTitle});
- g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", getFormat("%lx", PWINDOW)});
+ g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", getFormat("{:x}", (uintptr_t)PWINDOW)});
EMIT_HOOK_EVENT("activeWindow", PWINDOW);
}
@@ -804,7 +804,7 @@ void Events::listener_setTitleWindow(void* owner, void* data) {
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
PWINDOW->updateToplevel();
- Debug::log(LOG, "Window %lx set title to %s", PWINDOW, PWINDOW->m_szTitle.c_str());
+ Debug::log(LOG, "Window {:x} set title to {}", (uintptr_t)PWINDOW, PWINDOW->m_szTitle.c_str());
}
void Events::listener_fullscreenWindow(void* owner, void* data) {
@@ -863,7 +863,7 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
PWINDOW->updateToplevel();
- Debug::log(LOG, "Window %lx fullscreen to %i", PWINDOW, PWINDOW->m_bIsFullscreen);
+ Debug::log(LOG, "Window {:x} fullscreen to {}", (uintptr_t)PWINDOW, PWINDOW->m_bIsFullscreen);
}
void Events::listener_activateXDG(wl_listener* listener, void* data) {
@@ -871,7 +871,7 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) {
static auto* const PFOCUSONACTIVATE = &g_pConfigManager->getConfigValuePtr("misc:focus_on_activate")->intValue;
- Debug::log(LOG, "Activate request for surface at %lx", E->surface);
+ Debug::log(LOG, "Activate request for surface at {:x}", (uintptr_t)E->surface);
if (!wlr_xdg_surface_try_from_wlr_surface(E->surface))
return;
@@ -881,7 +881,7 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) {
if (!PWINDOW || PWINDOW == g_pCompositor->m_pLastWindow)
return;
- g_pEventManager->postEvent(SHyprIPCEvent{"urgent", getFormat("%lx", PWINDOW)});
+ g_pEventManager->postEvent(SHyprIPCEvent{"urgent", getFormat("{:x}", (uintptr_t)PWINDOW)});
EMIT_HOOK_EVENT("urgent", PWINDOW);
PWINDOW->m_bIsUrgent = true;
@@ -902,11 +902,11 @@ void Events::listener_activateX11(void* owner, void* data) {
static auto* const PFOCUSONACTIVATE = &g_pConfigManager->getConfigValuePtr("misc:focus_on_activate")->intValue;
- Debug::log(LOG, "X11 Activate request for window %lx", PWINDOW);
+ Debug::log(LOG, "X11 Activate request for window {:x}", (uintptr_t)PWINDOW);
if (PWINDOW->m_iX11Type == 2) {
- Debug::log(LOG, "Unmanaged X11 %lx requests activate", PWINDOW);
+ Debug::log(LOG, "Unmanaged X11 {:x} requests activate", (uintptr_t)PWINDOW);
if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->getPID() != PWINDOW->getPID())
return;
@@ -918,7 +918,7 @@ void Events::listener_activateX11(void* owner, void* data) {
if (PWINDOW == g_pCompositor->m_pLastWindow)
return;
- g_pEventManager->postEvent(SHyprIPCEvent{"urgent", getFormat("%lx", PWINDOW)});
+ g_pEventManager->postEvent(SHyprIPCEvent{"urgent", getFormat("{:x}", (uintptr_t)PWINDOW)});
EMIT_HOOK_EVENT("urgent", PWINDOW);
if (!*PFOCUSONACTIVATE)
@@ -1012,8 +1012,8 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
if (abs(std::floor(POS.x) - LOGICALPOS.x) > 2 || abs(std::floor(POS.y) - LOGICALPOS.y) > 2 || abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 ||
abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) {
- Debug::log(LOG, "Unmanaged window %lx requests geometry update to %i %i %i %i", PWINDOW, (int)LOGICALPOS.x, (int)LOGICALPOS.y, (int)PWINDOW->m_uSurface.xwayland->width,
- (int)PWINDOW->m_uSurface.xwayland->height);
+ Debug::log(LOG, "Unmanaged window {:x} requests geometry update to {} {} {} {}", (uintptr_t)PWINDOW, (int)LOGICALPOS.x, (int)LOGICALPOS.y,
+ (int)PWINDOW->m_uSurface.xwayland->width, (int)PWINDOW->m_uSurface.xwayland->height);
g_pHyprRenderer->damageWindow(PWINDOW);
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(LOGICALPOS.x, LOGICALPOS.y));
@@ -1060,9 +1060,9 @@ void Events::listener_dissociateX11(void* owner, void* data) {
void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
const auto XWSURFACE = (wlr_xwayland_surface*)data;
- Debug::log(LOG, "New XWayland Surface created (class %s).", XWSURFACE->_class);
+ Debug::log(LOG, "New XWayland Surface created (class {}).", XWSURFACE->_class ? XWSURFACE->_class : "null");
if (XWSURFACE->parent)
- Debug::log(LOG, "Window parent data: %s at %lx", XWSURFACE->parent->_class, XWSURFACE->parent);
+ Debug::log(LOG, "Window parent data: {} at {:x}", XWSURFACE->parent->_class ? XWSURFACE->parent->_class : "null", (uintptr_t)XWSURFACE->parent);
const auto PNEWWINDOW = (CWindow*)g_pCompositor->m_vWindows.emplace_back(std::make_unique<CWindow>()).get();
@@ -1086,7 +1086,7 @@ void Events::listener_newXDGSurface(wl_listener* listener, void* data) {
if (XDGSURFACE->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL)
return;
- Debug::log(LOG, "New XDG Surface created. (class: %s)", XDGSURFACE->toplevel->app_id);
+ Debug::log(LOG, "New XDG Surface created. (class: {})", XDGSURFACE->toplevel->app_id ? XDGSURFACE->toplevel->app_id : "null");
const auto PNEWWINDOW = g_pCompositor->m_vWindows.emplace_back(std::make_unique<CWindow>()).get();
PNEWWINDOW->m_uSurface.xdg = XDGSURFACE;
@@ -1106,7 +1106,7 @@ void Events::listener_requestMaximize(void* owner, void* data) {
if (PWINDOW->m_bNoMaximizeRequest)
return;
- Debug::log(LOG, "Maximize request for %lx", PWINDOW);
+ Debug::log(LOG, "Maximize request for {:x}", (uintptr_t)PWINDOW);
if (!PWINDOW->m_bIsX11) {
const auto EV = (wlr_foreign_toplevel_handle_v1_maximized_event*)data;
@@ -1125,7 +1125,7 @@ void Events::listener_requestMaximize(void* owner, void* data) {
void Events::listener_requestMinimize(void* owner, void* data) {
const auto PWINDOW = (CWindow*)owner;
- Debug::log(LOG, "Minimize request for %lx", PWINDOW);
+ Debug::log(LOG, "Minimize request for {:x}", (uintptr_t)PWINDOW);
if (PWINDOW->m_bIsX11) {
if (!PWINDOW->m_bMappedX11 || PWINDOW->m_iX11Type != 1)
@@ -1133,13 +1133,13 @@ void Events::listener_requestMinimize(void* owner, void* data) {
const auto E = (wlr_xwayland_minimize_event*)data;
- g_pEventManager->postEvent({"minimize", getFormat("%lx,%i", PWINDOW, (int)E->minimize)});
+ g_pEventManager->postEvent({"minimize", getFormat("{:x},{}", (uintptr_t)PWINDOW, (int)E->minimize)});
EMIT_HOOK_EVENT("minimize", (std::vector<void*>{PWINDOW, (void*)E->minimize}));
wlr_xwayland_surface_set_minimized(PWINDOW->m_uSurface.xwayland, E->minimize && g_pCompositor->m_pLastWindow != PWINDOW); // fucking DXVK
} else {
const auto E = (wlr_foreign_toplevel_handle_v1_minimized_event*)data;
- g_pEventManager->postEvent({"minimize", getFormat("%lx,%i", PWINDOW, E ? (int)E->minimized : 1)});
+ g_pEventManager->postEvent({"minimize", getFormat("{:x},{}", (uintptr_t)PWINDOW, E ? (int)E->minimized : 1)});
EMIT_HOOK_EVENT("minimize", (std::vector<void*>{PWINDOW, (void*)(E ? (uint64_t)E->minimized : 1)}));
}
}
diff --git a/src/helpers/AnimatedVariable.cpp b/src/helpers/AnimatedVariable.cpp
index 450826f9..8c5c889f 100644
--- a/src/helpers/AnimatedVariable.cpp
+++ b/src/helpers/AnimatedVariable.cpp
@@ -41,8 +41,8 @@ void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, SAnimationPro
default: ASSERT(false); break;
}
} catch (std::exception& e) {
- Debug::log(ERR, "CAnimatedVariable create error: %s", e.what());
- RASSERT(false, "CAnimatedVariable create error: %s", e.what());
+ Debug::log(ERR, "CAnimatedVariable create error: {}", e.what());
+ RASSERT(false, "CAnimatedVariable create error: {}", e.what());
}
}
diff --git a/src/helpers/BezierCurve.cpp b/src/helpers/BezierCurve.cpp
index 08190117..9c8fc514 100644
--- a/src/helpers/BezierCurve.cpp
+++ b/src/helpers/BezierCurve.cpp
@@ -18,7 +18,7 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
m_dPoints.emplace_back(Vector2D(1, 1));
- RASSERT(m_dPoints.size() == 4, "CBezierCurve only supports cubic beziers! (points num: %i)", m_dPoints.size());
+ RASSERT(m_dPoints.size() == 4, "CBezierCurve only supports cubic beziers! (points num: {})", m_dPoints.size());
// bake BAKEDPOINTS points for faster lookups
// T -> X ( / BAKEDPOINTS )
@@ -34,8 +34,8 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
getYForPoint(i);
const auto ELAPSEDCALCAVG = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGINCALC).count() / 1000.f / 10.f;
- Debug::log(LOG, "Created a bezier curve, baked %i points, mem usage: %.2fkB, time to bake: %.2fµs. Estimated average calc time: %.2fµs.", BAKEDPOINTS, POINTSSIZE, ELAPSEDUS,
- ELAPSEDCALCAVG);
+ Debug::log(LOG, "Created a bezier curve, baked {} points, mem usage: {:.2f}kB, time to bake: {:.2f}µs. Estimated average calc time: {:.2f}µs.", BAKEDPOINTS, POINTSSIZE,
+ ELAPSEDUS, ELAPSEDCALCAVG);
}
float CBezierCurve::getYForT(float t) {
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 7bf254ea..d07ad833 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -151,27 +151,13 @@ void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, const
wl_signal_add(pSignal, pListener);
- Debug::log(LOG, "Registered signal for owner %lx: %lx -> %lx (owner: %s)", pOwner, pSignal, pListener, ownerString.c_str());
+ Debug::log(LOG, "Registered signal for owner {:x}: {:x} -> {:x} (owner: {})", (uintptr_t)pOwner, (uintptr_t)pSignal, (uintptr_t)pListener, ownerString);
}
void handleNoop(struct wl_listener* listener, void* data) {
// Do nothing
}
-std::string getFormat(const char* fmt, ...) {
- char* outputStr = nullptr;
-
- va_list args;
- va_start(args, fmt);
- vasprintf(&outputStr, fmt, args);
- va_end(args);
-
- std::string output = std::string(outputStr);
- free(outputStr);
-
- return output;
-}
-
std::string escapeJSONStrings(const std::string& str) {
std::ostringstream oss;
for (auto& c : str) {
@@ -224,7 +210,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
try {
return relative + stof(source);
} catch (...) {
- Debug::log(ERR, "Invalid arg \"%s\" in getPlusMinusKeywordResult!", source.c_str());
+ Debug::log(ERR, "Invalid arg \"{}\" in getPlusMinusKeywordResult!", source.c_str());
return INT_MAX;
}
}
@@ -539,10 +525,10 @@ void logSystemInfo() {
uname(&unameInfo);
- Debug::log(LOG, "System name: %s", unameInfo.sysname);
- Debug::log(LOG, "Node name: %s", unameInfo.nodename);
- Debug::log(LOG, "Release: %s", unameInfo.release);
- Debug::log(LOG, "Version: %s", unameInfo.version);
+ Debug::log(LOG, "System name: {}", unameInfo.sysname);
+ Debug::log(LOG, "Node name: {}", unameInfo.nodename);
+ Debug::log(LOG, "Release: {}", unameInfo.release);
+ Debug::log(LOG, "Version: {}", unameInfo.version);
Debug::log(NONE, "\n");
@@ -551,7 +537,7 @@ void logSystemInfo() {
#else
const std::string GPUINFO = execAndGet("lspci -vnn | grep VGA");
#endif
- Debug::log(LOG, "GPU information:\n%s\n", GPUINFO.c_str());
+ Debug::log(LOG, "GPU information:\n{}\n", GPUINFO.c_str());
if (GPUINFO.contains("NVIDIA")) {
Debug::log(WARN, "Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.\n");
@@ -560,7 +546,7 @@ void logSystemInfo() {
// log etc
Debug::log(LOG, "os-release:");
- Debug::log(NONE, "%s", execAndGet("cat /etc/os-release").c_str());
+ Debug::log(NONE, "{}", execAndGet("cat /etc/os-release").c_str());
}
void matrixProjection(float mat[9], int w, int h, wl_output_transform tr) {
@@ -646,7 +632,7 @@ int64_t configStringToInt(const std::string& VALUE) {
const auto VALUEWITHOUTFUNC = VALUE.substr(5, VALUE.length() - 6);
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 8) {
- Debug::log(WARN, "invalid length %i for rgba", VALUEWITHOUTFUNC.length());
+ Debug::log(WARN, "invalid length {} for rgba", VALUEWITHOUTFUNC.length());
throw std::invalid_argument("rgba() expects length of 8 characters (4 bytes)");
}
@@ -658,7 +644,7 @@ int64_t configStringToInt(const std::string& VALUE) {
const auto VALUEWITHOUTFUNC = VALUE.substr(4, VALUE.length() - 5);
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 6) {
- Debug::log(WARN, "invalid length %i for rgb", VALUEWITHOUTFUNC.length());
+ Debug::log(WARN, "invalid length {} for rgb", VALUEWITHOUTFUNC.length());
throw std::invalid_argument("rgb() expects length of 6 characters (3 bytes)");
}
@@ -716,6 +702,10 @@ std::vector<SCallstackFrameInfo> getBacktrace() {
}
void throwError(const std::string& err) {
- Debug::log(CRIT, "Critical error thrown: %s", err.c_str());
+ Debug::log(CRIT, "Critical error thrown: {}", err.c_str());
throw std::runtime_error(err);
}
+
+std::string sendToLog(uint8_t level, const std::string& s) {
+ Debug::log((LogLevel)level, s);
+}
diff --git a/src/helpers/MiscFunctions.hpp b/src/helpers/MiscFunctions.hpp
index 88598390..592964c9 100644
--- a/src/helpers/MiscFunctions.hpp
+++ b/src/helpers/MiscFunctions.hpp
@@ -5,6 +5,7 @@
#include <wlr/util/box.h>
#include "Vector2D.hpp"
#include <vector>
+#include <format>
struct SCallstackFrameInfo {
void* adr = nullptr;
@@ -13,7 +14,6 @@ struct SCallstackFrameInfo {
std::string absolutePath(const std::string&, const std::string&);
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, const std::string& ownerString);
-std::string getFormat(const char* fmt, ...); // Basically Debug::log to a string
std::string escapeJSONStrings(const std::string& str);
void scaleBox(wlr_box*, float);
std::string removeBeginEndSpacesTabs(std::string);
@@ -30,4 +30,28 @@ void matrixProjection(float mat[9], int w, int h, wl
double normalizeAngleRad(double ang);
std::string replaceInString(std::string subject, const std::string& search, const std::string& replace);
std::vector<SCallstackFrameInfo> getBacktrace();
-void throwError(const std::string& err); \ No newline at end of file
+void throwError(const std::string& err);
+
+// why, C++.
+std::string sendToLog(uint8_t, const std::string&);
+template <typename... Args>
+std::string getFormat(const std::string& fmt, Args&&... args) {
+ std::string fmtdMsg;
+
+ try {
+ fmtdMsg += std::vformat(fmt, std::make_format_args(args...));
+ } catch (std::exception& e) {
+ std::string exceptionMsg = e.what();
+ sendToLog(2, std::format("caught exception in getFormat: {}", exceptionMsg));
+
+ const auto CALLSTACK = getBacktrace();
+
+ sendToLog(0, "stacktrace:");
+
+ for (size_t i = 0; i < CALLSTACK.size(); ++i) {
+ sendToLog(1, std::format("\t #{} | {}", i, CALLSTACK[i].desc));
+ }
+ }
+
+ return fmtdMsg;
+} \ No newline at end of file
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index 844b34bb..1cfda2b4 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -79,12 +79,12 @@ void CMonitor::onConnect(bool noRule) {
if (PREFSTATE)
wlr_output_set_mode(output, PREFSTATE);
else
- Debug::log(WARN, "No mode found for disabled output %s", output->name);
+ Debug::log(WARN, "No mode found for disabled output {}", output->name);
wlr_output_enable(output, 0);
if (!wlr_output_commit(output))
- Debug::log(ERR, "Couldn't commit disabled state on output %s", output->name);
+ Debug::log(ERR, "Couldn't commit disabled state on output {}", output->name);
Events::listener_change(nullptr, nullptr);
@@ -136,8 +136,8 @@ void CMonitor::onConnect(bool noRule) {
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, scale);
- Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %lx", output->name, (int)vecPosition.x, (int)vecPosition.y, (int)vecPixelSize.x,
- (int)vecPixelSize.y, output);
+ Debug::log(LOG, "Added new monitor with name {} at {},{} with size {}x{}, pointer {:x}", output->name, (int)vecPosition.x, (int)vecPosition.y, (int)vecPixelSize.x,
+ (int)vecPixelSize.y, (uintptr_t)output);
setupDefaultWS(monitorRule);
@@ -197,7 +197,7 @@ void CMonitor::onDisconnect() {
if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown)
return;
- Debug::log(LOG, "onDisconnect called for %s", output->name);
+ Debug::log(LOG, "onDisconnect called for {}", output->name);
// Cleanup everything. Move windows back, snap cursor, shit.
CMonitor* BACKUPMON = nullptr;
@@ -239,7 +239,7 @@ void CMonitor::onDisconnect() {
m_aLayerSurfaceLayers[i].clear();
}
- Debug::log(LOG, "Removed monitor %s!", szName.c_str());
+ Debug::log(LOG, "Removed monitor {}!", szName.c_str());
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
EMIT_HOOK_EVENT("monitorRemoved", this);
@@ -356,12 +356,12 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1;
newDefaultWorkspaceName = std::to_string(WORKSPACEID);
- Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"%s\" is invalid.", g_pConfigManager->getDefaultWorkspaceFor(szName).c_str());
+ Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"{}\" is invalid.", g_pConfigManager->getDefaultWorkspaceFor(szName).c_str());
}
auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID);
- Debug::log(LOG, "New monitor: WORKSPACEID %d, exists: %d", WORKSPACEID, (int)(PNEWWORKSPACE != nullptr));
+ Debug::log(LOG, "New monitor: WORKSPACEID {}, exists: {}", WORKSPACEID, (int)(PNEWWORKSPACE != nullptr));
if (PNEWWORKSPACE) {
// workspace exists, move it to the newly connected monitor
@@ -500,7 +500,7 @@ void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal) {
if (pWorkspace->m_bIsSpecialWorkspace) {
if (specialWorkspaceID != pWorkspace->m_iID) {
- Debug::log(LOG, "changeworkspace on special, togglespecialworkspace to id %i", pWorkspace->m_iID);
+ Debug::log(LOG, "changeworkspace on special, togglespecialworkspace to id {}", pWorkspace->m_iID);
g_pKeybindManager->m_mDispatchers["togglespecialworkspace"](pWorkspace->m_szName == "special" ? "" : pWorkspace->m_szName);
}
return;
diff --git a/src/helpers/SubsurfaceTree.cpp b/src/helpers/SubsurfaceTree.cpp
index 7058d32e..9c03fa2a 100644
--- a/src/helpers/SubsurfaceTree.cpp
+++ b/src/helpers/SubsurfaceTree.cpp
@@ -55,7 +55,7 @@ SSurfaceTreeNode* createSubsurfaceNode(SSurfaceTreeNode* pParent, SSubsurface* p
PNODE->pParent = pParent;
PNODE->pSubsurface = pSubsurface;
- Debug::log(LOG, "Creating a subsurface Node! (pWindow: %lx)", pWindow);
+ Debug::log(LOG, "Creating a subsurface Node! (pWindow: {:x})", (uintptr_t)pWindow);
return PNODE;
}
@@ -63,7 +63,7 @@ SSurfaceTreeNode* createSubsurfaceNode(SSurfaceTreeNode* pParent, SSubsurface* p
SSurfaceTreeNode* SubsurfaceTree::createTreeRoot(wlr_surface* pSurface, applyGlobalOffsetFn fn, void* data, CWindow* pWindow) {
const auto PNODE = createTree(pSurface, pWindow);
- Debug::log(LOG, "Creating a surfaceTree Root! (pWindow: %lx)", pWindow);
+ Debug::log(LOG, "Creating a surfaceTree Root! (pWindow: {:x})", (uintptr_t)pWindow);
PNODE->offsetfn = fn;
PNODE->globalOffsetData = data;
@@ -83,7 +83,7 @@ void SubsurfaceTree::destroySurfaceTree(SSurfaceTreeNode* pNode) {
}
if (!exists) {
- Debug::log(ERR, "Tried to remove a SurfaceTreeNode that doesn't exist?? (Node %lx)", pNode);
+ Debug::log(ERR, "Tried to remove a SurfaceTreeNode that doesn't exist?? (Node {:x})", (uintptr_t)pNode);
return;
}
@@ -145,7 +145,7 @@ void Events::listener_newSubsurfaceNode(void* owner, void* data) {
const auto PNEWSUBSURFACE = &pNode->childSubsurfaces.emplace_back();
- Debug::log(LOG, "Added a new subsurface %lx", PSUBSURFACE);
+ Debug::log(LOG, "Added a new subsurface {:x}", (uintptr_t)PSUBSURFACE);
PNEWSUBSURFACE->pSubsurface = PSUBSURFACE;
PNEWSUBSURFACE->pParent = pNode;
@@ -174,7 +174,7 @@ void Events::listener_mapSubsurface(void* owner, void* data) {
if (subsurface->pChild)
return;
- Debug::log(LOG, "Subsurface %lx mapped", subsurface->pSubsurface);
+ Debug::log(LOG, "Subsurface {:x} mapped", (uintptr_t)subsurface->pSubsurface);
subsurface->pChild = createSubsurfaceNode(subsurface->pParent, subsurface, subsurface->pSubsurface->surface, subsurface->pWindowOwner);
}
@@ -182,7 +182,7 @@ void Events::listener_mapSubsurface(void* owner, void* data) {
void Events::listener_unmapSubsurface(void* owner, void* data) {
SSubsurface* subsurface = (SSubsurface*)owner;
- Debug::log(LOG, "Subsurface %lx unmapped", subsurface);
+ Debug::log(LOG, "Subsurface {:x} unmapped", (uintptr_t)subsurface);
if (subsurface->pSubsurface->surface == g_pCompositor->m_pLastFocus)
g_pInputManager->releaseAllMouseButtons();
@@ -221,7 +221,7 @@ void Events::listener_commitSubsurface(void* owner, void* data) {
if (!g_pHyprRenderer->shouldRenderWindow(pNode->pWindowOwner)) {
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE)
- Debug::log(LOG, "Refusing to commit damage from %lx because it's invisible.", pNode->pWindowOwner);
+ Debug::log(LOG, "Refusing to commit damage from {:x} because it's invisible.", (uintptr_t)pNode->pWindowOwner);
return;
}
@@ -254,7 +254,7 @@ void Events::listener_destroySubsurface(void* owner, void* data) {
SubsurfaceTree::destroySurfaceTree(subsurface->pChild);
}
- Debug::log(LOG, "Subsurface %lx destroyed", subsurface);
+ Debug::log(LOG, "Subsurface {:x} destroyed", (uintptr_t)subsurface);
subsurface->hyprListener_destroy.removeCallback();
subsurface->hyprListener_map.removeCallback();
@@ -266,7 +266,7 @@ void Events::listener_destroySubsurface(void* owner, void* data) {
void Events::listener_destroySubsurfaceNode(void* owner, void* data) {
SSurfaceTreeNode* pNode = (SSurfaceTreeNode*)owner;
- Debug::log(LOG, "Subsurface Node %lx destroyed", pNode);
+ Debug::log(LOG, "Subsurface Node {:x} destroyed", (uintptr_t)pNode);
for (auto& c : pNode->childSubsurfaces)
destroySubsurface(&c);
diff --git a/src/helpers/WLListener.cpp b/src/helpers/WLListener.cpp
index e104b780..7739defe 100644
--- a/src/helpers/WLListener.cpp
+++ b/src/helpers/WLListener.cpp
@@ -25,7 +25,7 @@ CHyprWLListener::~CHyprWLListener() {
void CHyprWLListener::removeCallback() {
if (isConnected()) {
- Debug::log(LOG, "Callback %lx -> %lx, %s removed.", &m_pCallback, &m_pOwner, m_szAuthor.c_str());
+ Debug::log(LOG, "Callback {:x} -> {:x}, {} removed.", (uintptr_t)&m_pCallback, (uintptr_t)&m_pOwner, m_szAuthor.c_str());
wl_list_remove(&m_swWrapper.m_sListener.link);
wl_list_init(&m_swWrapper.m_sListener.link);
}
diff --git a/src/helpers/WLSurface.cpp b/src/helpers/WLSurface.cpp
index d069818f..8057925b 100644
--- a/src/helpers/WLSurface.cpp
+++ b/src/helpers/WLSurface.cpp
@@ -39,7 +39,7 @@ void CWLSurface::destroy() {
m_pWLRSurface = nullptr;
- Debug::log(LOG, "CWLSurface %lx called destroy()", this);
+ Debug::log(LOG, "CWLSurface {:x} called destroy()", (uintptr_t)this);
}
void CWLSurface::init() {
@@ -53,5 +53,5 @@ void CWLSurface::init() {
hyprListener_destroy.initCallback(
&m_pWLRSurface->events.destroy, [&](void* owner, void* data) { destroy(); }, this, "CWLSurface");
- Debug::log(LOG, "CWLSurface %lx called init()", this);
+ Debug::log(LOG, "CWLSurface {:x} called init()", (uintptr_t)this);
} \ No newline at end of file
diff --git a/src/helpers/Workspace.cpp b/src/helpers/Workspace.cpp
index eed42925..eebf001d 100644
--- a/src/helpers/Workspace.cpp
+++ b/src/helpers/Workspace.cpp
@@ -31,7 +31,7 @@ CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
CWorkspace::~CWorkspace() {
m_vRenderOffset.unregister();
- Debug::log(LOG, "Destroying workspace ID %d", m_iID);
+ Debug::log(LOG, "Destroying workspace ID {}", m_iID);
g_pEventManager->postEvent({"destroyworkspace", m_szName});
EMIT_HOOK_EVENT("destroyWorkspace", this);
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index 92b81687..4511b9ca 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -104,7 +104,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
}
if (!PMONITOR) {
- Debug::log(ERR, "Orphaned Node %lx (workspace ID: %i)!!", pNode, pNode->workspaceID);
+ Debug::log(ERR, "Orphaned Node {:x} (workspace ID: {})!!", (uintptr_t)pNode, pNode->workspaceID);
return;
}
@@ -129,7 +129,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
if (!g_pCompositor->windowExists(PWINDOW) || !PWINDOW->m_bIsMapped) {
- Debug::log(ERR, "Node %lx holding invalid window %lx!!", pNode, PWINDOW);
+ Debug::log(ERR, "Node {:x} holding invalid window {:x}!!", (uintptr_t)pNode, (uintptr_t)PWINDOW);
onWindowRemovedTiling(PWINDOW);
return;
}
@@ -270,7 +270,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
} else
OPENINGON = getFirstNodeOnWorkspace(pWindow->m_iWorkspaceID);
- Debug::log(LOG, "OPENINGON: %lx, Workspace: %i, Monitor: %i", OPENINGON, PNODE->workspaceID, PMONITOR->ID);
+ Debug::log(LOG, "OPENINGON: {:x}, Workspace: {}, Monitor: {}", (uintptr_t)OPENINGON, PNODE->workspaceID, PMONITOR->ID);
if (OPENINGON && OPENINGON->workspaceID != PNODE->workspaceID) {
// special workspace handling
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 80b2d0d4..b4c15ef1 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -89,7 +89,7 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue;
if (!PMONITOR) {
- Debug::log(ERR, "Window %lx (%s) has an invalid monitor in onWindowCreatedFloating!!!", pWindow, pWindow->m_szTitle.c_str());
+ Debug::log(ERR, "Window {:x} ({}) has an invalid monitor in onWindowCreatedFloating!!!", (uintptr_t)pWindow, pWindow->m_szTitle.c_str());
return;
}
@@ -402,7 +402,7 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
const auto TILED = isWindowTiled(pWindow);
// event
- g_pEventManager->postEvent(SHyprIPCEvent{"changefloatingmode", getFormat("%lx,%d", pWindow, (int)TILED)});
+ g_pEventManager->postEvent(SHyprIPCEvent{"changefloatingmode", getFormat("{:x},{}", (uintptr_t)pWindow, (int)TILED)});
EMIT_HOOK_EVENT("changeFloatingMode", pWindow);
if (!TILED) {
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
index f82ac206..055f4e3f 100644
--- a/src/layout/MasterLayout.cpp
+++ b/src/layout/MasterLayout.cpp
@@ -484,7 +484,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
}
if (!PMONITOR) {
- Debug::log(ERR, "Orphaned Node %lx (workspace ID: %i)!!", pNode, pNode->workspaceID);
+ Debug::log(ERR, "Orphaned Node {:x} (workspace ID: {})!!", (uintptr_t)pNode, pNode->workspaceID);
return;
}
@@ -509,7 +509,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
if (!g_pCompositor->windowValidMapped(PWINDOW)) {
- Debug::log(ERR, "Node %lx holding invalid window %lx!!", pNode, PWINDOW);
+ Debug::log(ERR, "Node {:x} holding invalid window {:x}!!", (uintptr_t)pNode, (uintptr_t)PWINDOW);
return;
}
diff --git a/src/macros.hpp b/src/macros.hpp
index da80fc2f..53f77fdf 100644
--- a/src/macros.hpp
+++ b/src/macros.hpp
@@ -53,18 +53,14 @@
#define HYPRATOM(name) \
{ name, 0 }
-#ifndef __INTELLISENSE__
#define RASSERT(expr, reason, ...) \
if (!(expr)) { \
- Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", \
- getFormat(reason, ##__VA_ARGS__).c_str(), __LINE__, \
- ([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \
+ Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \
+ getFormat(reason, ##__VA_ARGS__), __LINE__, \
+ ([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })()); \
printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
raise(SIGABRT); \
}
-#else
-#define RASSERT(expr, reason, ...)
-#endif
#define ASSERT(expr) RASSERT(expr, "?")
diff --git a/src/main.cpp b/src/main.cpp
index 35080439..204e330d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -62,7 +62,7 @@ int main(int argc, char** argv) {
}
configPath = next_arg;
- Debug::log(LOG, "User-specified config location: '%s'", configPath.c_str());
+ Debug::log(LOG, "User-specified config location: '{}'", configPath.c_str());
it++;
diff --git a/src/managers/EventManager.cpp b/src/managers/EventManager.cpp
index 054c8d38..2e723c44 100644
--- a/src/managers/EventManager.cpp
+++ b/src/managers/EventManager.cpp
@@ -42,7 +42,7 @@ int fdHandleWrite(int fd, uint32_t mask, void* data) {
int availableBytes;
if (ioctl(fd, FIONREAD, &availableBytes) == -1) {
- Debug::log(ERR, "fd %d sent invalid data (1)", fd);
+ Debug::log(ERR, "fd {} sent invalid data (1)", fd);
removeFD(fd);
return 0;
}
@@ -50,7 +50,7 @@ int fdHandleWrite(int fd, uint32_t mask, void* data) {
char buf[availableBytes];
const auto RECEIVED = recv(fd, buf, availableBytes, 0);
if (RECEIVED == -1) {
- Debug::log(ERR, "fd %d sent invalid data (2)", fd);
+ Debug::log(ERR, "fd {} sent invalid data (2)", fd);
removeFD(fd);
return 0;
}
@@ -79,7 +79,7 @@ void CEventManager::startThread() {
sockaddr_in clientAddress;
socklen_t clientSize = sizeof(clientAddress);
- Debug::log(LOG, "Hypr socket 2 started at %s", socketPath.c_str());
+ Debug::log(LOG, "Hypr socket 2 started at {}", socketPath.c_str());
while (1) {
const auto ACCEPTEDCONNECTION = accept4(SOCKET, (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC);
@@ -90,7 +90,7 @@ void CEventManager::startThread() {
int flagsNew = fcntl(ACCEPTEDCONNECTION, F_GETFL, 0);
fcntl(ACCEPTEDCONNECTION, F_SETFL, flagsNew | O_NONBLOCK);
- Debug::log(LOG, "Socket 2 accepted a new client at FD %d", ACCEPTEDCONNECTION);
+ Debug::log(LOG, "Socket 2 accepted a new client at FD {}", ACCEPTEDCONNECTION);
// add to event loop so we can close it when we need to
m_dAcceptedSocketFDs.push_back(
@@ -124,7 +124,7 @@ void CEventManager::flushEvents() {
void CEventManager::postEvent(const SHyprIPCEvent event) {
if (g_pCompositor->m_bIsShuttingDown) {
- Debug::log(WARN, "Suppressed (ignoreevents true / shutting down) event of type %s, content: %s", event.event.c_str(), event.data.c_str());
+ Debug::log(WARN, "Suppressed (ignoreevents true / shutting down) event of type {}, content: {}", event.event.c_str(), event.data.c_str());
return;
}
diff --git a/src/managers/HookSystemManager.cpp b/src/managers/HookSystemManager.cpp
index c5e4cdd8..4b6d9461 100644
--- a/src/managers/HookSystemManager.cpp
+++ b/src/managers/HookSystemManager.cpp
@@ -57,7 +57,7 @@ void CHookSystemManager::emit(const std::vector<SCallbackFNPtr>* callbacks, std:
} catch (std::exception& e) {
// TODO: this works only once...?
faultyHandles.push_back(cb.handle);
- Debug::log(ERR, " [hookSystem] Hook from plugin %lx caused a SIGSEGV, queueing for unloading.", cb.handle);
+ Debug::log(ERR, " [hookSystem] Hook from plugin {:x} caused a SIGSEGV, queueing for unloading.", (uintptr_t)cb.handle);
}
}
@@ -73,7 +73,7 @@ std::vector<SCallbackFNPtr>* CHookSystemManager::getVecForEvent(const std::strin
if (IT != m_lpRegisteredHooks.end())
return &IT->second;
- Debug::log(LOG, " [hookSystem] New hook event registered: %s", event.c_str());
+ Debug::log(LOG, " [hookSystem] New hook event registered: {}", event.c_str());
return &m_lpRegisteredHooks.emplace_back(std::make_pair<>(event, std::vector<SCallbackFNPtr>{})).second;
} \ No newline at end of file
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 0fb9d838..d9371718 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -153,7 +153,7 @@ void CKeybindManager::updateXKBTranslationState() {
", layout: " + LAYOUT + " )",
CColor(1.0, 50.0 / 255.0, 50.0 / 255.0, 1.0));
- Debug::log(ERR, "[XKBTranslationState] Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant,
+ Debug::log(ERR, "[XKBTranslationState] Keyboard layout {} with variant {} (rules: {}, model: {}, options: {}) couldn't have been loaded.", rules.layout, rules.variant,
rules.rules, rules.model, rules.options);
memset(&rules, 0, sizeof(rules));
@@ -428,10 +428,10 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string&
// Should never happen, as we check in the ConfigManager, but oh well
if (DISPATCHER == m_mDispatchers.end()) {
- Debug::log(ERR, "Invalid handler in a keybind! (handler %s does not exist)", k.handler.c_str());
+ Debug::log(ERR, "Invalid handler in a keybind! (handler {} does not exist)", k.handler.c_str());
} else {
// call the dispatcher
- Debug::log(LOG, "Keybind triggered, calling dispatcher (%d, %s, %d)", modmask, key.c_str(), keysym);
+ Debug::log(LOG, "Keybind triggered, calling dispatcher ({}, {}, {})", modmask, key.c_str(), keysym);
m_iPassPressed = (int)pressed;
@@ -533,7 +533,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
if (ttynum == TTY)
return true;
- Debug::log(LOG, "Switching from VT %i to VT %i", ttynum, TTY);
+ Debug::log(LOG, "Switching from VT {} to VT {}", ttynum, TTY);
if (!wlr_session_change_vt(g_pCompositor->m_sWLRSession, TTY))
return true; // probably same session
@@ -545,7 +545,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
m->framesToSkip = 1;
}
- Debug::log(LOG, "Switched to VT %i, destroyed all render data, frames to skip for each: 2", TTY);
+ Debug::log(LOG, "Switched to VT {}, destroyed all render data, frames to skip for each: 2", TTY);
return true;
}
@@ -598,12 +598,12 @@ void CKeybindManager::spawn(std::string args) {
g_pConfigManager->addExecRule({r, (unsigned long)PROC});
}
- Debug::log(LOG, "Applied %i rule arguments for exec.", RULESLIST.size());
+ Debug::log(LOG, "Applied {} rule arguments for exec.", RULESLIST.size());
}
}
uint64_t CKeybindManager::spawnRaw(std::string args) {
- Debug::log(LOG, "Executing %s", args.c_str());
+ Debug::log(LOG, "Executing {}", args.c_str());
int socket[2];
if (pipe(socket) != 0) {
@@ -651,7 +651,7 @@ uint64_t CKeybindManager::spawnRaw(std::string args) {
return 0;
}
- Debug::log(LOG, "Process Created with pid %d", grandchild);
+ Debug::log(LOG, "Process Created with pid {}", grandchild);
return grandchild;
}
@@ -976,7 +976,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
char arg = args[0];
if (!isDirection(args)) {
- Debug::log(ERR, "Cannot move focus in direction %c, unsupported direction. Supported: l,r,u/t,d/b", arg);
+ Debug::log(ERR, "Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
return;
}
@@ -1028,7 +1028,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
return;
}
- Debug::log(LOG, "No window found in direction %c, looking for a monitor", arg);
+ Debug::log(LOG, "No window found in direction {}, looking for a monitor", arg);
if (tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg)))
return;
@@ -1037,7 +1037,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
if (*PNOFALLBACK)
return;
- Debug::log(LOG, "No monitor found in direction %c, falling back to next window on current workspace", arg);
+ Debug::log(LOG, "No monitor found in direction {}, falling back to next window on current workspace", arg);
const auto PWINDOWNEXT = g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true);
if (PWINDOWNEXT)
@@ -1119,11 +1119,11 @@ void CKeybindManager::swapActive(std::string args) {
char arg = args[0];
if (!isDirection(args)) {
- Debug::log(ERR, "Cannot move window in direction %c, unsupported direction. Supported: l,r,u/t,d/b", arg);
+ Debug::log(ERR, "Cannot move window in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
return;
}
- Debug::log(LOG, "Swapping active window in direction %c", arg);
+ Debug::log(LOG, "Swapping active window in direction {}", arg);
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
return;
@@ -1149,7 +1149,7 @@ void CKeybindManager::moveActiveTo(std::string args) {
}
if (!isDirection(args)) {
- Debug::log(ERR, "Cannot move window in direction %c, unsupported direction. Supported: l,r,u/t,d/b", arg);
+ Debug::log(ERR, "Cannot move window in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
return;
}
@@ -1415,7 +1415,7 @@ void CKeybindManager::workspaceOpt(std::string args) {
}
}
} else {
- Debug::log(ERR, "Invalid arg in workspaceOpt, opt \"%s\" doesn't exist.", args.c_str());
+ Debug::log(ERR, "Invalid arg in workspaceOpt, opt \"{}\" doesn't exist.", args.c_str());
return;
}
@@ -1434,7 +1434,7 @@ void CKeybindManager::renameWorkspace(std::string args) {
g_pCompositor->renameWorkspace(std::stoi(args), "");
}
} catch (std::exception& e) {
- Debug::log(ERR, "Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. \"%s\": \"%s\"", args.c_str(), e.what());
+ Debug::log(ERR, "Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. \"{}\": \"{}\"", args.c_str(), e.what());
}
}
@@ -1514,10 +1514,10 @@ void CKeybindManager::toggleSpecialWorkspace(std::string args) {
if (requestedWorkspaceIsAlreadyOpen && specialOpenOnMonitor == workspaceID) {
// already open on this monitor
- Debug::log(LOG, "Toggling special workspace %d to closed", workspaceID);
+ Debug::log(LOG, "Toggling special workspace {} to closed", workspaceID);
PMONITOR->setSpecialWorkspace(nullptr);
} else {
- Debug::log(LOG, "Toggling special workspace %d to open", workspaceID);
+ Debug::log(LOG, "Toggling special workspace {} to open", workspaceID);
auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceID);
if (!PSPECIALWORKSPACE)
@@ -1661,7 +1661,7 @@ void CKeybindManager::focusWindow(std::string regexp) {
if (!PWINDOW)
return;
- Debug::log(LOG, "Focusing to window name: %s", PWINDOW->m_szTitle.c_str());
+ Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_szTitle.c_str());
if (g_pCompositor->m_pLastMonitor->activeWorkspace != PWINDOW->m_iWorkspaceID) {
Debug::log(LOG, "Fake executing workspace to move focus");
@@ -1692,14 +1692,14 @@ void CKeybindManager::setSubmap(std::string submap) {
for (auto& k : g_pKeybindManager->m_lKeybinds) {
if (k.submap == submap) {
m_szCurrentSelectedSubmap = submap;
- Debug::log(LOG, "Changed keybind submap to %s", submap.c_str());
+ Debug::log(LOG, "Changed keybind submap to {}", submap.c_str());
g_pEventManager->postEvent(SHyprIPCEvent{"submap", submap});
EMIT_HOOK_EVENT("submap", m_szCurrentSelectedSubmap);
return;
}
}
- Debug::log(ERR, "Cannot set submap %s, submap doesn't exist (wasn't registered!)", submap.c_str());
+ Debug::log(ERR, "Cannot set submap {}, submap doesn't exist (wasn't registered!)", submap.c_str());
}
void CKeybindManager::pass(std::string regexp) {
@@ -1816,7 +1816,7 @@ void CKeybindManager::dpms(std::string arg) {
m->dpmsStatus = enable;
if (!wlr_output_commit(m->output)) {
- Debug::log(ERR, "Couldn't commit output %s", m->szName.c_str());
+ Debug::log(ERR, "Couldn't commit output {}", m->szName.c_str());
}
if (enable)
@@ -2014,7 +2014,7 @@ void CKeybindManager::moveIntoGroup(std::string args) {
static auto* const GROUPLOCKCHECK = &g_pConfigManager->getConfigValuePtr("misc:moveintogroup_lock_check")->intValue;
if (!isDirection(args)) {
- Debug::log(ERR, "Cannot move into group in direction %c, unsupported direction. Supported: l,r,u/t,d/b", arg);
+ Debug::log(ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
return;
}
diff --git a/src/managers/LayoutManager.cpp b/src/managers/LayoutManager.cpp
index c35465dc..e3a358a2 100644
--- a/src/managers/LayoutManager.cpp
+++ b/src/managers/LayoutManager.cpp
@@ -31,7 +31,7 @@ bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) {
m_vLayouts.emplace_back(std::make_pair<>(name, layout));
- Debug::log(LOG, "Added new layout %s at %lx", name.c_str(), layout);
+ Debug::log(LOG, "Added new layout {} at {:x}", name.c_str(), (uintptr_t)layout);
return true;
}
@@ -45,7 +45,7 @@ bool CLayoutManager::removeLayout(IHyprLayout* layout) {
if (m_iCurrentLayoutID == IT - m_vLayouts.begin())
switchToLayout("dwindle");
- Debug::log(LOG, "Removed a layout %s at %lx", IT->first.c_str(), layout);
+ Debug::log(LOG, "Removed a layout {} at {:x}", IT->first.c_str(), (uintptr_t)layout);
std::erase(m_vLayouts, *IT);
diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp
index 9a27e36b..9774490b 100644
--- a/src/managers/SessionLockManager.cpp
+++ b/src/managers/SessionLockManager.cpp
@@ -4,7 +4,7 @@
static void handleSurfaceMap(void* owner, void* data) {
const auto PSURFACE = (SSessionLockSurface*)owner;
- Debug::log(LOG, "SessionLockSurface %lx mapped", PSURFACE);
+ Debug::log(LOG, "SessionLockSurface {:x} mapped", (uintptr_t)PSURFACE);
PSURFACE->mapped = true;
@@ -30,7 +30,7 @@ static void handleSurfaceCommit(void* owner, void* data) {
static void handleSurfaceDestroy(void* owner, void* data) {
const auto PSURFACE = (SSessionLockSurface*)owner;
- Debug::log(LOG, "SessionLockSurface %lx destroyed", PSURFACE);
+ Debug::log(LOG, "SessionLockSurface {:x} destroyed", (uintptr_t)PSURFACE);
PSURFACE->hyprListener_commit.removeCallback();
PSURFACE->hyprListener_destroy.removeCallback();
@@ -52,7 +52,7 @@ void CSessionLockManager::onNewSessionLock(wlr_session_lock_v1* pWlrLock) {
return;
}
- Debug::log(LOG, "Session got locked by %lx", pWlrLock);
+ Debug::log(LOG, "Session got locked by {:x}", (uintptr_t)pWlrLock);
m_sSessionLock.pWlrLock = pWlrLock;
diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp
index 1ac4416d..ee144f31 100644
--- a/src/managers/XWaylandManager.cpp
+++ b/src/managers/XWaylandManager.cpp
@@ -21,7 +21,7 @@ CHyprXWaylandManager::CHyprXWaylandManager() {
setenv("DISPLAY", m_sWLRXWayland->display_name, 1);
- Debug::log(LOG, "CHyprXWaylandManager started on display %s", m_sWLRXWayland->display_name);
+ Debug::log(LOG, "CHyprXWaylandManager started on display {}", m_sWLRXWayland->display_name);
#else
unsetenv("DISPLAY"); // unset DISPLAY so that X11 apps do not try to start on a different/invalid DISPLAY
#endif
@@ -129,7 +129,7 @@ std::string CHyprXWaylandManager::getAppIDClass(CWindow* pWindow) {
}
} else
return "";
- } catch (std::logic_error& e) { Debug::log(ERR, "Error in getAppIDClass: %s", e.what()); }
+ } catch (std::logic_error& e) { Debug::log(ERR, "Error in getAppIDClass: {}", e.what()); }
return "";
}
@@ -223,7 +223,7 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
if (winrole.contains("pop-up") || winrole.contains("task_dialog")) {
return true;
}
- } catch (std::exception& e) { Debug::log(ERR, "Error in shouldBeFloated, winrole threw %s", e.what()); }
+ } catch (std::exception& e) { Debug::log(ERR, "Error in shouldBeFloated, winrole threw {}", e.what()); }
}
if (pWindow->m_uSurface.xwayland->modal) {
diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp
index d30cf9de..809606b1 100644
--- a/src/managers/input/IdleInhibitor.cpp
+++ b/src/managers/input/IdleInhibitor.cpp
@@ -33,7 +33,7 @@ void CInputManager::newIdleInhibitor(wlr_idle_inhibitor_v1* pInhibitor) {
PINHIBIT->pWindow = g_pCompositor->getWindowFromSurface(pInhibitor->surface);
if (PINHIBIT->pWindow)
- Debug::log(LOG, "IdleInhibitor got window %lx (%s)", PINHIBIT->pWindow, PINHIBIT->pWindow->m_szTitle.c_str());
+ Debug::log(LOG, "IdleInhibitor got window {:x} ({})", (uintptr_t)PINHIBIT->pWindow, PINHIBIT->pWindow->m_szTitle.c_str());
recheckIdleInhibitorStatus();
}
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index c16c549b..c0e16487 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -689,7 +689,7 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, wlr_keyboard_from_input_device(keyboard));
- Debug::log(LOG, "New keyboard created, pointers Hypr: %lx and WLR: %lx", PNEWKEYBOARD, keyboard);
+ Debug::log(LOG, "New keyboard created, pointers Hypr: {:x} and WLR: {:x}", (uintptr_t)PNEWKEYBOARD, (uintptr_t)keyboard);
}
void CInputManager::newVirtualKeyboard(wlr_input_device* keyboard) {
@@ -728,7 +728,7 @@ void CInputManager::newVirtualKeyboard(wlr_input_device* keyboard) {
wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, wlr_keyboard_from_input_device(keyboard));
- Debug::log(LOG, "New virtual keyboard created, pointers Hypr: %lx and WLR: %lx", PNEWKEYBOARD, keyboard);
+ Debug::log(LOG, "New virtual keyboard created, pointers Hypr: {:x} and WLR: {:x}", (uintptr_t)PNEWKEYBOARD, (uintptr_t)keyboard);
}
void CInputManager::setKeyboardLayout() {
@@ -743,7 +743,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
- Debug::log(LOG, "ApplyConfigToKeyboard for \"%s\", hasconfig: %i", pKeyboard->name.c_str(), (int)HASCONFIG);
+ Debug::log(LOG, "ApplyConfigToKeyboard for \"{}\", hasconfig: {}", pKeyboard->name.c_str(), (int)HASCONFIG);
ASSERT(pKeyboard);
@@ -800,7 +800,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
return;
}
- Debug::log(LOG, "Attempting to create a keymap for layout %s with variant %s (rules: %s, model: %s, options: %s)", rules.layout, rules.variant, rules.rules, rules.model,
+ Debug::log(LOG, "Attempting to create a keymap for layout {} with variant {} (rules: {}, model: {}, options: {})", rules.layout, rules.variant, rules.rules, rules.model,
rules.options);
xkb_keymap* KEYMAP = NULL;
@@ -823,7 +823,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
g_pConfigManager->addParseError("Invalid keyboard layout passed. ( rules: " + RULES + ", model: " + MODEL + ", variant: " + VARIANT + ", options: " + OPTIONS +
", layout: " + LAYOUT + " )");
- Debug::log(ERR, "Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant, rules.rules, rules.model,
+ Debug::log(ERR, "Keyboard layout {} with variant {} (rules: {}, model: {}, options: {}) couldn't have been loaded.", rules.layout, rules.variant, rules.rules, rules.model,
rules.options);
memset(&rules, 0, sizeof(rules));
@@ -859,7 +859,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->name + "," + LAYOUTSTR});
EMIT_HOOK_EVENT("activeLayout", (std::vector<void*>{pKeyboard, (void*)&LAYOUTSTR}));
- Debug::log(LOG, "Set the keyboard layout to %s and variant to %s for keyboard \"%s\"", rules.layout, rules.variant, pKeyboard->keyboard->name);
+ Debug::log(LOG, "Set the keyboard layout to {} and variant to {} for keyboard \"{}\"", rules.layout, rules.variant, pKeyboard->keyboard->name);
}
void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
@@ -877,9 +877,9 @@ void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
if (wlr_input_device_is_libinput(mouse)) {
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(mouse);
- Debug::log(LOG, "New mouse has libinput sens %.2f (%.2f) with accel profile %i (%i)", libinput_device_config_accel_get_speed(LIBINPUTDEV),
- libinput_device_config_accel_get_default_speed(LIBINPUTDEV), libinput_device_config_accel_get_profile(LIBINPUTDEV),
- libinput_device_config_accel_get_default_profile(LIBINPUTDEV));
+ Debug::log(LOG, "New mouse has libinput sens {:.2f} ({:.2f}) with accel profile {} ({})", libinput_device_config_accel_get_speed(LIBINPUTDEV),
+ libinput_device_config_accel_get_default_speed(LIBINPUTDEV), (int)libinput_device_config_accel_get_profile(LIBINPUTDEV),
+ (int)libinput_device_config_accel_get_default_profile(LIBINPUTDEV));
}
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
@@ -894,7 +894,7 @@ void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
m_tmrLastCursorMovement.reset();
- Debug::log(LOG, "New mouse created, pointer WLR: %lx", mouse);
+ Debug::log(LOG, "New mouse created, pointer WLR: {:x}", (uintptr_t)mouse);
}
void CInputManager::setPointerConfigs() {
@@ -1030,7 +1030,7 @@ void CInputManager::setPointerConfigs() {
libinput_device_config_scroll_set_button(LIBINPUTDEV, SCROLLBUTTON == 0 ? libinput_device_config_scroll_get_default_button(LIBINPUTDEV) : SCROLLBUTTON);
- Debug::log(LOG, "Applied config to mouse %s, sens %.2f", m.name.c_str(), LIBINPUTSENS);
+ Debug::log(LOG, "Applied config to mouse {}, sens {:.2f}", m.name.c_str(), LIBINPUTSENS);
}
}
}
@@ -1223,7 +1223,7 @@ void CInputManager::constrainMouse(SMouse* pMouse, wlr_pointer_constraint_v1* co
pMouse->hyprListener_commitConstraint.initCallback(&pMouse->currentConstraint->surface->events.commit, &Events::listener_commitConstraint, pMouse, "Mouse constraint commit");
- Debug::log(LOG, "Constrained mouse to %lx", pMouse->currentConstraint);
+ Debug::log(LOG, "Constrained mouse to {:x}", (uintptr_t)pMouse->currentConstraint);
}
void CInputManager::warpMouseToConstraintMiddle(SConstraint* pConstraint) {
@@ -1373,7 +1373,7 @@ void CInputManager::newTouchDevice(wlr_input_device* pDevice) {
setTouchDeviceConfigs(PNEWDEV);
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, pDevice);
- Debug::log(LOG, "New touch device added at %lx", PNEWDEV);
+ Debug::log(LOG, "New touch device added at {:x}", (uintptr_t)PNEWDEV);
PNEWDEV->hyprListener_destroy.initCallback(
&pDevice->events.destroy, [&](void* owner, void* data) { destroyTouchDevice((STouchDevice*)data); }, PNEWDEV, "TouchDevice");
@@ -1420,7 +1420,7 @@ void CInputManager::setTabletConfigs() {
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(t.wlrDevice);
const int ROTATION = std::clamp(HASCONFIG ? g_pConfigManager->getDeviceInt(t.name, "transform") : g_pConfigManager->getInt("input:tablet:transform"), 0, 7);
- Debug::log(LOG, "Setting calibration matrix for device %s", t.name.c_str());
+ Debug::log(LOG, "Setting calibration matrix for device {}", t.name.c_str());
libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]);
const auto OUTPUT = HASCONFIG ? g_pConfigManager->getDeviceString(t.name, "output") : g_pConfigManager->getString("input:tablet:output");
@@ -1434,7 +1434,7 @@ void CInputManager::setTabletConfigs() {
}
void CInputManager::destroyTouchDevice(STouchDevice* pDevice) {
- Debug::log(LOG, "Touch device at %lx removed", pDevice);
+ Debug::log(LOG, "Touch device at {:x} removed", (uintptr_t)pDevice);
m_lTouchDevices.remove(*pDevice);
}
@@ -1443,7 +1443,7 @@ void CInputManager::newSwitch(wlr_input_device* pDevice) {
const auto PNEWDEV = &m_lSwitches.emplace_back();
PNEWDEV->pWlrDevice = pDevice;
- Debug::log(LOG, "New switch with name \"%s\" added", pDevice->name);
+ Debug::log(LOG, "New switch with name \"{}\" added", pDevice->name);
PNEWDEV->hyprListener_destroy.initCallback(
&pDevice->events.destroy, [&](void* owner, void* data) { destroySwitch((SSwitchDevice*)owner); }, PNEWDEV, "SwitchDevice");
@@ -1460,17 +1460,17 @@ void CInputManager::newSwitch(wlr_input_device* pDevice) {
if (PDEVICE->status != -1 && PDEVICE->status == E->switch_state)
return;
- Debug::log(LOG, "Switch %s fired, triggering binds.", NAME.c_str());
+ Debug::log(LOG, "Switch {} fired, triggering binds.", NAME.c_str());
g_pKeybindManager->onSwitchEvent(NAME);
switch (E->switch_state) {
case WLR_SWITCH_STATE_ON:
- Debug::log(LOG, "Switch %s turn on, triggering binds.", NAME.c_str());
+ Debug::log(LOG, "Switch {} turn on, triggering binds.", NAME.c_str());
g_pKeybindManager->onSwitchOnEvent(NAME);
break;
case WLR_SWITCH_STATE_OFF:
- Debug::log(LOG, "Switch %s turn off, triggering binds.", NAME.c_str());
+ Debug::log(LOG, "Switch {} turn off, triggering binds.", NAME.c_str());
g_pKeybindManager->onSwitchOffEvent(NAME);
break;
}
diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp
index b7a4a74b..8d04c4a8 100644
--- a/src/managers/input/Swipe.cpp
+++ b/src/managers/input/Swipe.cpp
@@ -25,7 +25,7 @@ void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) {
void CInputManager::beginWorkspaceSwipe() {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace);
- Debug::log(LOG, "Starting a swipe from %s", PWORKSPACE->m_szName.c_str());
+ Debug::log(LOG, "Starting a swipe from {}", PWORKSPACE->m_szName.c_str());
m_sActiveSwipe.pWorkspaceBegin = PWORKSPACE;
m_sActiveSwipe.delta = 0;
diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp
index 41ce2ca1..77dd737c 100644
--- a/src/managers/input/Tablets.cpp
+++ b/src/managers/input/Tablets.cpp
@@ -147,7 +147,7 @@ STabletTool* CInputManager::ensureTabletToolPresent(wlr_tablet_tool* pTool) {
if (pTool->data == nullptr) {
const auto PTOOL = &m_lTabletTools.emplace_back();
- Debug::log(LOG, "Creating tablet tool v2 for %lx", pTool);
+ Debug::log(LOG, "Creating tablet tool v2 for {:x}", (uintptr_t)pTool);
PTOOL->wlrTabletTool = pTool;
pTool->data = PTOOL;
diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp
index add2b833..54196b92 100644
--- a/src/plugins/PluginAPI.cpp
+++ b/src/plugins/PluginAPI.cpp
@@ -305,7 +305,7 @@ APICALL std::vector<SFunctionMatch> HyprlandAPI::findFunctionsByName(HANDLE hand
};
if (SYMBOLS.empty()) {
- Debug::log(ERR, "Unable to search for function \"%s\": no symbols found in binary (is \"%s\" in path?)", name.c_str(),
+ Debug::log(ERR, "Unable to search for function \"{}\": no symbols found in binary (is \"{}\" in path?)", name.c_str(),
#ifdef __clang__
"llvm-nm"
#else
diff --git a/src/plugins/PluginSystem.cpp b/src/plugins/PluginSystem.cpp
index d550f7d5..786a7880 100644
--- a/src/plugins/PluginSystem.cpp
+++ b/src/plugins/PluginSystem.cpp
@@ -22,7 +22,7 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
HANDLE MODULE = dlopen(path.c_str(), RTLD_LAZY);
if (!MODULE) {
- Debug::log(ERR, " [PluginSystem] Plugin %s could not be loaded: %s", path.c_str(), dlerror());
+ Debug::log(ERR, " [PluginSystem] Plugin {} could not be loaded: {}", path.c_str(), dlerror());
m_vLoadedPlugins.pop_back();
return nullptr;
}
@@ -33,7 +33,7 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
PPLUGIN_INIT_FUNC initFunc = (PPLUGIN_INIT_FUNC)dlsym(MODULE, PLUGIN_INIT_FUNC_STR);
if (!apiVerFunc || !initFunc) {
- Debug::log(ERR, " [PluginSystem] Plugin %s could not be loaded. (No apiver/init func)", path.c_str());
+ Debug::log(ERR, " [PluginSystem] Plugin {} could not be loaded. (No apiver/init func)", path.c_str());
dlclose(MODULE);
m_vLoadedPlugins.pop_back();
return nullptr;
@@ -42,7 +42,7 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
const std::string PLUGINAPIVER = apiVerFunc();
if (PLUGINAPIVER != HYPRLAND_API_VERSION) {
- Debug::log(ERR, " [PluginSystem] Plugin %s could not be loaded. (API version mismatch)", path.c_str());
+ Debug::log(ERR, " [PluginSystem] Plugin {} could not be loaded. (API version mismatch)", path.c_str());
dlclose(MODULE);
m_vLoadedPlugins.pop_back();
return nullptr;
@@ -60,7 +60,7 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
}
} catch (std::exception& e) {
m_bAllowConfigVars = false;
- Debug::log(ERR, " [PluginSystem] Plugin %s (Handle %lx) crashed in init. Unloading.", path.c_str(), MODULE);
+ Debug::log(ERR, " [PluginSystem] Plugin {} (Handle {:x}) crashed in init. Unloading.", path.c_str(), (uintptr_t)MODULE);
unloadPlugin(PLUGIN, true); // Plugin could've already hooked/done something
return nullptr;
}
@@ -72,8 +72,8 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
PLUGIN->version = PLUGINDATA.version;
PLUGIN->name = PLUGINDATA.name;
- Debug::log(LOG, " [PluginSystem] Plugin %s loaded. Handle: %lx, path: \"%s\", author: \"%s\", description: \"%s\", version: \"%s\"", PLUGINDATA.name.c_str(), MODULE,
- path.c_str(), PLUGINDATA.author.c_str(), PLUGINDATA.description.c_str(), PLUGINDATA.version.c_str());
+ Debug::log(LOG, " [PluginSystem] Plugin {} loaded. Handle: {:x}, path: \"{}\", author: \"{}\", description: \"{}\", version: \"{}\"", PLUGINDATA.name.c_str(),
+ (uintptr_t)MODULE, path.c_str(), PLUGINDATA.author.c_str(), PLUGINDATA.description.c_str(), PLUGINDATA.version.c_str());
return PLUGIN;
}
@@ -109,7 +109,7 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
dlclose(plugin->m_pHandle);
- Debug::log(LOG, " [PluginSystem] Plugin %s unloaded.", plugin->name.c_str());
+ Debug::log(LOG, " [PluginSystem] Plugin {} unloaded.", plugin->name.c_str());
std::erase_if(m_vLoadedPlugins, [&](const auto& other) { return other->m_pHandle == plugin->m_pHandle; });
@@ -128,7 +128,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st
// unload all plugins that are no longer present
for (auto& p : m_vLoadedPlugins | std::views::reverse) {
if (p->m_bLoadedWithConfig && std::find(plugins.begin(), plugins.end(), p->path) == plugins.end()) {
- Debug::log(LOG, "Unloading plugin %s which is no longer present in config", p->path.c_str());
+ Debug::log(LOG, "Unloading plugin {} which is no longer present in config", p->path.c_str());
unloadPlugin(p.get(), false);
changed = true;
}
@@ -137,7 +137,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st
// load all new plugins
for (auto& path : plugins) {
if (std::find_if(m_vLoadedPlugins.begin(), m_vLoadedPlugins.end(), [&](const auto& other) { return other->path == path; }) == m_vLoadedPlugins.end()) {
- Debug::log(LOG, "Loading plugin %s which is now present in config", path.c_str());
+ Debug::log(LOG, "Loading plugin {} which is now present in config", path.c_str());
const auto plugin = loadPlugin(path);
if (plugin) {
diff --git a/src/protocols/TextInputV1.cpp b/src/protocols/TextInputV1.cpp
index 5117a382..9156da12 100644
--- a/src/protocols/TextInputV1.cpp
+++ b/src/protocols/TextInputV1.cpp
@@ -140,7 +140,7 @@ static void destroyTI(wl_resource* resource) {
void CTextInputV1ProtocolManager::createTI(wl_client* client, wl_resource* resource, uint32_t id) {
const auto PTI = m_pClients.emplace_back(std::make_unique<STextInputV1>()).get();
- Debug::log(LOG, "New TI V1 at %lx", PTI);
+ Debug::log(LOG, "New TI V1 at {:x}", (uintptr_t)PTI);
PTI->client = client;
PTI->resourceCaller = resource;
diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp
index 0efe063c..f5e3c310 100644
--- a/src/protocols/ToplevelExport.cpp
+++ b/src/protocols/ToplevelExport.cpp
@@ -149,14 +149,14 @@ void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resou
PFRAME->pWindow = pWindow;
if (!PFRAME->pWindow) {
- Debug::log(ERR, "Client requested sharing of window handle %lx which does not exist!", PFRAME->pWindow);
+ Debug::log(ERR, "Client requested sharing of window handle {:x} which does not exist!", (uintptr_t)PFRAME->pWindow);
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
removeFrame(PFRAME);
return;
}
if (!PFRAME->pWindow->m_bIsMapped || PFRAME->pWindow->isHidden()) {
- Debug::log(ERR, "Client requested sharing of window handle %lx which is not shareable!", PFRAME->pWindow);
+ Debug::log(ERR, "Client requested sharing of window handle {:x} which is not shareable!", (uintptr_t)PFRAME->pWindow);
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
removeFrame(PFRAME);
return;
@@ -223,7 +223,7 @@ void CToplevelExportProtocolManager::copyFrame(wl_client* client, wl_resource* r
}
if (!PFRAME->pWindow->m_bIsMapped || PFRAME->pWindow->isHidden()) {
- Debug::log(ERR, "Client requested sharing of window handle %lx which is not shareable (2)!", PFRAME->pWindow);
+ Debug::log(ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", (uintptr_t)PFRAME->pWindow);
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
removeFrame(PFRAME);
return;
@@ -406,7 +406,7 @@ bool CToplevelExportProtocolManager::copyFrameShm(SScreencopyFrame* frame, times
// copy pixels
const auto PFORMAT = get_gles2_format_from_drm(format);
if (!PFORMAT) {
- Debug::log(ERR, "[toplevel_export] Cannot read pixels, unsupported format %lx", PFORMAT);
+ Debug::log(ERR, "[toplevel_export] Cannot read pixels, unsupported format {:x}", (uintptr_t)PFORMAT);
g_pHyprOpenGL->end();
wlr_buffer_end_data_ptr_access(frame->buffer);
if (frame->overlayCursor)
diff --git a/src/protocols/WaylandProtocol.cpp b/src/protocols/WaylandProtocol.cpp
index 6ff08227..4600126c 100644
--- a/src/protocols/WaylandProtocol.cpp
+++ b/src/protocols/WaylandProtocol.cpp
@@ -22,14 +22,14 @@ CWaylandResource::CWaylandResource(wl_client* client, const wl_interface* wlInte
m_liResourceDestroy.notify = resourceDestroyNotify;
wl_resource_add_destroy_listener(m_pWLResource, &m_liResourceDestroy);
- Debug::log(TRACE, "[wl res %lx] created", m_pWLResource);
+ Debug::log(TRACE, "[wl res {:x}] created", (uintptr_t)m_pWLResource);
}
void CWaylandResource::markDefunct() {
if (m_bDefunct)
return;
- Debug::log(TRACE, "[wl res %lx] now defunct", m_pWLResource);
+ Debug::log(TRACE, "[wl res {:x}] now defunct", (uintptr_t)m_pWLResource);
m_bDefunct = true;
wl_resource_set_user_data(m_pWLResource, nullptr);
}
@@ -40,7 +40,7 @@ CWaylandResource::~CWaylandResource() {
wl_list_remove(&m_liResourceDestroy.link);
wl_list_init(&m_liResourceDestroy.link);
- Debug::log(TRACE, "[wl res %lx] destroying (wl_resource_destroy will be %s)", m_pWLResource, (DESTROY ? "sent" : "not sent"));
+ Debug::log(TRACE, "[wl res {:x}] destroying (wl_resource_destroy will be {})", (uintptr_t)m_pWLResource, (DESTROY ? "sent" : "not sent"));
if (DESTROY)
wl_resource_destroy(m_pWLResource);
@@ -62,17 +62,17 @@ uint32_t CWaylandResource::version() {
void CWaylandResource::setImplementation(const void* impl, wl_resource_destroy_func_t df) {
RASSERT(good(), "Attempted to call setImplementation() on a bad resource");
- RASSERT(!m_bImplementationSet, "Wayland Resource %lx already has an implementation, cannot re-set!", m_pWLResource);
+ RASSERT(!m_bImplementationSet, "Wayland Resource {:x} already has an implementation, cannot re-set!", (uintptr_t)m_pWLResource);
wl_resource_set_implementation(m_pWLResource, impl, this, df);
- Debug::log(TRACE, "[wl res %lx] set impl to %lx", m_pWLResource, impl);
+ Debug::log(TRACE, "[wl res {:x}] set impl to {:x}", (uintptr_t)m_pWLResource, (uintptr_t)impl);
m_bImplementationSet = true;
}
void CWaylandResource::setData(void* data) {
- Debug::log(TRACE, "[wl res %lx] set data to %lx", m_pWLResource, data);
+ Debug::log(TRACE, "[wl res {:x}] set data to {:x}", (uintptr_t)m_pWLResource, (uintptr_t)data);
m_pData = data;
}
@@ -96,14 +96,14 @@ IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, co
m_pGlobal = wl_global_create(g_pCompositor->m_sWLDisplay, iface, ver, this, &bindManagerInternal);
if (!m_pGlobal) {
- Debug::log(ERR, "[proto %s] could not create a global", name.c_str());
+ Debug::log(ERR, "[proto {}] could not create a global", name);
return;
}
m_liDisplayDestroy.notify = displayDestroyInternal;
wl_display_add_destroy_listener(g_pCompositor->m_sWLDisplay, &m_liDisplayDestroy);
- Debug::log(LOG, "[proto %s] started", name.c_str());
+ Debug::log(LOG, "[proto {}] started", name);
}
IWaylandProtocol::~IWaylandProtocol() {
diff --git a/src/render/Framebuffer.cpp b/src/render/Framebuffer.cpp
index e5fc897d..a62ea18a 100644
--- a/src/render/Framebuffer.cpp
+++ b/src/render/Framebuffer.cpp
@@ -3,7 +3,7 @@
bool CFramebuffer::alloc(int w, int h) {
bool firstAlloc = false;
- RASSERT((w > 1 && h > 1), "cannot alloc a FB with negative / zero size! (attempted %ix%i)", w, h);
+ RASSERT((w > 1 && h > 1), "cannot alloc a FB with negative / zero size! (attempted {}x{})", w, h);
if (m_iFb == (uint32_t)-1) {
firstAlloc = true;
@@ -40,9 +40,9 @@ bool CFramebuffer::alloc(int w, int h) {
#endif
auto status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
- RASSERT((status == GL_FRAMEBUFFER_COMPLETE), "Framebuffer incomplete, couldn't create! (FB status: %i)", status);
+ RASSERT((status == GL_FRAMEBUFFER_COMPLETE), "Framebuffer incomplete, couldn't create! (FB status: {})", status);
- Debug::log(LOG, "Framebuffer created, status %i", status);
+ Debug::log(LOG, "Framebuffer created, status {}", status);
}
glBindTexture(GL_TEXTURE_2D, 0);
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 30c16339..933956eb 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -18,10 +18,10 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() {
m_szExtensions = EXTENSIONS;
Debug::log(LOG, "Creating the Hypr OpenGL Renderer!");
- Debug::log(LOG, "Using: %s", glGetString(GL_VERSION));
- Debug::log(LOG, "Vendor: %s", glGetString(GL_VENDOR));
- Debug::log(LOG, "Renderer: %s", glGetString(GL_RENDERER));
- Debug::log(LOG, "Supported extensions size: %d", std::count(m_szExtensions.begin(), m_szExtensions.end(), ' '));
+ Debug::log(LOG, "Using: {}", (char*)glGetString(GL_VERSION));
+ Debug::log(LOG, "Vendor: {}", (char*)glGetString(GL_VENDOR));
+ Debug::log(LOG, "Renderer: {}", (char*)glGetString(GL_RENDERER));
+ Debug::log(LOG, "Supported extensions size: {}", std::count(m_szExtensions.begin(), m_szExtensions.end(), ' '));
#ifdef USE_TRACY_GPU
@@ -50,7 +50,7 @@ GLuint CHyprOpenGLImpl::createProgram(const std::string& vert, const std::string
if (vertCompiled == 0)
return 0;
} else {
- RASSERT(vertCompiled, "Compiling shader failed. VERTEX NULL! Shader source:\n\n%s", vert.c_str());
+ RASSERT(vertCompiled, "Compiling shader failed. VERTEX NULL! Shader source:\n\n{}", vert.c_str());
}
auto fragCompiled = compileShader(GL_FRAGMENT_SHADER, frag, dynamic);
@@ -58,7 +58,7 @@ GLuint CHyprOpenGLImpl::createProgram(const std::string& vert, const std::string
if (fragCompiled == 0)
return 0;
} else {
- RASSERT(fragCompiled, "Compiling shader failed. FRAGMENT NULL! Shader source:\n\n%s", frag.c_str());
+ RASSERT(fragCompiled, "Compiling shader failed. FRAGMENT NULL! Shader source:\n\n{}", frag.c_str());
}
auto prog = glCreateProgram();
@@ -1868,7 +1868,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
cairo_surface_destroy(CAIROSURFACE);
cairo_destroy(CAIRO);
- Debug::log(LOG, "Background created for monitor %s", pMonitor->szName.c_str());
+ Debug::log(LOG, "Background created for monitor {}", pMonitor->szName.c_str());
}
void CHyprOpenGLImpl::clearWithTex() {
@@ -1900,7 +1900,7 @@ void CHyprOpenGLImpl::destroyMonitorResources(CMonitor* pMonitor) {
g_pHyprOpenGL->m_mMonitorRenderResources.erase(pMonitor);
g_pHyprOpenGL->m_mMonitorBGTextures.erase(pMonitor);
- Debug::log(LOG, "Monitor %s -> destroyed all render data", pMonitor->szName.c_str());
+ Debug::log(LOG, "Monitor {} -> destroyed all render data", pMonitor->szName.c_str());
wlr_output_rollback(pMonitor->output);
}
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 1644a759..40734154 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -763,7 +763,7 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) {
if (wlr_output_commit(pMonitor->output)) {
if (!m_pLastScanout) {
m_pLastScanout = PCANDIDATE;
- Debug::log(LOG, "Entered a direct scanout to %lx: \"%s\"", PCANDIDATE, PCANDIDATE->m_szTitle.c_str());
+ Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE, PCANDIDATE->m_szTitle.c_str());
}
} else {
m_pLastScanout = nullptr;
@@ -827,7 +827,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (!pMonitor->noFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(pMonitor);
else {
- Debug::log(LOG, "NoFrameSchedule hit for %s.", pMonitor->szName.c_str());
+ Debug::log(LOG, "NoFrameSchedule hit for {}.", pMonitor->szName.c_str());
}
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pMonitor->ID);
@@ -862,12 +862,12 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
const auto PGAMMACTRL = wlr_gamma_control_manager_v1_get_control(g_pCompositor->m_sWLRGammaCtrlMgr, pMonitor->output);
if (!wlr_gamma_control_v1_apply(PGAMMACTRL, &pMonitor->output->pending)) {
- Debug::log(ERR, "Could not apply gamma control to %s", pMonitor->szName.c_str());
+ Debug::log(ERR, "Could not apply gamma control to {}", pMonitor->szName.c_str());
return;
}
if (!wlr_output_test(pMonitor->output)) {
- Debug::log(ERR, "Output test failed for setting gamma to %s", pMonitor->szName.c_str());
+ Debug::log(ERR, "Output test failed for setting gamma to {}", pMonitor->szName.c_str());
wlr_output_rollback(pMonitor->output);
wlr_gamma_control_v1_send_failed_and_destroy(PGAMMACTRL);
}
@@ -908,7 +908,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
wlr_output_lock_software_cursors(pMonitor->output, true);
if (!wlr_output_attach_render(pMonitor->output, &bufferAge)) {
- Debug::log(ERR, "Couldn't attach render to display %s ???", pMonitor->szName.c_str());
+ Debug::log(ERR, "Couldn't attach render to display {} ???", pMonitor->szName.c_str());
if (UNLOCK_SC)
wlr_output_lock_software_cursors(pMonitor->output, false);
@@ -1111,7 +1111,7 @@ void CHyprRenderer::setWindowScanoutMode(CWindow* pWindow) {
if (!pWindow->m_bIsFullscreen) {
wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, pWindow->m_pWLSurface.wlr(), nullptr);
- Debug::log(LOG, "Scanout mode OFF set for %lx", pWindow);
+ Debug::log(LOG, "Scanout mode OFF set for {:x}", (uintptr_t)pWindow);
return;
}
@@ -1130,7 +1130,7 @@ void CHyprRenderer::setWindowScanoutMode(CWindow* pWindow) {
wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, pWindow->m_pWLSurface.wlr(), &feedback);
wlr_linux_dmabuf_feedback_v1_finish(&feedback);
- Debug::log(LOG, "Scanout mode ON set for %lx", pWindow);
+ Debug::log(LOG, "Scanout mode ON set for {:x}", (uintptr_t)pWindow);
}
void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool test) {
@@ -1319,7 +1319,7 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std:
box.y -= PSTATE->margin.bottom;
}
if (box.width <= 0 || box.height <= 0) {
- Debug::log(ERR, "LayerSurface %lx has a negative/zero w/h???", ls.get());
+ Debug::log(ERR, "LayerSurface {:x} has a negative/zero w/h???", (uintptr_t)ls.get());
continue;
}
// Apply
@@ -1329,8 +1329,8 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std:
wlr_layer_surface_v1_configure(ls->layerSurface, box.width, box.height);
- Debug::log(LOG, "LayerSurface %lx arranged: x: %i y: %i w: %i h: %i with margins: t: %i l: %i r: %i b: %i", &ls, box.x, box.y, box.width, box.height, PSTATE->margin.top,
- PSTATE->margin.left, PSTATE->margin.right, PSTATE->margin.bottom);
+ Debug::log(LOG, "LayerSurface {:x} arranged: x: {} y: {} w: {} h: {} with margins: t: {} l: {} r: {} b: {}", (uintptr_t)&ls, box.x, box.y, box.width, box.height,
+ PSTATE->margin.top, PSTATE->margin.left, PSTATE->margin.right, PSTATE->margin.bottom);
}
}
@@ -1370,7 +1370,7 @@ void CHyprRenderer::arrangeLayersForMonitor(const int& monitor) {
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitor);
- Debug::log(LOG, "Monitor %s layers arranged: reserved: %f %f %f %f", PMONITOR->szName.c_str(), PMONITOR->vecReservedTopLeft.x, PMONITOR->vecReservedTopLeft.y,
+ Debug::log(LOG, "Monitor {} layers arranged: reserved: {:.5f} {:.5f} {:.5f} {:.5f}", PMONITOR->szName.c_str(), PMONITOR->vecReservedTopLeft.x, PMONITOR->vecReservedTopLeft.y,
PMONITOR->vecReservedBottomRight.x, PMONITOR->vecReservedBottomRight.y);
}
@@ -1414,7 +1414,7 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y, dou
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE)
- Debug::log(LOG, "Damage: Surface (extents): xy: %d, %d wh: %d, %d", damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y1,
+ Debug::log(LOG, "Damage: Surface (extents): xy: {}, {} wh: {}, {}", damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y1,
damageBox.pixman()->extents.x2 - damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y2 - damageBox.pixman()->extents.y1);
}
@@ -1435,7 +1435,7 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE)
- Debug::log(LOG, "Damage: Window (%s): xy: %d, %d wh: %d, %d", pWindow->m_szTitle.c_str(), damageBox.x, damageBox.y, damageBox.width, damageBox.height);
+ Debug::log(LOG, "Damage: Window ({}): xy: {}, {} wh: {}, {}", pWindow->m_szTitle.c_str(), damageBox.x, damageBox.y, damageBox.width, damageBox.height);
}
void CHyprRenderer::damageMonitor(CMonitor* pMonitor) {
@@ -1448,7 +1448,7 @@ void CHyprRenderer::damageMonitor(CMonitor* pMonitor) {
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE)
- Debug::log(LOG, "Damage: Monitor %s", pMonitor->szName.c_str());
+ Debug::log(LOG, "Damage: Monitor {}", pMonitor->szName.c_str());
}
void CHyprRenderer::damageBox(wlr_box* pBox) {
@@ -1467,7 +1467,7 @@ void CHyprRenderer::damageBox(wlr_box* pBox) {
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE)
- Debug::log(LOG, "Damage: Box: xy: %d, %d wh: %d, %d", pBox->x, pBox->y, pBox->width, pBox->height);
+ Debug::log(LOG, "Damage: Box: xy: {}, {} wh: {}, {}", pBox->x, pBox->y, pBox->width, pBox->height);
}
void CHyprRenderer::damageBox(const int& x, const int& y, const int& w, const int& h) {
@@ -1522,7 +1522,7 @@ DAMAGETRACKINGMODES CHyprRenderer::damageTrackingModeFromStr(const std::string&
bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) {
- Debug::log(LOG, "Applying monitor rule for %s", pMonitor->szName.c_str());
+ Debug::log(LOG, "Applying monitor rule for {}", pMonitor->szName.c_str());
pMonitor->activeMonitorRule = *pMonitorRule;
@@ -1541,7 +1541,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
if (!pMonitor->m_bEnabled) {
pMonitor->onConnect(true); // enable it.
- Debug::log(LOG, "Monitor %s is disabled but is requested to be enabled", pMonitor->szName.c_str());
+ Debug::log(LOG, "Monitor {} is disabled but is requested to be enabled", pMonitor->szName.c_str());
force = true;
}
@@ -1554,7 +1554,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->transform == pMonitorRule->transform && pMonitorRule->enable10bit == pMonitor->enabled10bit &&
!memcmp(&pMonitor->customDrmMode, &pMonitorRule->drmMode, sizeof(pMonitor->customDrmMode))) {
- Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str());
+ Debug::log(LOG, "Not applying a new rule to {} because it's already applied!", pMonitor->szName.c_str());
return true;
}
@@ -1588,12 +1588,12 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
wlr_output_set_mode(pMonitor->output, mode);
if (!wlr_output_test(pMonitor->output)) {
- Debug::log(LOG, "Monitor %s: REJECTED available mode: %ix%i@%2f!", pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
- (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
+ Debug::log(LOG, "Monitor {}: REJECTED available mode: {}x{}@{:2f}!", pMonitor->output->name, (int)pMonitorRule->resolution.x,
+ (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
continue;
}
- Debug::log(LOG, "Monitor %s: requested %ix%i@%2f, found available mode: %ix%i@%imHz, applying.", pMonitor->output->name, (int)pMonitorRule->resolution.x,
+ Debug::log(LOG, "Monitor {}: requested {}x{}@{:2f}, found available mode: {}x{}@{}mHz, applying.", pMonitor->output->name, (int)pMonitorRule->resolution.x,
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh);
found = true;
@@ -1616,7 +1616,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
if (!PREFERREDMODE) {
- Debug::log(ERR, "Monitor %s has NO PREFERRED MODE, and an INVALID one was requested: %ix%i@%2f", (int)pMonitorRule->resolution.x,
+ Debug::log(ERR, "Monitor {} has NO PREFERRED MODE, and an INVALID one was requested: {}x{}@{:2f}", (int)pMonitorRule->resolution.x,
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
return true;
}
@@ -1624,14 +1624,14 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
// Preferred is valid
wlr_output_set_mode(pMonitor->output, PREFERREDMODE);
- Debug::log(ERR, "Monitor %s got an invalid requested mode: %ix%i@%2f, using the preferred one instead: %ix%i@%2f", pMonitor->output->name,
+ Debug::log(ERR, "Monitor {} got an invalid requested mode: {}x{}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name,
(int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height,
PREFERREDMODE->refresh / 1000.f);
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
} else {
- Debug::log(LOG, "Set a custom mode %ix%i@%2f (mode not found in monitor modes)", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
+ Debug::log(LOG, "Set a custom mode {}x{}@{:2f} (mode not found in monitor modes)", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
(float)pMonitorRule->refreshRate);
}
}
@@ -1666,7 +1666,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
if (!PREFERREDMODE) {
- Debug::log(ERR, "Monitor %s has NO PREFERRED MODE, and an INVALID one was requested: %ix%i@%2f", pMonitor->output->name, (int)pMonitorRule->resolution.x,
+ Debug::log(ERR, "Monitor {} has NO PREFERRED MODE, and an INVALID one was requested: {}x{}@{:2f}", pMonitor->output->name, (int)pMonitorRule->resolution.x,
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
return true;
}
@@ -1674,7 +1674,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
// Preferred is valid
wlr_output_set_mode(pMonitor->output, PREFERREDMODE);
- Debug::log(ERR, "Monitor %s got an invalid requested mode: %ix%i@%2f, using the preferred one instead: %ix%i@%2f", pMonitor->output->name,
+ Debug::log(ERR, "Monitor {} got an invalid requested mode: {}x{}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name,
(int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height,
PREFERREDMODE->refresh / 1000.f);
@@ -1682,7 +1682,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
pMonitor->customDrmMode = {};
} else {
- Debug::log(LOG, "Set a custom mode %ix%i@%2f (mode not found in monitor modes)", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
+ Debug::log(LOG, "Set a custom mode {}x{}@{:2f} (mode not found in monitor modes)", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
(float)pMonitorRule->refreshRate);
}
}
@@ -1723,13 +1723,13 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
}
if (!success) {
- Debug::log(LOG, "Monitor %s: REJECTED mode: %ix%i@%2f! Falling back to preferred.", pMonitor->output->name, (int)pMonitorRule->resolution.x,
+ Debug::log(LOG, "Monitor {}: REJECTED mode: {}x{}@{:2f}! Falling back to preferred.", pMonitor->output->name, (int)pMonitorRule->resolution.x,
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
if (!PREFERREDMODE) {
- Debug::log(ERR, "Monitor %s has NO PREFERRED MODE, and an INVALID one was requested: %ix%i@%2f", (int)pMonitorRule->resolution.x,
+ Debug::log(ERR, "Monitor {} has NO PREFERRED MODE, and an INVALID one was requested: {}x{}@{:2f}", (int)pMonitorRule->resolution.x,
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
return true;
}
@@ -1737,7 +1737,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
// Preferred is valid
wlr_output_set_mode(pMonitor->output, PREFERREDMODE);
- Debug::log(ERR, "Monitor %s got an invalid requested mode: %ix%i@%2f, using the preferred one instead: %ix%i@%2f", pMonitor->output->name,
+ Debug::log(ERR, "Monitor {} got an invalid requested mode: {}x{}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name,
(int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height,
PREFERREDMODE->refresh / 1000.f);
@@ -1745,7 +1745,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
} else {
- Debug::log(LOG, "Monitor %s: Applying highest mode %ix%i@%2f.", pMonitor->output->name, (int)currentWidth, (int)currentHeight, (int)currentRefresh / 1000.f,
+ Debug::log(LOG, "Monitor {}: Applying highest mode {}x{}@{:2f}.", pMonitor->output->name, (int)currentWidth, (int)currentHeight, (int)currentRefresh / 1000.f,
mode->width, mode->height, mode->refresh / 1000.f);
pMonitor->refreshRate = currentRefresh / 1000.f;
@@ -1756,7 +1756,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
if (!PREFERREDMODE) {
- Debug::log(ERR, "Monitor %s has NO PREFERRED MODE", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
+ Debug::log(ERR, "Monitor {} has NO PREFERRED MODE", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
if (!wl_list_empty(&pMonitor->output->modes)) {
wlr_output_mode* mode;
@@ -1765,12 +1765,12 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
wlr_output_set_mode(pMonitor->output, mode);
if (!wlr_output_test(pMonitor->output)) {
- Debug::log(LOG, "Monitor %s: REJECTED available mode: %ix%i@%2f!", pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
- (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
+ Debug::log(LOG, "Monitor {}: REJECTED available mode: {}x{}@{:2f}!", pMonitor->output->name, (int)pMonitorRule->resolution.x,
+ (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
continue;
}
- Debug::log(LOG, "Monitor %s: requested %ix%i@%2f, found available mode: %ix%i@%imHz, applying.", pMonitor->output->name, (int)pMonitorRule->resolution.x,
+ Debug::log(LOG, "Monitor {}: requested {}x{}@{:2f}, found available mode: {}x{}@{}mHz, applying.", pMonitor->output->name, (int)pMonitorRule->resolution.x,
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh);
pMonitor->refreshRate = mode->refresh / 1000.f;
@@ -1786,7 +1786,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
- Debug::log(LOG, "Setting preferred mode for %s", pMonitor->output->name);
+ Debug::log(LOG, "Setting preferred mode for {}", pMonitor->output->name);
}
}
@@ -1800,19 +1800,19 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->enabled10bit = true;
if (!wlr_output_test(pMonitor->output)) {
- Debug::log(ERR, "Output %s -> 10 bit enabled, but failed format DRM_FORMAT_XRGB2101010. Trying BGR.", pMonitor->output->name);
+ Debug::log(ERR, "Output {} -> 10 bit enabled, but failed format DRM_FORMAT_XRGB2101010. Trying BGR.", pMonitor->output->name);
wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XBGR2101010);
if (!wlr_output_test(pMonitor->output)) {
- Debug::log(ERR, "Output %s -> 10 bit enabled, but failed format DRM_FORMAT_XBGR2101010. Falling back to 8 bit.", pMonitor->output->name);
+ Debug::log(ERR, "Output {} -> 10 bit enabled, but failed format DRM_FORMAT_XBGR2101010. Falling back to 8 bit.", pMonitor->output->name);
wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XRGB8888);
} else {
- Debug::log(LOG, "10bit format DRM_FORMAT_XBGR2101010 succeeded for output %s", pMonitor->output->name);
+ Debug::log(LOG, "10bit format DRM_FORMAT_XBGR2101010 succeeded for output {}", pMonitor->output->name);
}
} else {
- Debug::log(LOG, "10bit format DRM_FORMAT_XRGB2101010 succeeded for output %s", pMonitor->output->name);
+ Debug::log(LOG, "10bit format DRM_FORMAT_XRGB2101010 succeeded for output {}", pMonitor->output->name);
}
} else {
wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XRGB8888);
@@ -1820,7 +1820,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
}
if (!wlr_output_commit(pMonitor->output)) {
- Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
+ Debug::log(ERR, "Couldn't commit output named {}", pMonitor->output->name);
}
int x, y;
@@ -1853,7 +1853,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
// reload to fix mirrors
g_pConfigManager->m_bWantsMonitorReload = true;
- Debug::log(LOG, "Monitor %s data dump: res %ix%i@%.2fHz, scale %.2f, transform %i, pos %ix%i, 10b %i", pMonitor->szName.c_str(), (int)pMonitor->vecPixelSize.x,
+ Debug::log(LOG, "Monitor {} data dump: res {}x{}@{:.2f}Hz, scale {:.2f}, transform {}, pos {}x{}, 10b {}", pMonitor->szName.c_str(), (int)pMonitor->vecPixelSize.x,
(int)pMonitor->vecPixelSize.y, pMonitor->refreshRate, pMonitor->scale, (int)pMonitor->transform, (int)pMonitor->vecPosition.x, (int)pMonitor->vecPosition.y,
(int)pMonitor->enabled10bit);