internal: Formatter rework (#3186)

This commit is contained in:
Vaxry 2023-09-06 12:51:36 +02:00 committed by GitHub
parent c3a83daa1e
commit 61a71c65ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 671 additions and 655 deletions

View File

@ -1,6 +1,7 @@
{ {
lib, lib,
stdenv, stdenv,
gcc13Stdenv,
pkg-config, pkg-config,
makeWrapper, makeWrapper,
meson, meson,
@ -39,7 +40,7 @@
}: }:
assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been renamed `enableNvidiaPatches`"; 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"; 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"}"; pname = "hyprland${lib.optionalString enableNvidiaPatches "-nvidia"}${lib.optionalString debug "-debug"}";
inherit version; inherit version;

View File

@ -10,7 +10,7 @@
#include <ranges> #include <ranges>
int handleCritSignal(int signo, void* data) { 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) if (signo == SIGTERM || signo == SIGINT || signo == SIGKILL)
g_pCompositor->cleanup(); g_pCompositor->cleanup();
@ -53,9 +53,9 @@ CCompositor::CCompositor() {
Debug::init(m_szInstanceSignature); 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: ====="); Debug::log(LOG, "===== SYSTEM INFO: =====");
@ -69,7 +69,7 @@ CCompositor::CCompositor() {
setRandomSplash(); 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() { CCompositor::~CCompositor() {
@ -177,7 +177,7 @@ void CCompositor::initServer() {
int cursorSize = 24; int cursorSize = 24;
try { try {
cursorSize = std::stoi(XCURSORENV); 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); m_sWLRXCursorMgr = wlr_xcursor_manager_create(nullptr, cursorSize);
wlr_xcursor_manager_load(m_sWLRXCursorMgr, 1); 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()); const auto RETVAL = wl_display_add_socket(m_sWLDisplay, CANDIDATESTR.c_str());
if (RETVAL >= 0) { if (RETVAL >= 0) {
m_szWLDisplaySocket = CANDIDATESTR; 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; break;
} else { } 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", "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE",
nullptr); 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)) { if (!wlr_backend_start(m_sWLRBackend)) {
Debug::log(CRIT, "Backend did not start!"); Debug::log(CRIT, "Backend did not start!");
@ -912,7 +912,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
// Send an event // Send an event
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(pWindow) + "," + pWindow->m_szTitle}); 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); EMIT_HOOK_EVENT("activeWindow", pWindow);
@ -943,7 +943,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
// move to front of the window history // 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; }); const auto HISTORYPIVOT = std::find_if(m_vWindowFocusHistory.begin(), m_vWindowFocusHistory.end(), [&](const auto& other) { return other == pWindow; });
if (HISTORYPIVOT == m_vWindowFocusHistory.end()) { 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 { } else {
std::rotate(m_vWindowFocusHistory.begin(), HISTORYPIVOT, HISTORYPIVOT + 1); 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); wl_signal_emit_mutable(&m_sSeat.seat->keyboard_state.events.focus_change, &event);
if (pWindowOwner) 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 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); g_pXWaylandManager->activateSurface(pSurface, true);
m_pLastFocus = pSurface; m_pLastFocus = pSurface;
@ -1930,7 +1930,7 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
if (pWorkspace->m_iMonitorID == pMonitor->ID) if (pWorkspace->m_iMonitorID == pMonitor->ID)
return; 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); const auto POLDMON = getMonitorFromID(pWorkspace->m_iMonitorID);
@ -1957,12 +1957,12 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
}()) }())
nextWorkspaceOnMonitorID++; 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); 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); 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. 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) if (const auto PWORKSPACE = getWorkspaceByID(pMonitor->activeWorkspace); PWORKSPACE)
getWorkspaceByID(pMonitor->activeWorkspace)->startAnim(false, false); getWorkspaceByID(pMonitor->activeWorkspace)->startAnim(false, false);
@ -2187,13 +2187,13 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
break; break;
} }
case MODE_ADDRESS: { case MODE_ADDRESS: {
std::string addr = getFormat("0x%lx", w.get()); std::string addr = getFormat("0x{:x}", (uintptr_t)w.get());
if (matchCheck != addr) if (matchCheck != addr)
continue; continue;
break; break;
} }
case MODE_PID: { case MODE_PID: {
std::string pid = getFormat("%d", w->getPID()); std::string pid = getFormat("{}", w->getPID());
if (matchCheck != pid) if (matchCheck != pid)
continue; continue;
break; break;
@ -2357,7 +2357,7 @@ void CCompositor::renameWorkspace(const int& id, const std::string& name) {
if (isWorkspaceSpecial(id)) if (isWorkspaceSpecial(id))
return; 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; PWORKSPACE->m_szName = name;
g_pEventManager->postEvent({"renameworkspace", std::to_string(PWORKSPACE->m_iID) + "," + PWORKSPACE->m_szName}); 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) for (auto& m : m_vMonitors)
toArrange.push_back(m.get()); 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();) { for (auto it = toArrange.begin(); it != toArrange.end();) {
auto m = *it; auto m = *it;
if (m->activeMonitorRule.offset != Vector2D{-INT32_MAX, -INT32_MAX}) { if (m->activeMonitorRule.offset != Vector2D{-INT32_MAX, -INT32_MAX}) {
// explicit. // 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); m->moveTo(m->activeMonitorRule.offset);
arranged.push_back(m); arranged.push_back(m);
@ -2508,7 +2508,7 @@ void CCompositor::arrangeMonitors() {
} }
for (auto& m : toArrange) { 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}); m->moveTo({maxOffset, 0});
maxOffset += m->vecSize.x; maxOffset += m->vecSize.x;
} }
@ -2517,7 +2517,7 @@ void CCompositor::arrangeMonitors() {
// and set xwayland positions aka auto for all // and set xwayland positions aka auto for all
maxOffset = 0; maxOffset = 0;
for (auto& m : m_vMonitors) { 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}; m->vecXWaylandPosition = {maxOffset, 0};
maxOffset += (*PXWLFORCESCALEZERO ? m->vecTransformedSize.x : m->vecSize.x); maxOffset += (*PXWLFORCESCALEZERO ? m->vecTransformedSize.x : m->vecSize.x);
} }

View File

@ -340,7 +340,7 @@ void CWindow::moveToWorkspace(int workspaceID) {
updateSpecialRenderData(); updateSpecialRenderData();
if (PWORKSPACE) { 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})); 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) { } else if (r.szRule.find("rounding") == 0) {
try { try {
m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1)); 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) { } else if (r.szRule.find("bordersize") == 0) {
try { try {
m_sAdditionalConfigData.borderSize = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1)); 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) { } else if (r.szRule.find("opacity") == 0) {
try { try {
CVarList vars(r.szRule, 0, ' '); CVarList vars(r.szRule, 0, ' ');
@ -529,7 +529,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
opacityIDX++; 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") { } else if (r.szRule == "noanim") {
m_sAdditionalConfigData.forceNoAnims = true; m_sAdditionalConfigData.forceNoAnims = true;
} else if (r.szRule.find("animation") == 0) { } else if (r.szRule.find("animation") == 0) {
@ -546,7 +546,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
} else { } else {
m_sSpecialRenderData.activeBorderColor = configStringToInt(colorPart); 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") { } else if (r.szRule == "dimaround") {
m_sAdditionalConfigData.dimAround = true; m_sAdditionalConfigData.dimAround = true;
} else if (r.szRule == "keepaspectratio") { } else if (r.szRule == "keepaspectratio") {

View File

@ -328,7 +328,7 @@ void CConfigManager::init() {
struct stat fileStat; struct stat fileStat;
int err = stat(CONFIGPATH.c_str(), &fileStat); int err = stat(CONFIGPATH.c_str(), &fileStat);
if (err != 0) { 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; 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.find("device:") != 0 /* devices parsed later */ && COMMAND.find("plugin:") != 0 /* plugins parsed later */) {
if (COMMAND[0] == '$') { if (COMMAND[0] == '$') {
// register a dynamic var // 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)); 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(); }); 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 { try {
CONFIGENTRY->intValue = configStringToInt(VALUE); CONFIGENTRY->intValue = configStringToInt(VALUE);
} catch (std::exception& e) { } 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(); parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. " + e.what();
} }
} else if (CONFIGENTRY->floatValue != -__FLT_MAX__) { } else if (CONFIGENTRY->floatValue != -__FLT_MAX__) {
try { try {
CONFIGENTRY->floatValue = stof(VALUE); CONFIGENTRY->floatValue = stof(VALUE);
} catch (...) { } 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 + ">."; parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
} }
} else if (CONFIGENTRY->strValue != "") { } else if (CONFIGENTRY->strValue != "") {
try { try {
CONFIGENTRY->strValue = VALUE; CONFIGENTRY->strValue = VALUE;
} catch (...) { } 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 + ">."; parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
} }
} else if (CONFIGENTRY->vecValue != Vector2D(-__FLT_MAX__, -__FLT_MAX__)) { } 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)); CONFIGENTRY->vecValue = Vector2D(std::stof(X), std::stof(Y));
} }
} else { } 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 + ">."; parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
} }
} catch (...) { } 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 + ">."; parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
} }
} else if (CONFIGENTRY->data.get() != nullptr) { } else if (CONFIGENTRY->data.get() != nullptr) {
@ -449,7 +449,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
try { try {
data->m_fAngle = std::stoi(var.substr(0, var.find("deg"))) * (PI / 180.0); // radians data->m_fAngle = std::stoi(var.substr(0, var.find("deg"))) * (PI / 180.0); // radians
} catch (...) { } 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 + ">."; 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) { 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."; parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. Max colors in a gradient is 10.";
break; break;
} }
@ -465,13 +465,13 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
try { try {
data->m_vColors.push_back(CColor(configStringToInt(var))); data->m_vColors.push_back(CColor(configStringToInt(var)));
} catch (std::exception& e) { } 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(); parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. " + e.what();
} }
} }
if (data->m_vColors.size() == 0) { 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."; parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. No colors provided.";
data->m_vColors.push_back(0); // transparent data->m_vColors.push_back(0); // transparent
@ -493,7 +493,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
struct stat fileStat; struct stat fileStat;
int err = stat(PATH.c_str(), &fileStat); int err = stat(PATH.c_str(), &fileStat);
if (err != 0) { 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; return;
} }
@ -516,7 +516,7 @@ static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
return false; return false;
if (args.size() < 10) { 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; return false;
} }
@ -550,7 +550,7 @@ static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
if (it != flagsmap.end()) if (it != flagsmap.end())
mode.flags |= it->second; mode.flags |= it->second;
else 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); 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") { else if (ARGS[1] == "transform") {
const auto TSF = std::stoi(ARGS[2]); const auto TSF = std::stoi(ARGS[2]);
if (std::clamp(TSF, 0, 7) != TSF) { 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"; parseError = "invalid transform";
return; return;
} }
@ -919,7 +919,7 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str
// verify we support a rule // verify we support a rule
if (!windowRuleValid(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; parseError = "Invalid rule found: " + RULE;
return; return;
} }
@ -944,7 +944,7 @@ void CConfigManager::handleLayerRule(const std::string& command, const std::stri
} }
if (!layerRuleValid(RULE)) { 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; parseError = "Invalid rule found: " + RULE;
return; 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); const auto VALUE = value.substr(value.find_first_of(',') + 1);
if (!windowRuleValid(RULE) && RULE != "unset") { 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; parseError = "Invalid rulev2 found: " + RULE;
return; 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 && 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) { 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; parseError = "Invalid rulev2 syntax: " + VALUE;
return; return;
} }
@ -1089,7 +1089,7 @@ void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBl
for (auto& lsl : m->m_aLayerSurfaceLayers) { for (auto& lsl : m->m_aLayerSurfaceLayers) {
for (auto& ls : lsl) { for (auto& ls : lsl) {
if (BYADDRESS) { if (BYADDRESS) {
if (getFormat("0x%lx", ls.get()) == matchName) if (getFormat("0x{:x}", (uintptr_t)ls.get()) == matchName)
ls->forceBlur = forceBlur; ls->forceBlur = forceBlur;
} else if (ls->szNamespace == matchName) } else if (ls->szNamespace == matchName)
ls->forceBlur = forceBlur; 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))); auto wsIdent = removeBeginEndSpacesTabs(value.substr(FIRST_DELIM + 1, (WORKSPACE_DELIM - FIRST_DELIM - 1)));
id = getWorkspaceIDFromString(wsIdent, name); id = getWorkspaceIDFromString(wsIdent, name);
if (id == INT_MAX) { 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; parseError = "Invalid workspace identifier found: " + wsIdent;
return; return;
} }
@ -1207,7 +1207,7 @@ void CConfigManager::handleSource(const std::string& command, const std::string&
struct stat fileStat; struct stat fileStat;
int err = stat(value.c_str(), &fileStat); int err = stat(value.c_str(), &fileStat);
if (err != 0) { 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; return;
} }
@ -1225,7 +1225,7 @@ void CConfigManager::handleSource(const std::string& command, const std::string&
parseLine(line); parseLine(line);
} catch (...) { } catch (...) {
Debug::log(ERR, "Error reading line from config. Line:"); 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."; parseError += "Config error at line " + std::to_string(linenum) + " (" + configCurrentPath + "): Line parsing error.";
} }
@ -1487,7 +1487,7 @@ void CConfigManager::loadConfigLoadVars() {
// paths // paths
configPaths.clear(); configPaths.clear();
std::string mainConfigPath = getMainConfigPath(); 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); configPaths.push_back(mainConfigPath);
std::string configPath = mainConfigPath.substr(0, mainConfigPath.find_last_of('/')); std::string configPath = mainConfigPath.substr(0, mainConfigPath.find_last_of('/'));
// find_last_of never returns npos since main_config at least has /hypr/ // find_last_of never returns npos since main_config at least has /hypr/
@ -1545,7 +1545,7 @@ void CConfigManager::loadConfigLoadVars() {
parseLine(line); parseLine(line);
} catch (...) { } catch (...) {
Debug::log(ERR, "Error reading line from config. Line:"); 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."; parseError += "Config error at line " + std::to_string(linenum) + " (" + mainConfigPath + "): Line parsing error.";
} }
@ -1654,7 +1654,7 @@ void CConfigManager::tick() {
struct stat fileStat; struct stat fileStat;
int err = stat(cf.c_str(), &fileStat); int err = stat(cf.c_str(), &fileStat);
if (err != 0) { 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; continue;
} }
@ -1687,7 +1687,7 @@ SConfigValue CConfigManager::getConfigValueSafeDevice(const std::string& dev, co
const auto it = deviceConfigs.find(dev); const auto it = deviceConfigs.find(dev);
if (it == deviceConfigs.end()) { 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(); return SConfigValue();
} }
@ -1771,7 +1771,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const std::string& name, const st
if (found) if (found)
return *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) { for (auto& r : m_dMonitorRules) {
if (r.name == "") { if (r.name == "") {
@ -1804,7 +1804,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
std::string title = g_pXWaylandManager->getTitle(pWindow); std::string title = g_pXWaylandManager->getTitle(pWindow);
std::string appidclass = g_pXWaylandManager->getAppIDClass(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 // since some rules will be applied later, we need to store some flags
bool hasFloating = pWindow->m_bIsFloating; bool hasFloating = pWindow->m_bIsFloating;
@ -1827,7 +1827,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
continue; continue;
} }
} catch (...) { } catch (...) {
Debug::log(ERR, "Regex error at %s", rule.szValue.c_str()); Debug::log(ERR, "Regex error at {}", rule.szValue.c_str());
continue; continue;
} }
} else { } else {
@ -1887,13 +1887,13 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
} }
} }
} catch (std::exception& e) { } 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; continue;
} }
} }
// applies. Read the rule and behave accordingly // 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); returns.push_back(rule);
@ -1931,7 +1931,7 @@ std::vector<SLayerRule> CConfigManager::getMatchingRules(SLayerSurface* pLS) {
for (auto& lr : m_dLayerRules) { for (auto& lr : m_dLayerRules) {
if (lr.targetNamespace.find("address:0x") == 0) { 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; continue;
} else { } else {
std::regex NSCHECK(lr.targetNamespace); std::regex NSCHECK(lr.targetNamespace);
@ -2082,7 +2082,7 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
wlr_output_enable_adaptive_sync(m->output, 0); wlr_output_enable_adaptive_sync(m->output, 0);
if (!wlr_output_commit(m->output)) 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; m->vrrActive = false;
return; return;
@ -2091,12 +2091,12 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
wlr_output_enable_adaptive_sync(m->output, 1); wlr_output_enable_adaptive_sync(m->output, 1);
if (!wlr_output_test(m->output)) { 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); wlr_output_enable_adaptive_sync(m->output, 0);
} }
if (!wlr_output_commit(m->output)) 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; m->vrrActive = true;
return; return;
@ -2115,18 +2115,18 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
wlr_output_enable_adaptive_sync(m->output, 1); wlr_output_enable_adaptive_sync(m->output, 1);
if (!wlr_output_test(m->output)) { 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); wlr_output_enable_adaptive_sync(m->output, 0);
} }
if (!wlr_output_commit(m->output)) 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) { } else if (!WORKSPACEFULL && m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) {
wlr_output_enable_adaptive_sync(m->output, 0); wlr_output_enable_adaptive_sync(m->output, 0);
if (!wlr_output_commit(m->output)) 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);
} }
} }
}; };

View File

@ -14,19 +14,19 @@
std::string getRandomMessage() { std::string getRandomMessage() {
const std::vector<std::string> MESSAGES = {"Sorry, didn't mean to...", const std::vector<std::string> MESSAGES = {"Sorry, didn't mean to...",
"This was an accident, I swear!", "This was an accident, I swear!",
"Calm down, it was a misinput! MISINPUT!", "Calm down, it was a misinput! MISINPUT!",
"Oops", "Oops",
"Vaxry is going to be upset.", "Vaxry is going to be upset.",
"Who tried dividing by zero?!", "Who tried dividing by zero?!",
"Maybe you should try dusting your PC in the meantime?", "Maybe you should try dusting your PC in the meantime?",
"I tried so hard, and got so far...", "I tried so hard, and got so far...",
"I don't feel so good...", "I don't feel so good...",
"*thud*", "*thud*",
"Well this is awkward.", "Well this is awkward.",
"\"stable\"", "\"stable\"",
"I hope you didn't have any unsaved progress.", "I hope you didn't have any unsaved progress.",
"All these computers..."}; "All these computers..."};
std::random_device dev; std::random_device dev;
std::mt19937 engine(dev()); std::mt19937 engine(dev());
@ -45,15 +45,15 @@ void CrashReporter::createAndSaveCrash(int sig) {
finalCrashReport += "--------------------------------------------\n Hyprland Crash Report\n--------------------------------------------\n"; finalCrashReport += "--------------------------------------------\n Hyprland Crash Report\n--------------------------------------------\n";
finalCrashReport += getRandomMessage() + "\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()) { 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"; finalCrashReport += "Hyprland seems to be running with plugins. This crash might not be Hyprland's fault.\nPlugins:\n";
for (auto& p : g_pPluginSystem->getAllPlugins()) { 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"; finalCrashReport += "\n\n";
@ -65,7 +65,7 @@ void CrashReporter::createAndSaveCrash(int sig) {
uname(&unameInfo); uname(&unameInfo);
finalCrashReport += 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__) #if defined(__DragonFly__) || defined(__FreeBSD__)
const std::string GPUINFO = execAndGet("pciconf -lv | fgrep -A4 vga"); 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 += "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"; finalCrashReport += "Backtrace:\n";
@ -107,12 +107,12 @@ void CrashReporter::createAndSaveCrash(int sig) {
#endif #endif
for (size_t i = 0; i < CALLSTACK.size(); ++i) { 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__ #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 #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 #endif
const auto ADDR2LINE = replaceInString(execAndGet(CMD.c_str()), "\n", "\n\t\t"); const auto ADDR2LINE = replaceInString(execAndGet(CMD.c_str()), "\n", "\n\t\t");
finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2); finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2);
@ -156,5 +156,5 @@ void CrashReporter::createAndSaveCrash(int sig) {
ofs.close(); ofs.close();
Debug::disableStdout = false; 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());
} }

View File

@ -38,33 +38,33 @@ std::string monitorsRequest(HyprCtl::eHyprCtlOutputFormat format) {
continue; continue;
result += getFormat( result += getFormat(
R"#({ R"#({{
"id": %i, "id": {},
"name": "%s", "name": "{}",
"description": "%s", "description": "{}",
"make": "%s", "make": "{}",
"model": "%s", "model": "{}",
"serial": "%s", "serial": "{}",
"width": %i, "width": {},
"height": %i, "height": {},
"refreshRate": %f, "refreshRate": {:.5f},
"x": %i, "x": {},
"y": %i, "y": {},
"activeWorkspace": { "activeWorkspace": {{
"id": %i, "id": {},
"name": "%s" "name": "{}"
}, }},
"specialWorkspace": { "specialWorkspace": {{
"id": %i, "id": {},
"name": "%s" "name": "{}"
}, }},
"reserved": [%i, %i, %i, %i], "reserved": [{}, {}, {}, {}],
"scale": %.2f, "scale": {:.2f},
"transform": %i, "transform": {},
"focused": %s, "focused": {},
"dpmsStatus": %s, "dpmsStatus": {},
"vrr": %s "vrr": {}
},)#", }},)#",
m->ID, escapeJSONStrings(m->szName).c_str(), escapeJSONStrings(m->output->description ? m->output->description : "").c_str(), 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, (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, (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) if (!m->output)
continue; 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 " result += getFormat("Monitor {} (ID {}):\n\t{}x{}@{:.5f} at {}x{}\n\tdescription: {}\n\tmake: {}\n\tmodel: {}\n\tserial: {}\n\tactive workspace: {} ({})\n\tspecial "
"workspace: %i (%s)\n\treserved: %i " "workspace: {} ({})\n\treserved: {} "
"%i %i %i\n\tscale: %.2f\n\ttransform: " "{} {} {}\n\tscale: {:.2f}\n\ttransform: "
"%i\n\tfocused: %s\n\tdpmsStatus: %i\n\tvrr: %i\n\n", "{}\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->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->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(), (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); } while (curr != w);
const auto comma = isJson ? ", " : ","; const auto comma = isJson ? ", " : ",";
const auto fmt = isJson ? "\"0x%lx\"" : "%lx"; const auto fmt = isJson ? "\"0x{:x}\"" : "{:x}";
std::ostringstream result; std::ostringstream result;
bool first = true; bool first = true;
@ -123,7 +123,7 @@ static std::string getGroupedData(CWindow* w, HyprCtl::eHyprCtlOutputFormat form
else else
result << comma; result << comma;
result << getFormat(fmt, gw); result << getFormat(fmt, (uintptr_t)gw);
} }
return result.str(); 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) { static std::string getWindowData(CWindow* w, HyprCtl::eHyprCtlOutputFormat format) {
if (format == HyprCtl::FORMAT_JSON) { if (format == HyprCtl::FORMAT_JSON) {
return getFormat( return getFormat(
R"#({ R"#({{
"address": "0x%lx", "address": "0x{:x}",
"mapped": %s, "mapped": {},
"hidden": %s, "hidden": {},
"at": [%i, %i], "at": [{}, {}],
"size": [%i, %i], "size": [{}, {}],
"workspace": { "workspace": {{
"id": %i, "id": {},
"name": "%s" "name": "{}"
}, }},
"floating": %s, "floating": {},
"monitor": %i, "monitor": {},
"class": "%s", "class": "{}",
"title": "%s", "title": "{}",
"initialClass": "%s", "initialClass": "{}",
"initialTitle": "%s", "initialTitle": "{}",
"pid": %i, "pid": {},
"xwayland": %s, "xwayland": {},
"pinned": %s, "pinned": {},
"fullscreen": %s, "fullscreen": {},
"fullscreenMode": %i, "fullscreenMode": {},
"fakeFullscreen": %s, "fakeFullscreen": {},
"grouped": [%s], "grouped": [{}],
"swallowing": %s "swallowing": "0x{:x}"
},)#", }},)#",
w, (w->m_bIsMapped ? "true" : "false"), (w->isHidden() ? "true" : "false"), (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y, (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, (int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y, w->m_iWorkspaceID,
escapeJSONStrings(w->m_iWorkspaceID == -1 ? "" : escapeJSONStrings(w->m_iWorkspaceID == -1 ? "" :
g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName : g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName :
std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID))) 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)),
((int)w->m_bIsFloating == 1 ? "true" : "false"), w->m_iMonitorID, escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)).c_str(), escapeJSONStrings(g_pXWaylandManager->getTitle(w)), escapeJSONStrings(w->m_szInitialClass), escapeJSONStrings(w->m_szInitialTitle), w->getPID(),
escapeJSONStrings(g_pXWaylandManager->getTitle(w)).c_str(), escapeJSONStrings(w->m_szInitialClass).c_str(), escapeJSONStrings(w->m_szInitialTitle).c_str(), w->getPID(),
((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"), (w->m_bIsFullscreen ? "true" : "false"), ((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_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).c_str(), (w->m_pSwallowed ? getFormat("\"0x%lx\"", w->m_pSwallowed).c_str() : "null")); w->m_bFakeFullscreenState ? "true" : "false", getGroupedData(w, format), (uintptr_t)w->m_pSwallowed);
} else { } else {
return getFormat( 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: " "Window {:x} -> {}:\n\tmapped: {}\n\thidden: {}\n\tat: {},{}\n\tsize: {},{}\n\tworkspace: {} ({})\n\tfloating: {}\n\tmonitor: {}\n\tclass: {}\n\ttitle: "
"%s\n\tinitialClass: %s\n\tinitialTitle: %s\n\tpid: " "{}\n\tinitialClass: {}\n\tinitialTitle: {}\n\tpid: "
"%i\n\txwayland: %i\n\tpinned: " "{}\n\txwayland: {}\n\tpinned: "
"%i\n\tfullscreen: %i\n\tfullscreenmode: %i\n\tfakefullscreen: %i\n\tgrouped: %s\n\tswallowing: %lx\n\n", "{}\n\tfullscreen: {}\n\tfullscreenmode: {}\n\tfakefullscreen: {}\n\tgrouped: {}\n\tswallowing: {:x}\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, (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().y, w->m_iWorkspaceID, (int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y, w->m_iWorkspaceID,
(w->m_iWorkspaceID == -1 ? "" : (w->m_iWorkspaceID == -1 ? "" :
g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName.c_str() : 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()), 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(), (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_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), (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 PLASTW = w->getLastFocusedWindow();
const auto PMONITOR = g_pCompositor->getMonitorFromID(w->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(w->m_iMonitorID);
if (format == HyprCtl::FORMAT_JSON) { if (format == HyprCtl::FORMAT_JSON) {
return getFormat(R"#({ return getFormat(R"#({{
"id": %i, "id": {},
"name": "%s", "name": "{}",
"monitor": "%s", "monitor": "{}",
"windows": %i, "windows": {},
"hasfullscreen": %s, "hasfullscreen": {},
"lastwindow": "0x%lx", "lastwindow": "0x{:x}",
"lastwindowtitle": "%s" "lastwindowtitle": "{}"
})#", }})#",
w->m_iID, escapeJSONStrings(w->m_szName).c_str(), escapeJSONStrings(PMONITOR ? PMONITOR->szName : "?").c_str(), 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() : ""); PLASTW ? escapeJSONStrings(PLASTW->m_szTitle).c_str() : "");
} else { } 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(), 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, PLASTW, PMONITOR ? PMONITOR->szName.c_str() : "?", g_pCompositor->getWindowsOnWorkspace(w->m_iID), (int)w->m_bHasFullscreenWindow, (uintptr_t)PLASTW,
PLASTW ? PLASTW->m_szTitle.c_str() : ""); PLASTW ? PLASTW->m_szTitle.c_str() : "");
} }
} }
@ -278,8 +277,8 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& mon : g_pCompositor->m_vMonitors) { for (auto& mon : g_pCompositor->m_vMonitors) {
result += getFormat( result += getFormat(
R"#("%s": { R"#("{}": {{
"levels": { "levels": {{
)#", )#",
escapeJSONStrings(mon->szName).c_str()); escapeJSONStrings(mon->szName).c_str());
@ -287,20 +286,20 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& level : mon->m_aLayerSurfaceLayers) { for (auto& level : mon->m_aLayerSurfaceLayers) {
result += getFormat( result += getFormat(
R"#( R"#(
"%i": [ "{}": [
)#", )#",
layerLevel); layerLevel);
for (auto& layer : level) { for (auto& layer : level) {
result += getFormat( result += getFormat(
R"#( { R"#( {{
"address": "0x%lx", "address": "0x{:x}",
"x": %i, "x": {},
"y": %i, "y": {},
"w": %i, "w": {},
"h": %i, "h": {},
"namespace": "%s" "namespace": "{}"
},)#", }},)#",
layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, escapeJSONStrings(layer->szNamespace).c_str()); (uintptr_t)layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, escapeJSONStrings(layer->szNamespace).c_str());
} }
trimTrailingComma(result); trimTrailingComma(result);
@ -324,14 +323,14 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
} else { } else {
for (auto& mon : g_pCompositor->m_vMonitors) { 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; int layerLevel = 0;
static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"}; static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"};
for (auto& level : mon->m_aLayerSurfaceLayers) { 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) { 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()); layer->geometry.height, layer->szNamespace.c_str());
} }
@ -353,12 +352,12 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& m : g_pInputManager->m_lMice) { for (auto& m : g_pInputManager->m_lMice) {
result += getFormat( result += getFormat(
R"#( { R"#( {{
"address": "0x%lx", "address": "0x{:x}",
"name": "%s", "name": "{}",
"defaultSpeed": %f "defaultSpeed": {:.5f}
},)#", }},)#",
&m, escapeJSONStrings(m.name).c_str(), (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); 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) { for (auto& k : g_pInputManager->m_lKeyboards) {
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k); const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k);
result += getFormat( result += getFormat(
R"#( { R"#( {{
"address": "0x%lx", "address": "0x{:x}",
"name": "%s", "name": "{}",
"rules": "%s", "rules": "{}",
"model": "%s", "model": "{}",
"layout": "%s", "layout": "{}",
"variant": "%s", "variant": "{}",
"options": "%s", "options": "{}",
"active_keymap": "%s", "active_keymap": "{}",
"main": %s "main": {}
},)#", }},)#",
&k, escapeJSONStrings(k.name).c_str(), escapeJSONStrings(k.currentRules.rules).c_str(), escapeJSONStrings(k.currentRules.model).c_str(), (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(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")); 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) { for (auto& d : g_pInputManager->m_lTabletPads) {
result += getFormat( result += getFormat(
R"#( { R"#( {{
"address": "0x%lx", "address": "0x{:x}",
"type": "tabletPad", "type": "tabletPad",
"belongsTo": { "belongsTo": {{
"address": "0x%lx", "address": "0x{:x}",
"name": "%s" "name": "{}"
} }}
},)#", }},)#",
&d, d.pTabletParent, escapeJSONStrings(d.pTabletParent ? d.pTabletParent->name : "").c_str()); (uintptr_t)&d, (uintptr_t)d.pTabletParent, escapeJSONStrings(d.pTabletParent ? d.pTabletParent->name : "").c_str());
} }
for (auto& d : g_pInputManager->m_lTablets) { for (auto& d : g_pInputManager->m_lTablets) {
result += getFormat( result += getFormat(
R"#( { R"#( {{
"address": "0x%lx", "address": "0x{:x}",
"name": "%s" "name": "{}"
},)#", }},)#",
&d, escapeJSONStrings(d.name).c_str()); (uintptr_t)&d, escapeJSONStrings(d.name).c_str());
} }
for (auto& d : g_pInputManager->m_lTabletTools) { for (auto& d : g_pInputManager->m_lTabletTools) {
result += getFormat( result += getFormat(
R"#( { R"#( {{
"address": "0x%lx", "address": "0x{:x}",
"type": "tabletTool", "type": "tabletTool",
"belongsTo": "0x%lx" "belongsTo": "0x{:x}"
},)#", }},)#",
&d, d.wlrTabletTool ? d.wlrTabletTool->data : 0); (uintptr_t)&d, d.wlrTabletTool ? d.wlrTabletTool->data : 0);
} }
trimTrailingComma(result); trimTrailingComma(result);
@ -429,11 +428,11 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& d : g_pInputManager->m_lTouchDevices) { for (auto& d : g_pInputManager->m_lTouchDevices) {
result += getFormat( result += getFormat(
R"#( { R"#( {{
"address": "0x%lx", "address": "0x{:x}",
"name": "%s" "name": "{}"
},)#", }},)#",
&d, d.name.c_str()); (uintptr_t)&d, d.name.c_str());
} }
trimTrailingComma(result); trimTrailingComma(result);
@ -443,11 +442,11 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& d : g_pInputManager->m_lSwitches) { for (auto& d : g_pInputManager->m_lSwitches) {
result += getFormat( result += getFormat(
R"#( { R"#( {{
"address": "0x%lx", "address": "0x{:x}",
"name": "%s" "name": "{}"
},)#", }},)#",
&d, d.pWlrDevice ? d.pWlrDevice->name : ""); (uintptr_t)&d, d.pWlrDevice ? d.pWlrDevice->name : "");
} }
trimTrailingComma(result); trimTrailingComma(result);
@ -460,7 +459,7 @@ std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& m : g_pInputManager->m_lMice) { for (auto& m : g_pInputManager->m_lMice) {
result += getFormat( 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)); (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) { for (auto& k : g_pInputManager->m_lKeyboards) {
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k); 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, 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",
k.name.c_str(), k.currentRules.rules.c_str(), k.currentRules.model.c_str(), k.currentRules.layout.c_str(), k.currentRules.variant.c_str(), (uintptr_t)&k, k.name.c_str(), k.currentRules.rules.c_str(), k.currentRules.model.c_str(), k.currentRules.layout.c_str(),
k.currentRules.options.c_str(), KM.c_str(), (k.active ? "yes" : "no")); k.currentRules.variant.c_str(), k.currentRules.options.c_str(), KM.c_str(), (k.active ? "yes" : "no"));
} }
result += "\n\nTablets:\n"; result += "\n\nTablets:\n";
for (auto& d : g_pInputManager->m_lTabletPads) { 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) { 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) { 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"; result += "\n\nTouch:\n";
for (auto& d : g_pInputManager->m_lTouchDevices) { 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"; result += "\n\nSwitches:\n";
for (auto& d : g_pInputManager->m_lSwitches) { 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"; ret += "animations:\n";
for (auto& ac : g_pConfigManager->getAnimationConfig()) { 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()); ac.second.internalBezier.c_str(), ac.second.internalEnabled, ac.second.internalSpeed, ac.second.internalStyle.c_str());
} }
ret += "beziers:\n"; ret += "beziers:\n";
for (auto& bz : g_pAnimationManager->getAllBeziers()) { 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 { } else {
// json // json
@ -524,14 +523,14 @@ std::string animationsRequest(HyprCtl::eHyprCtlOutputFormat format) {
ret += "[["; ret += "[[";
for (auto& ac : g_pConfigManager->getAnimationConfig()) { for (auto& ac : g_pConfigManager->getAnimationConfig()) {
ret += getFormat(R"#( ret += getFormat(R"#(
{ {{
"name": "%s", "name": "{}",
"overridden": %s, "overridden": {},
"bezier": "%s", "bezier": "{}",
"enabled": %s, "enabled": {},
"speed": %.2f, "speed": {:.2f},
"style": "%s" "style": "{}"
},)#", }},)#",
ac.first.c_str(), ac.second.overridden ? "true" : "false", ac.second.internalBezier.c_str(), ac.second.internalEnabled ? "true" : "false", 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()); ac.second.internalSpeed, ac.second.internalStyle.c_str());
} }
@ -542,9 +541,9 @@ std::string animationsRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& bz : g_pAnimationManager->getAllBeziers()) { for (auto& bz : g_pAnimationManager->getAllBeziers()) {
ret += getFormat(R"#( ret += getFormat(R"#(
{ {{
"name": "%s" "name": "{}"
},)#", }},)#",
bz.first.c_str()); bz.first.c_str());
} }
@ -561,15 +560,15 @@ std::string globalShortcutsRequest(HyprCtl::eHyprCtlOutputFormat format) {
const auto SHORTCUTS = g_pProtocolManager->m_pGlobalShortcutsProtocolManager->getAllShortcuts(); const auto SHORTCUTS = g_pProtocolManager->m_pGlobalShortcutsProtocolManager->getAllShortcuts();
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) { if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
for (auto& sh : SHORTCUTS) 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 { } else {
ret += "["; ret += "[";
for (auto& sh : SHORTCUTS) { for (auto& sh : SHORTCUTS) {
ret += getFormat(R"#( ret += getFormat(R"#(
{ {{
"name": "%s", "name": "{}",
"description": "%s" "description": "{}"
},)#", }},)#",
escapeJSONStrings(sh.appid + ":" + sh.id).c_str(), escapeJSONStrings(sh.description).c_str()); escapeJSONStrings(sh.appid + ":" + sh.id).c_str(), escapeJSONStrings(sh.description).c_str());
} }
trimTrailingComma(ret); trimTrailingComma(ret);
@ -595,7 +594,7 @@ std::string bindsRequest(HyprCtl::eHyprCtlOutputFormat format) {
if (kb.nonConsuming) if (kb.nonConsuming)
ret += "n"; 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()); kb.handler.c_str(), kb.arg.c_str());
} }
} else { } else {
@ -604,19 +603,19 @@ std::string bindsRequest(HyprCtl::eHyprCtlOutputFormat format) {
for (auto& kb : g_pKeybindManager->m_lKeybinds) { for (auto& kb : g_pKeybindManager->m_lKeybinds) {
ret += getFormat( ret += getFormat(
R"#( R"#(
{ {{
"locked": %s, "locked": {},
"mouse": %s, "mouse": {},
"release": %s, "release": {},
"repeat": %s, "repeat": {},
"non_consuming": %s, "non_consuming": {},
"modmask": %u, "modmask": {},
"submap": "%s", "submap": "{}",
"key": "%s", "key": "{}",
"keycode": %i, "keycode": {},
"dispatcher": "%s", "dispatcher": "{}",
"arg": "%s" "arg": "{}"
},)#", }},)#",
kb.locked ? "true" : "false", kb.mouse ? "true" : "false", kb.release ? "true" : "false", kb.repeat ? "true" : "false", kb.nonConsuming ? "true" : "false", 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(), kb.modmask, escapeJSONStrings(kb.submap).c_str(), escapeJSONStrings(kb.key).c_str(), kb.keycode, escapeJSONStrings(kb.handler).c_str(),
escapeJSONStrings(kb.arg).c_str()); escapeJSONStrings(kb.arg).c_str());
@ -653,12 +652,12 @@ std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
return result; return result;
} else { } else {
std::string result = getFormat( std::string result = getFormat(
R"#({ R"#({{
"branch": "%s", "branch": "{}",
"commit": "%s", "commit": "{}",
"dirty": %s, "dirty": {},
"commit_message": "%s", "commit_message": "{}",
"tag": "%s", "tag": "{}",
"flags": [)#", "flags": [)#",
GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), escapeJSONStrings(commitMsg).c_str(), GIT_TAG); 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); 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"; 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 == "") if (retval == "")
return "ok"; return "ok";
@ -783,13 +782,13 @@ std::string cursorPosRequest(HyprCtl::eHyprCtlOutputFormat format) {
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal().floor(); const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal().floor();
if (format == HyprCtl::FORMAT_NORMAL) { if (format == HyprCtl::FORMAT_NORMAL) {
return getFormat("%i, %i", (int)CURSORPOS.x, (int)CURSORPOS.y); return getFormat("{}, {}", (int)CURSORPOS.x, (int)CURSORPOS.y);
} else { } else {
return getFormat(R"#( return getFormat(R"#(
{ {{
"x": %i, "x": {},
"y": %i "y": {}
} }}
)#", )#",
(int)CURSORPOS.x, (int)CURSORPOS.y); (int)CURSORPOS.x, (int)CURSORPOS.y);
} }
@ -1043,20 +1042,20 @@ std::string dispatchGetOption(std::string request, HyprCtl::eHyprCtlOutputFormat
return "no such option"; return "no such option";
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) 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(), return getFormat("option {}\n\tint: {}\n\tfloat: {:.5f}\n\tstr: \"{}\"\n\tdata: {:x}", curitem, PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue,
PCFGOPT->data.get()); (uintptr_t)PCFGOPT->data.get());
else { else {
return getFormat( return getFormat(
R"#( R"#(
{ {{
"option": "%s", "option": "{}",
"int": %lld, "int": {}
"float": %f, "float": {:.5f},
"str": "%s", "str": "{}",
"data": "0x%lx" "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 = ""; std::string list = "";
for (auto& p : PLUGINS) { 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(), 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->description.c_str()); p->version.c_str(), p->description.c_str());
} }
return list; return list;
@ -1338,7 +1337,7 @@ int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
try { try {
reply = getReply(request); reply = getReply(request);
} catch (std::exception& e) { } 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()); reply = "Err: " + std::string(e.what());
} }
@ -1376,7 +1375,7 @@ void HyprCtl::startHyprCtlSocket() {
// 10 max queued. // 10 max queued.
listen(iSocketFD, 10); 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); wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, iSocketFD, WL_EVENT_READABLE, hyprCtlFDTick, nullptr);
} }

View File

@ -132,7 +132,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 17; yOffset += 17;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset); 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_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents); cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) if (cairoExtents.width > maxX)
@ -143,7 +143,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 11; yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset); 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_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents); cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) if (cairoExtents.width > maxX)
@ -151,7 +151,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 11; yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset); 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_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents); cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) if (cairoExtents.width > maxX)
@ -159,7 +159,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 11; yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset); 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_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents); cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) if (cairoExtents.width > maxX)
@ -167,7 +167,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 11; yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset); 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_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents); cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) if (cairoExtents.width > maxX)

View File

@ -27,61 +27,3 @@ void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) {
if (!disableStdout) if (!disableStdout)
std::cout << output << "\n"; 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";
}

View File

@ -1,10 +1,16 @@
#pragma once #pragma once
#include <string> #include <string>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <format>
#include <iostream>
#include <fstream>
#include <chrono>
#include "../helpers/MiscFunctions.hpp"
#define LOGMESSAGESIZE 1024 #define LOGMESSAGESIZE 1024
enum LogLevel { enum LogLevel
{
NONE = -1, NONE = -1,
LOG = 0, LOG = 0,
WARN, WARN,
@ -15,13 +21,71 @@ enum LogLevel {
}; };
namespace Debug { 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 std::string logFile;
inline int64_t* disableLogs = nullptr; inline int64_t* disableLogs = nullptr;
inline int64_t* disableTime = nullptr; inline int64_t* disableTime = nullptr;
inline bool disableStdout = false; inline bool disableStdout = false;
inline bool trace = 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);
}; };

View File

@ -16,7 +16,7 @@ inline PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64v;
inline void loadGLProc(void* pProc, const char* name) { inline void loadGLProc(void* pProc, const char* name) {
void* proc = (void*)eglGetProcAddress(name); void* proc = (void*)eglGetProcAddress(name);
if (proc == NULL) { if (proc == NULL) {
Debug::log(CRIT, "[Tracy GPU Profiling] eglGetProcAddress(%s) failed", name); Debug::log(CRIT, "[Tracy GPU Profiling] eglGetProcAddress({}) failed", name);
abort(); abort();
} }
*(void**)pProc = proc; *(void**)pProc = proc;

View File

@ -19,7 +19,7 @@ void Events::listener_keyboardDestroy(void* owner, void* data) {
SKeyboard* PKEYBOARD = (SKeyboard*)owner; SKeyboard* PKEYBOARD = (SKeyboard*)owner;
g_pInputManager->destroyKeyboard(PKEYBOARD); 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) { void Events::listener_keyboardKey(void* owner, void* data) {
@ -63,30 +63,30 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
switch (DEVICE->type) { switch (DEVICE->type) {
case WLR_INPUT_DEVICE_KEYBOARD: 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); g_pInputManager->newKeyboard(DEVICE);
break; break;
case WLR_INPUT_DEVICE_POINTER: 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); g_pInputManager->newMouse(DEVICE);
break; break;
case WLR_INPUT_DEVICE_TOUCH: 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); g_pInputManager->newTouchDevice(DEVICE);
break; break;
case WLR_INPUT_DEVICE_TABLET_TOOL: 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); g_pInputManager->newTabletTool(DEVICE);
break; break;
case WLR_INPUT_DEVICE_TABLET_PAD: 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); g_pInputManager->newTabletPad(DEVICE);
break; break;
case WLR_INPUT_DEVICE_SWITCH: 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); g_pInputManager->newSwitch(DEVICE);
break; 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(); 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) { void Events::listener_newConstraint(wl_listener* listener, void* data) {
const auto PCONSTRAINT = (wlr_pointer_constraint_v1*)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(); g_pInputManager->m_lConstraints.emplace_back();
const auto CONSTRAINT = &g_pInputManager->m_lConstraints.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; 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); g_pInputManager->m_lConstraints.remove(*PCONSTRAINT);
} }

View File

@ -26,7 +26,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
return; 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; WLRLAYERSURFACE->output = PMONITOR->output;
} }
@ -55,14 +55,14 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
layerSurface->forceBlur = g_pConfigManager->shouldBlurLS(layerSurface->szNamespace); 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, Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)layerSurface->layerSurface, layerSurface->layerSurface->_namespace,
PMONITOR->szName.c_str()); (int)layerSurface->layer, PMONITOR->szName.c_str());
} }
void Events::listener_destroyLayerSurface(void* owner, void* data) { void Events::listener_destroyLayerSurface(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner; 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); 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) { void Events::listener_mapLayerSurface(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner; 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->mapped = true;
layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive; 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) { void Events::listener_unmapLayerSurface(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner; 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 : "")}); g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", std::string(layersurface->layerSurface->_namespace ? layersurface->layerSurface->_namespace : "")});
EMIT_HOOK_EVENT("closeLayer", layersurface); EMIT_HOOK_EVENT("closeLayer", layersurface);

View File

@ -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 XCBCONNECTION = xcb_connect(g_pXWaylandManager->m_sWLRXWayland->display_name, NULL);
const auto ERR = xcb_connection_has_error(XCBCONNECTION); const auto ERR = xcb_connection_has_error(XCBCONNECTION);
if (ERR) { 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; 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); xcb_intern_atom_reply_t* reply = xcb_intern_atom_reply(XCBCONNECTION, cookie, NULL);
if (!reply) { 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; continue;
} }
@ -98,14 +98,14 @@ void Events::listener_startDrag(wl_listener* listener, void* data) {
wlr_drag* wlrDrag = (wlr_drag*)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; wlrDrag->data = data;
g_pInputManager->m_sDrag.hyprListener_destroy.initCallback(&wlrDrag->events.destroy, &Events::listener_destroyDrag, &g_pInputManager->m_sDrag, "Drag"); g_pInputManager->m_sDrag.hyprListener_destroy.initCallback(&wlrDrag->events.destroy, &Events::listener_destroyDrag, &g_pInputManager->m_sDrag, "Drag");
if (wlrDrag->icon) { 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; g_pInputManager->m_sDrag.dragIcon = wlrDrag->icon;
wlrDrag->icon->data = g_pInputManager->m_sDrag.dragIcon; 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) { 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_pInputManager->refocus();
g_pCompositor->m_sSeat.exclusiveClient = g_pCompositor->m_sWLRInhibitMgr->active_client; 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) { 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 E = (wlr_gamma_control_manager_v1_set_gamma_event*)data;
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(E->output); const auto PMONITOR = g_pCompositor->getMonitorFromOutput(E->output);
if (!PMONITOR) { 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; return;
} }

View File

@ -179,14 +179,14 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
if (!pMonitor) if (!pMonitor)
return; 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->onDisconnect();
pMonitor->output = nullptr; pMonitor->output = nullptr;
pMonitor->m_bRenderingInitPassed = false; 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; }); std::erase_if(g_pCompositor->m_vRealMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; });
} }

View File

@ -70,8 +70,8 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) {
pHyprPopup->monitor = PMONITOR; 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, 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->ly); (float)pHyprPopup->lx, (float)pHyprPopup->ly);
} }
void Events::listener_newPopup(void* owner, void* data) { void Events::listener_newPopup(void* owner, void* data) {
@ -79,7 +79,7 @@ void Events::listener_newPopup(void* owner, void* data) {
ASSERT(layersurface); 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; const auto WLRPOPUP = (wlr_xdg_popup*)data;
@ -103,7 +103,7 @@ void Events::listener_newPopupXDG(void* owner, void* data) {
if (!PWINDOW->m_bIsMapped) if (!PWINDOW->m_bIsMapped)
return; 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; const auto WLRPOPUP = (wlr_xdg_popup*)data;
@ -125,9 +125,9 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) {
ASSERT(PPOPUP); ASSERT(PPOPUP);
if (PPOPUP->parentWindow) 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 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; const auto WLRPOPUP = (wlr_xdg_popup*)data;
@ -148,7 +148,7 @@ void Events::listener_mapPopupXDG(void* owner, void* data) {
ASSERT(PPOPUP); 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) if (PPOPUP->parentWindow)
PPOPUP->parentWindow->m_lPopupSurfaces.emplace_back(PPOPUP->popup->base->surface); 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) if (PPOPUP->monitor)
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(PPOPUP->popup->base->surface, PPOPUP->monitor->scale); 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) { void Events::listener_repositionPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner; 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; int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly); addPopupGlobalCoords(PPOPUP, &lx, &ly);
@ -242,7 +242,7 @@ void Events::listener_destroyPopupXDG(void* owner, void* data) {
ASSERT(PPOPUP); ASSERT(PPOPUP);
Debug::log(LOG, "Destroyed popup XDG %lx", PPOPUP); Debug::log(LOG, "Destroyed popup XDG {:x}", (uintptr_t)PPOPUP);
if (PPOPUP->pSurfaceTree) { if (PPOPUP->pSurfaceTree) {
SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree); SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree);

View File

@ -134,7 +134,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (PMONITOR) if (PMONITOR)
PWINDOW->m_iMonitorID = PMONITOR->ID; PWINDOW->m_iMonitorID = PMONITOR->ID;
else { 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; continue;
} }
} }
@ -148,8 +148,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
} }
PWINDOW->m_iWorkspaceID = PMONITOR->specialWorkspaceID ? PMONITOR->specialWorkspaceID : PMONITOR->activeWorkspace; 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); 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: %s -> %s | err: %s", r.szRule.c_str(), r.szValue.c_str(), e.what()); } } 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) { } else if (r.szRule.find("workspace") == 0) {
// check if it isnt unset // check if it isnt unset
const auto WORKSPACERQ = r.szRule.substr(r.szRule.find_first_of(' ') + 1); 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) if (JUSTWORKSPACE == PWORKSPACE->m_szName || JUSTWORKSPACE == "name:" + PWORKSPACE->m_szName)
requestedWorkspace = ""; 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) { } else if (r.szRule.find("float") == 0) {
PWINDOW->m_bIsFloating = true; PWINDOW->m_bIsFloating = true;
} else if (r.szRule.find("tile") == 0) { } else if (r.szRule.find("tile") == 0) {
@ -210,7 +210,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
} else if (IDLERULE == "fullscreen") { } else if (IDLERULE == "fullscreen") {
PWINDOW->m_eIdleInhibitMode = IDLEINHIBIT_FULLSCREEN; PWINDOW->m_eIdleInhibitMode = IDLEINHIBIT_FULLSCREEN;
} else { } 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); PWINDOW->applyDynamicRule(r);
@ -283,13 +283,13 @@ void Events::listener_mapWindow(void* owner, void* data) {
std::clamp(MAXSIZE.y, 20.0, PMONITOR->vecSize.y) : 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); (!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); PWINDOW->m_vRealSize = Vector2D(SIZEX, SIZEY);
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv()); g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
PWINDOW->setHidden(false); 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) { } else if (r.szRule.find("minsize") == 0) {
try { try {
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1); 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()); g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
PWINDOW->setHidden(false); 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) { } else if (r.szRule.find("maxsize") == 0) {
try { try {
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1); 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()); g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
PWINDOW->setHidden(false); 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) { } else if (r.szRule.find("move") == 0) {
try { try {
auto value = r.szRule.substr(r.szRule.find(' ') + 1); 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->m_vRealPosition = Vector2D(posX, posY) + PMONITOR->vecPosition;
PWINDOW->setHidden(false); 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) { } else if (r.szRule.find("center") == 0) {
auto RESERVEDOFFSET = Vector2D(); auto RESERVEDOFFSET = Vector2D();
const auto ARGS = CVarList(r.szRule, 2, ' '); const auto ARGS = CVarList(r.szRule, 2, ' ');
@ -426,7 +426,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_fDimPercent.setValueAndWarp(0); 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) { if (!PWINDOW->m_bIsX11) {
PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xdg->surface->events.commit, &Events::listener_commitWindow, PWINDOW, "XDG Window Late"); 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; 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, Debug::log(LOG, "Map request dispatched, monitor {}, xywh: {:.5f} {:.5f} {:.5f} {:.5f}", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x,
PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y); PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName; auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName;
g_pEventManager->postEvent( g_pEventManager->postEvent(SHyprIPCEvent{
SHyprIPCEvent{"openwindow", getFormat("%lx,%s,%s,%s", PWINDOW, workspaceID.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())}); "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); EMIT_HOOK_EVENT("openWindow", PWINDOW);
// recalc the values for this window // 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) { void Events::listener_unmapWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner; 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) { 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; PWINDOW->m_bFadingOut = false;
return; return;
} }
g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", getFormat("%lx", PWINDOW)}); g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", getFormat("{:x}", (uintptr_t)PWINDOW)});
EMIT_HOOK_EVENT("closeWindow", PWINDOW); EMIT_HOOK_EVENT("closeWindow", PWINDOW);
g_pProtocolManager->m_pToplevelExportProtocolManager->onWindowUnmap(PWINDOW); g_pProtocolManager->m_pToplevelExportProtocolManager->onWindowUnmap(PWINDOW);
@ -669,7 +669,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
if (wasLastWindow) { if (wasLastWindow) {
const auto PWINDOWCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW); 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 != g_pCompositor->m_pLastWindow) {
if (!PWINDOWCANDIDATE) 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, "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); SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
PWINDOW->m_pSurfaceTree = nullptr; PWINDOW->m_pSurfaceTree = nullptr;
@ -750,10 +750,10 @@ void Events::listener_commitWindow(void* owner, void* data) {
void Events::listener_destroyWindow(void* owner, void* data) { void Events::listener_destroyWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner; 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) 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) { if (PWINDOW == g_pCompositor->m_pLastWindow) {
g_pCompositor->m_pLastWindow = nullptr; g_pCompositor->m_pLastWindow = nullptr;
@ -771,7 +771,7 @@ void Events::listener_destroyWindow(void* owner, void* data) {
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW); g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
if (PWINDOW->m_pSurfaceTree) { 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); SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
PWINDOW->m_pSurfaceTree = nullptr; PWINDOW->m_pSurfaceTree = nullptr;
} }
@ -780,7 +780,7 @@ void Events::listener_destroyWindow(void* owner, void* data) {
if (!PWINDOW->m_bFadingOut) { if (!PWINDOW->m_bFadingOut) {
g_pCompositor->removeWindowFromVectorSafe(PWINDOW); // most likely X11 unmanaged or sumn 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; return;
PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW); 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); EMIT_HOOK_EVENT("windowTitle", PWINDOW);
if (PWINDOW == g_pCompositor->m_pLastWindow) { // if it's the active, let's post an event to update others 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{"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); EMIT_HOOK_EVENT("activeWindow", PWINDOW);
} }
@ -804,7 +804,7 @@ void Events::listener_setTitleWindow(void* owner, void* data) {
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW); g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
PWINDOW->updateToplevel(); 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) { void Events::listener_fullscreenWindow(void* owner, void* data) {
@ -863,7 +863,7 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
PWINDOW->updateToplevel(); 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) { 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; 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)) if (!wlr_xdg_surface_try_from_wlr_surface(E->surface))
return; return;
@ -881,7 +881,7 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) {
if (!PWINDOW || PWINDOW == g_pCompositor->m_pLastWindow) if (!PWINDOW || PWINDOW == g_pCompositor->m_pLastWindow)
return; return;
g_pEventManager->postEvent(SHyprIPCEvent{"urgent", getFormat("%lx", PWINDOW)}); g_pEventManager->postEvent(SHyprIPCEvent{"urgent", getFormat("{:x}", (uintptr_t)PWINDOW)});
EMIT_HOOK_EVENT("urgent", PWINDOW); EMIT_HOOK_EVENT("urgent", PWINDOW);
PWINDOW->m_bIsUrgent = true; 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; 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) { 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()) if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->getPID() != PWINDOW->getPID())
return; return;
@ -918,7 +918,7 @@ void Events::listener_activateX11(void* owner, void* data) {
if (PWINDOW == g_pCompositor->m_pLastWindow) if (PWINDOW == g_pCompositor->m_pLastWindow)
return; return;
g_pEventManager->postEvent(SHyprIPCEvent{"urgent", getFormat("%lx", PWINDOW)}); g_pEventManager->postEvent(SHyprIPCEvent{"urgent", getFormat("{:x}", (uintptr_t)PWINDOW)});
EMIT_HOOK_EVENT("urgent", PWINDOW); EMIT_HOOK_EVENT("urgent", PWINDOW);
if (!*PFOCUSONACTIVATE) 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 || 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) { 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, Debug::log(LOG, "Unmanaged window {:x} requests geometry update to {} {} {} {}", (uintptr_t)PWINDOW, (int)LOGICALPOS.x, (int)LOGICALPOS.y,
(int)PWINDOW->m_uSurface.xwayland->height); (int)PWINDOW->m_uSurface.xwayland->width, (int)PWINDOW->m_uSurface.xwayland->height);
g_pHyprRenderer->damageWindow(PWINDOW); g_pHyprRenderer->damageWindow(PWINDOW);
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(LOGICALPOS.x, LOGICALPOS.y)); 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) { void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
const auto XWSURFACE = (wlr_xwayland_surface*)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) 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(); 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) if (XDGSURFACE->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL)
return; 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(); const auto PNEWWINDOW = g_pCompositor->m_vWindows.emplace_back(std::make_unique<CWindow>()).get();
PNEWWINDOW->m_uSurface.xdg = XDGSURFACE; PNEWWINDOW->m_uSurface.xdg = XDGSURFACE;
@ -1106,7 +1106,7 @@ void Events::listener_requestMaximize(void* owner, void* data) {
if (PWINDOW->m_bNoMaximizeRequest) if (PWINDOW->m_bNoMaximizeRequest)
return; return;
Debug::log(LOG, "Maximize request for %lx", PWINDOW); Debug::log(LOG, "Maximize request for {:x}", (uintptr_t)PWINDOW);
if (!PWINDOW->m_bIsX11) { if (!PWINDOW->m_bIsX11) {
const auto EV = (wlr_foreign_toplevel_handle_v1_maximized_event*)data; 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) { void Events::listener_requestMinimize(void* owner, void* data) {
const auto PWINDOW = (CWindow*)owner; 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_bIsX11) {
if (!PWINDOW->m_bMappedX11 || PWINDOW->m_iX11Type != 1) 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; 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})); 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 wlr_xwayland_surface_set_minimized(PWINDOW->m_uSurface.xwayland, E->minimize && g_pCompositor->m_pLastWindow != PWINDOW); // fucking DXVK
} else { } else {
const auto E = (wlr_foreign_toplevel_handle_v1_minimized_event*)data; 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)})); EMIT_HOOK_EVENT("minimize", (std::vector<void*>{PWINDOW, (void*)(E ? (uint64_t)E->minimized : 1)}));
} }
} }

View File

@ -41,8 +41,8 @@ void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, SAnimationPro
default: ASSERT(false); break; default: ASSERT(false); break;
} }
} catch (std::exception& e) { } catch (std::exception& e) {
Debug::log(ERR, "CAnimatedVariable create error: %s", e.what()); Debug::log(ERR, "CAnimatedVariable create error: {}", e.what());
RASSERT(false, "CAnimatedVariable create error: %s", e.what()); RASSERT(false, "CAnimatedVariable create error: {}", e.what());
} }
} }

View File

@ -18,7 +18,7 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
m_dPoints.emplace_back(Vector2D(1, 1)); 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 // bake BAKEDPOINTS points for faster lookups
// T -> X ( / BAKEDPOINTS ) // T -> X ( / BAKEDPOINTS )
@ -34,8 +34,8 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
getYForPoint(i); getYForPoint(i);
const auto ELAPSEDCALCAVG = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGINCALC).count() / 1000.f / 10.f; 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, 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,
ELAPSEDCALCAVG); ELAPSEDUS, ELAPSEDCALCAVG);
} }
float CBezierCurve::getYForT(float t) { float CBezierCurve::getYForT(float t) {

View File

@ -151,27 +151,13 @@ void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, const
wl_signal_add(pSignal, pListener); 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) { void handleNoop(struct wl_listener* listener, void* data) {
// Do nothing // 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::string escapeJSONStrings(const std::string& str) {
std::ostringstream oss; std::ostringstream oss;
for (auto& c : str) { for (auto& c : str) {
@ -224,7 +210,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
try { try {
return relative + stof(source); return relative + stof(source);
} catch (...) { } 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; return INT_MAX;
} }
} }
@ -539,10 +525,10 @@ void logSystemInfo() {
uname(&unameInfo); uname(&unameInfo);
Debug::log(LOG, "System name: %s", unameInfo.sysname); Debug::log(LOG, "System name: {}", unameInfo.sysname);
Debug::log(LOG, "Node name: %s", unameInfo.nodename); Debug::log(LOG, "Node name: {}", unameInfo.nodename);
Debug::log(LOG, "Release: %s", unameInfo.release); Debug::log(LOG, "Release: {}", unameInfo.release);
Debug::log(LOG, "Version: %s", unameInfo.version); Debug::log(LOG, "Version: {}", unameInfo.version);
Debug::log(NONE, "\n"); Debug::log(NONE, "\n");
@ -551,7 +537,7 @@ void logSystemInfo() {
#else #else
const std::string GPUINFO = execAndGet("lspci -vnn | grep VGA"); const std::string GPUINFO = execAndGet("lspci -vnn | grep VGA");
#endif #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")) { 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"); 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 // log etc
Debug::log(LOG, "os-release:"); 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) { 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); const auto VALUEWITHOUTFUNC = VALUE.substr(5, VALUE.length() - 6);
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 8) { 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)"); 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); const auto VALUEWITHOUTFUNC = VALUE.substr(4, VALUE.length() - 5);
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 6) { 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)"); 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) { 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); throw std::runtime_error(err);
} }
std::string sendToLog(uint8_t level, const std::string& s) {
Debug::log((LogLevel)level, s);
}

View File

@ -5,6 +5,7 @@
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include "Vector2D.hpp" #include "Vector2D.hpp"
#include <vector> #include <vector>
#include <format>
struct SCallstackFrameInfo { struct SCallstackFrameInfo {
void* adr = nullptr; void* adr = nullptr;
@ -13,7 +14,6 @@ struct SCallstackFrameInfo {
std::string absolutePath(const std::string&, const std::string&); std::string absolutePath(const std::string&, const std::string&);
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, const std::string& ownerString); 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); std::string escapeJSONStrings(const std::string& str);
void scaleBox(wlr_box*, float); void scaleBox(wlr_box*, float);
std::string removeBeginEndSpacesTabs(std::string); std::string removeBeginEndSpacesTabs(std::string);
@ -30,4 +30,28 @@ void matrixProjection(float mat[9], int w, int h, wl
double normalizeAngleRad(double ang); double normalizeAngleRad(double ang);
std::string replaceInString(std::string subject, const std::string& search, const std::string& replace); std::string replaceInString(std::string subject, const std::string& search, const std::string& replace);
std::vector<SCallstackFrameInfo> getBacktrace(); std::vector<SCallstackFrameInfo> getBacktrace();
void throwError(const std::string& err); 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;
}

View File

@ -79,12 +79,12 @@ void CMonitor::onConnect(bool noRule) {
if (PREFSTATE) if (PREFSTATE)
wlr_output_set_mode(output, PREFSTATE); wlr_output_set_mode(output, PREFSTATE);
else 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); wlr_output_enable(output, 0);
if (!wlr_output_commit(output)) 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); Events::listener_change(nullptr, nullptr);
@ -136,8 +136,8 @@ void CMonitor::onConnect(bool noRule) {
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, scale); 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, 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, output); (int)vecPixelSize.y, (uintptr_t)output);
setupDefaultWS(monitorRule); setupDefaultWS(monitorRule);
@ -197,7 +197,7 @@ void CMonitor::onDisconnect() {
if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown) if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown)
return; 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. // Cleanup everything. Move windows back, snap cursor, shit.
CMonitor* BACKUPMON = nullptr; CMonitor* BACKUPMON = nullptr;
@ -239,7 +239,7 @@ void CMonitor::onDisconnect() {
m_aLayerSurfaceLayers[i].clear(); 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}); g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
EMIT_HOOK_EVENT("monitorRemoved", this); EMIT_HOOK_EVENT("monitorRemoved", this);
@ -356,12 +356,12 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1; WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1;
newDefaultWorkspaceName = std::to_string(WORKSPACEID); 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); 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) { if (PNEWWORKSPACE) {
// workspace exists, move it to the newly connected monitor // 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 (pWorkspace->m_bIsSpecialWorkspace) {
if (specialWorkspaceID != pWorkspace->m_iID) { 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); g_pKeybindManager->m_mDispatchers["togglespecialworkspace"](pWorkspace->m_szName == "special" ? "" : pWorkspace->m_szName);
} }
return; return;

View File

@ -55,7 +55,7 @@ SSurfaceTreeNode* createSubsurfaceNode(SSurfaceTreeNode* pParent, SSubsurface* p
PNODE->pParent = pParent; PNODE->pParent = pParent;
PNODE->pSubsurface = pSubsurface; 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; return PNODE;
} }
@ -63,7 +63,7 @@ SSurfaceTreeNode* createSubsurfaceNode(SSurfaceTreeNode* pParent, SSubsurface* p
SSurfaceTreeNode* SubsurfaceTree::createTreeRoot(wlr_surface* pSurface, applyGlobalOffsetFn fn, void* data, CWindow* pWindow) { SSurfaceTreeNode* SubsurfaceTree::createTreeRoot(wlr_surface* pSurface, applyGlobalOffsetFn fn, void* data, CWindow* pWindow) {
const auto PNODE = createTree(pSurface, 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->offsetfn = fn;
PNODE->globalOffsetData = data; PNODE->globalOffsetData = data;
@ -83,7 +83,7 @@ void SubsurfaceTree::destroySurfaceTree(SSurfaceTreeNode* pNode) {
} }
if (!exists) { 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; return;
} }
@ -145,7 +145,7 @@ void Events::listener_newSubsurfaceNode(void* owner, void* data) {
const auto PNEWSUBSURFACE = &pNode->childSubsurfaces.emplace_back(); 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->pSubsurface = PSUBSURFACE;
PNEWSUBSURFACE->pParent = pNode; PNEWSUBSURFACE->pParent = pNode;
@ -174,7 +174,7 @@ void Events::listener_mapSubsurface(void* owner, void* data) {
if (subsurface->pChild) if (subsurface->pChild)
return; 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); 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) { void Events::listener_unmapSubsurface(void* owner, void* data) {
SSubsurface* subsurface = (SSubsurface*)owner; 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) if (subsurface->pSubsurface->surface == g_pCompositor->m_pLastFocus)
g_pInputManager->releaseAllMouseButtons(); g_pInputManager->releaseAllMouseButtons();
@ -221,7 +221,7 @@ void Events::listener_commitSubsurface(void* owner, void* data) {
if (!g_pHyprRenderer->shouldRenderWindow(pNode->pWindowOwner)) { if (!g_pHyprRenderer->shouldRenderWindow(pNode->pWindowOwner)) {
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue; static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE) 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; return;
} }
@ -254,7 +254,7 @@ void Events::listener_destroySubsurface(void* owner, void* data) {
SubsurfaceTree::destroySurfaceTree(subsurface->pChild); 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_destroy.removeCallback();
subsurface->hyprListener_map.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) { void Events::listener_destroySubsurfaceNode(void* owner, void* data) {
SSurfaceTreeNode* pNode = (SSurfaceTreeNode*)owner; 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) for (auto& c : pNode->childSubsurfaces)
destroySubsurface(&c); destroySubsurface(&c);

View File

@ -25,7 +25,7 @@ CHyprWLListener::~CHyprWLListener() {
void CHyprWLListener::removeCallback() { void CHyprWLListener::removeCallback() {
if (isConnected()) { 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_remove(&m_swWrapper.m_sListener.link);
wl_list_init(&m_swWrapper.m_sListener.link); wl_list_init(&m_swWrapper.m_sListener.link);
} }

View File

@ -39,7 +39,7 @@ void CWLSurface::destroy() {
m_pWLRSurface = nullptr; m_pWLRSurface = nullptr;
Debug::log(LOG, "CWLSurface %lx called destroy()", this); Debug::log(LOG, "CWLSurface {:x} called destroy()", (uintptr_t)this);
} }
void CWLSurface::init() { void CWLSurface::init() {
@ -53,5 +53,5 @@ void CWLSurface::init() {
hyprListener_destroy.initCallback( hyprListener_destroy.initCallback(
&m_pWLRSurface->events.destroy, [&](void* owner, void* data) { destroy(); }, this, "CWLSurface"); &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);
} }

View File

@ -31,7 +31,7 @@ CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
CWorkspace::~CWorkspace() { CWorkspace::~CWorkspace() {
m_vRenderOffset.unregister(); 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}); g_pEventManager->postEvent({"destroyworkspace", m_szName});
EMIT_HOOK_EVENT("destroyWorkspace", this); EMIT_HOOK_EVENT("destroyWorkspace", this);

View File

@ -104,7 +104,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
} }
if (!PMONITOR) { 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; return;
} }
@ -129,7 +129,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT); auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
if (!g_pCompositor->windowExists(PWINDOW) || !PWINDOW->m_bIsMapped) { 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); onWindowRemovedTiling(PWINDOW);
return; return;
} }
@ -270,7 +270,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
} else } else
OPENINGON = getFirstNodeOnWorkspace(pWindow->m_iWorkspaceID); 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) { if (OPENINGON && OPENINGON->workspaceID != PNODE->workspaceID) {
// special workspace handling // special workspace handling

View File

@ -89,7 +89,7 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue;
if (!PMONITOR) { 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; return;
} }
@ -402,7 +402,7 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
const auto TILED = isWindowTiled(pWindow); const auto TILED = isWindowTiled(pWindow);
// event // 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); EMIT_HOOK_EVENT("changeFloatingMode", pWindow);
if (!TILED) { if (!TILED) {

View File

@ -484,7 +484,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
} }
if (!PMONITOR) { 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; return;
} }
@ -509,7 +509,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT); auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
if (!g_pCompositor->windowValidMapped(PWINDOW)) { 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; return;
} }

View File

@ -53,18 +53,14 @@
#define HYPRATOM(name) \ #define HYPRATOM(name) \
{ name, 0 } { name, 0 }
#ifndef __INTELLISENSE__
#define RASSERT(expr, reason, ...) \ #define RASSERT(expr, reason, ...) \
if (!(expr)) { \ if (!(expr)) { \
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", \ Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \
getFormat(reason, ##__VA_ARGS__).c_str(), __LINE__, \ getFormat(reason, ##__VA_ARGS__), __LINE__, \
([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \ ([]() 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."); \ printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
raise(SIGABRT); \ raise(SIGABRT); \
} }
#else
#define RASSERT(expr, reason, ...)
#endif
#define ASSERT(expr) RASSERT(expr, "?") #define ASSERT(expr) RASSERT(expr, "?")

View File

@ -62,7 +62,7 @@ int main(int argc, char** argv) {
} }
configPath = next_arg; 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++; it++;

View File

@ -42,7 +42,7 @@ int fdHandleWrite(int fd, uint32_t mask, void* data) {
int availableBytes; int availableBytes;
if (ioctl(fd, FIONREAD, &availableBytes) == -1) { 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); removeFD(fd);
return 0; return 0;
} }
@ -50,7 +50,7 @@ int fdHandleWrite(int fd, uint32_t mask, void* data) {
char buf[availableBytes]; char buf[availableBytes];
const auto RECEIVED = recv(fd, buf, availableBytes, 0); const auto RECEIVED = recv(fd, buf, availableBytes, 0);
if (RECEIVED == -1) { if (RECEIVED == -1) {
Debug::log(ERR, "fd %d sent invalid data (2)", fd); Debug::log(ERR, "fd {} sent invalid data (2)", fd);
removeFD(fd); removeFD(fd);
return 0; return 0;
} }
@ -79,7 +79,7 @@ void CEventManager::startThread() {
sockaddr_in clientAddress; sockaddr_in clientAddress;
socklen_t clientSize = sizeof(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) { while (1) {
const auto ACCEPTEDCONNECTION = accept4(SOCKET, (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC); const auto ACCEPTEDCONNECTION = accept4(SOCKET, (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC);
@ -90,7 +90,7 @@ void CEventManager::startThread() {
int flagsNew = fcntl(ACCEPTEDCONNECTION, F_GETFL, 0); int flagsNew = fcntl(ACCEPTEDCONNECTION, F_GETFL, 0);
fcntl(ACCEPTEDCONNECTION, F_SETFL, flagsNew | O_NONBLOCK); 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 // add to event loop so we can close it when we need to
m_dAcceptedSocketFDs.push_back( m_dAcceptedSocketFDs.push_back(
@ -124,7 +124,7 @@ void CEventManager::flushEvents() {
void CEventManager::postEvent(const SHyprIPCEvent event) { void CEventManager::postEvent(const SHyprIPCEvent event) {
if (g_pCompositor->m_bIsShuttingDown) { 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; return;
} }

View File

@ -57,7 +57,7 @@ void CHookSystemManager::emit(const std::vector<SCallbackFNPtr>* callbacks, std:
} catch (std::exception& e) { } catch (std::exception& e) {
// TODO: this works only once...? // TODO: this works only once...?
faultyHandles.push_back(cb.handle); 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()) if (IT != m_lpRegisteredHooks.end())
return &IT->second; 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; return &m_lpRegisteredHooks.emplace_back(std::make_pair<>(event, std::vector<SCallbackFNPtr>{})).second;
} }

View File

@ -153,7 +153,7 @@ void CKeybindManager::updateXKBTranslationState() {
", layout: " + LAYOUT + " )", ", layout: " + LAYOUT + " )",
CColor(1.0, 50.0 / 255.0, 50.0 / 255.0, 1.0)); 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); rules.rules, rules.model, rules.options);
memset(&rules, 0, sizeof(rules)); 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 // Should never happen, as we check in the ConfigManager, but oh well
if (DISPATCHER == m_mDispatchers.end()) { 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 { } else {
// call the dispatcher // 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; m_iPassPressed = (int)pressed;
@ -533,7 +533,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
if (ttynum == TTY) if (ttynum == TTY)
return true; 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)) if (!wlr_session_change_vt(g_pCompositor->m_sWLRSession, TTY))
return true; // probably same session return true; // probably same session
@ -545,7 +545,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
m->framesToSkip = 1; 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; return true;
} }
@ -598,12 +598,12 @@ void CKeybindManager::spawn(std::string args) {
g_pConfigManager->addExecRule({r, (unsigned long)PROC}); 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) { 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]; int socket[2];
if (pipe(socket) != 0) { if (pipe(socket) != 0) {
@ -651,7 +651,7 @@ uint64_t CKeybindManager::spawnRaw(std::string args) {
return 0; return 0;
} }
Debug::log(LOG, "Process Created with pid %d", grandchild); Debug::log(LOG, "Process Created with pid {}", grandchild);
return grandchild; return grandchild;
} }
@ -976,7 +976,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
char arg = args[0]; char arg = args[0];
if (!isDirection(args)) { 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; return;
} }
@ -1028,7 +1028,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
return; 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))) if (tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg)))
return; return;
@ -1037,7 +1037,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
if (*PNOFALLBACK) if (*PNOFALLBACK)
return; 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); const auto PWINDOWNEXT = g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true);
if (PWINDOWNEXT) if (PWINDOWNEXT)
@ -1119,11 +1119,11 @@ void CKeybindManager::swapActive(std::string args) {
char arg = args[0]; char arg = args[0];
if (!isDirection(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; 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; const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen) if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
return; return;
@ -1149,7 +1149,7 @@ void CKeybindManager::moveActiveTo(std::string args) {
} }
if (!isDirection(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; return;
} }
@ -1415,7 +1415,7 @@ void CKeybindManager::workspaceOpt(std::string args) {
} }
} }
} else { } 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; return;
} }
@ -1434,7 +1434,7 @@ void CKeybindManager::renameWorkspace(std::string args) {
g_pCompositor->renameWorkspace(std::stoi(args), ""); g_pCompositor->renameWorkspace(std::stoi(args), "");
} }
} catch (std::exception& e) { } 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) { if (requestedWorkspaceIsAlreadyOpen && specialOpenOnMonitor == workspaceID) {
// already open on this monitor // 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); PMONITOR->setSpecialWorkspace(nullptr);
} else { } 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); auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceID);
if (!PSPECIALWORKSPACE) if (!PSPECIALWORKSPACE)
@ -1661,7 +1661,7 @@ void CKeybindManager::focusWindow(std::string regexp) {
if (!PWINDOW) if (!PWINDOW)
return; 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) { if (g_pCompositor->m_pLastMonitor->activeWorkspace != PWINDOW->m_iWorkspaceID) {
Debug::log(LOG, "Fake executing workspace to move focus"); 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) { for (auto& k : g_pKeybindManager->m_lKeybinds) {
if (k.submap == submap) { if (k.submap == submap) {
m_szCurrentSelectedSubmap = 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}); g_pEventManager->postEvent(SHyprIPCEvent{"submap", submap});
EMIT_HOOK_EVENT("submap", m_szCurrentSelectedSubmap); EMIT_HOOK_EVENT("submap", m_szCurrentSelectedSubmap);
return; 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) { void CKeybindManager::pass(std::string regexp) {
@ -1816,7 +1816,7 @@ void CKeybindManager::dpms(std::string arg) {
m->dpmsStatus = enable; m->dpmsStatus = enable;
if (!wlr_output_commit(m->output)) { 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) if (enable)
@ -2014,7 +2014,7 @@ void CKeybindManager::moveIntoGroup(std::string args) {
static auto* const GROUPLOCKCHECK = &g_pConfigManager->getConfigValuePtr("misc:moveintogroup_lock_check")->intValue; static auto* const GROUPLOCKCHECK = &g_pConfigManager->getConfigValuePtr("misc:moveintogroup_lock_check")->intValue;
if (!isDirection(args)) { 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; return;
} }

View File

@ -31,7 +31,7 @@ bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) {
m_vLayouts.emplace_back(std::make_pair<>(name, 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; return true;
} }
@ -45,7 +45,7 @@ bool CLayoutManager::removeLayout(IHyprLayout* layout) {
if (m_iCurrentLayoutID == IT - m_vLayouts.begin()) if (m_iCurrentLayoutID == IT - m_vLayouts.begin())
switchToLayout("dwindle"); 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); std::erase(m_vLayouts, *IT);

View File

@ -4,7 +4,7 @@
static void handleSurfaceMap(void* owner, void* data) { static void handleSurfaceMap(void* owner, void* data) {
const auto PSURFACE = (SSessionLockSurface*)owner; const auto PSURFACE = (SSessionLockSurface*)owner;
Debug::log(LOG, "SessionLockSurface %lx mapped", PSURFACE); Debug::log(LOG, "SessionLockSurface {:x} mapped", (uintptr_t)PSURFACE);
PSURFACE->mapped = true; PSURFACE->mapped = true;
@ -30,7 +30,7 @@ static void handleSurfaceCommit(void* owner, void* data) {
static void handleSurfaceDestroy(void* owner, void* data) { static void handleSurfaceDestroy(void* owner, void* data) {
const auto PSURFACE = (SSessionLockSurface*)owner; 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_commit.removeCallback();
PSURFACE->hyprListener_destroy.removeCallback(); PSURFACE->hyprListener_destroy.removeCallback();
@ -52,7 +52,7 @@ void CSessionLockManager::onNewSessionLock(wlr_session_lock_v1* pWlrLock) {
return; 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; m_sSessionLock.pWlrLock = pWlrLock;

View File

@ -21,7 +21,7 @@ CHyprXWaylandManager::CHyprXWaylandManager() {
setenv("DISPLAY", m_sWLRXWayland->display_name, 1); 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 #else
unsetenv("DISPLAY"); // unset DISPLAY so that X11 apps do not try to start on a different/invalid DISPLAY unsetenv("DISPLAY"); // unset DISPLAY so that X11 apps do not try to start on a different/invalid DISPLAY
#endif #endif
@ -129,7 +129,7 @@ std::string CHyprXWaylandManager::getAppIDClass(CWindow* pWindow) {
} }
} else } else
return ""; 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 ""; return "";
} }
@ -223,7 +223,7 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
if (winrole.contains("pop-up") || winrole.contains("task_dialog")) { if (winrole.contains("pop-up") || winrole.contains("task_dialog")) {
return true; 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) { if (pWindow->m_uSurface.xwayland->modal) {

View File

@ -33,7 +33,7 @@ void CInputManager::newIdleInhibitor(wlr_idle_inhibitor_v1* pInhibitor) {
PINHIBIT->pWindow = g_pCompositor->getWindowFromSurface(pInhibitor->surface); PINHIBIT->pWindow = g_pCompositor->getWindowFromSurface(pInhibitor->surface);
if (PINHIBIT->pWindow) 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(); recheckIdleInhibitorStatus();
} }

View File

@ -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)); 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) { 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)); 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() { void CInputManager::setKeyboardLayout() {
@ -743,7 +743,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname); 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); ASSERT(pKeyboard);
@ -800,7 +800,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
return; 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); rules.options);
xkb_keymap* KEYMAP = NULL; 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 + g_pConfigManager->addParseError("Invalid keyboard layout passed. ( rules: " + RULES + ", model: " + MODEL + ", variant: " + VARIANT + ", options: " + OPTIONS +
", layout: " + LAYOUT + " )"); ", 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); rules.options);
memset(&rules, 0, sizeof(rules)); memset(&rules, 0, sizeof(rules));
@ -859,7 +859,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->name + "," + LAYOUTSTR}); g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->name + "," + LAYOUTSTR});
EMIT_HOOK_EVENT("activeLayout", (std::vector<void*>{pKeyboard, (void*)&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) { 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)) { if (wlr_input_device_is_libinput(mouse)) {
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(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), 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), libinput_device_config_accel_get_profile(LIBINPUTDEV), libinput_device_config_accel_get_default_speed(LIBINPUTDEV), (int)libinput_device_config_accel_get_profile(LIBINPUTDEV),
libinput_device_config_accel_get_default_profile(LIBINPUTDEV)); (int)libinput_device_config_accel_get_default_profile(LIBINPUTDEV));
} }
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse); 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(); 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() { 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); 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"); 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) { void CInputManager::warpMouseToConstraintMiddle(SConstraint* pConstraint) {
@ -1373,7 +1373,7 @@ void CInputManager::newTouchDevice(wlr_input_device* pDevice) {
setTouchDeviceConfigs(PNEWDEV); setTouchDeviceConfigs(PNEWDEV);
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, pDevice); 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( PNEWDEV->hyprListener_destroy.initCallback(
&pDevice->events.destroy, [&](void* owner, void* data) { destroyTouchDevice((STouchDevice*)data); }, PNEWDEV, "TouchDevice"); &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 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); 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]); 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"); 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) { 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); m_lTouchDevices.remove(*pDevice);
} }
@ -1443,7 +1443,7 @@ void CInputManager::newSwitch(wlr_input_device* pDevice) {
const auto PNEWDEV = &m_lSwitches.emplace_back(); const auto PNEWDEV = &m_lSwitches.emplace_back();
PNEWDEV->pWlrDevice = pDevice; 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( PNEWDEV->hyprListener_destroy.initCallback(
&pDevice->events.destroy, [&](void* owner, void* data) { destroySwitch((SSwitchDevice*)owner); }, PNEWDEV, "SwitchDevice"); &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) if (PDEVICE->status != -1 && PDEVICE->status == E->switch_state)
return; 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); g_pKeybindManager->onSwitchEvent(NAME);
switch (E->switch_state) { switch (E->switch_state) {
case WLR_SWITCH_STATE_ON: 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); g_pKeybindManager->onSwitchOnEvent(NAME);
break; break;
case WLR_SWITCH_STATE_OFF: 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); g_pKeybindManager->onSwitchOffEvent(NAME);
break; break;
} }

View File

@ -25,7 +25,7 @@ void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) {
void CInputManager::beginWorkspaceSwipe() { void CInputManager::beginWorkspaceSwipe() {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); 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.pWorkspaceBegin = PWORKSPACE;
m_sActiveSwipe.delta = 0; m_sActiveSwipe.delta = 0;

View File

@ -147,7 +147,7 @@ STabletTool* CInputManager::ensureTabletToolPresent(wlr_tablet_tool* pTool) {
if (pTool->data == nullptr) { if (pTool->data == nullptr) {
const auto PTOOL = &m_lTabletTools.emplace_back(); 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->wlrTabletTool = pTool;
pTool->data = PTOOL; pTool->data = PTOOL;

View File

@ -305,7 +305,7 @@ APICALL std::vector<SFunctionMatch> HyprlandAPI::findFunctionsByName(HANDLE hand
}; };
if (SYMBOLS.empty()) { 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__ #ifdef __clang__
"llvm-nm" "llvm-nm"
#else #else

View File

@ -22,7 +22,7 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
HANDLE MODULE = dlopen(path.c_str(), RTLD_LAZY); HANDLE MODULE = dlopen(path.c_str(), RTLD_LAZY);
if (!MODULE) { 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(); m_vLoadedPlugins.pop_back();
return nullptr; 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); PPLUGIN_INIT_FUNC initFunc = (PPLUGIN_INIT_FUNC)dlsym(MODULE, PLUGIN_INIT_FUNC_STR);
if (!apiVerFunc || !initFunc) { 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); dlclose(MODULE);
m_vLoadedPlugins.pop_back(); m_vLoadedPlugins.pop_back();
return nullptr; return nullptr;
@ -42,7 +42,7 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
const std::string PLUGINAPIVER = apiVerFunc(); const std::string PLUGINAPIVER = apiVerFunc();
if (PLUGINAPIVER != HYPRLAND_API_VERSION) { 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); dlclose(MODULE);
m_vLoadedPlugins.pop_back(); m_vLoadedPlugins.pop_back();
return nullptr; return nullptr;
@ -60,7 +60,7 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
} }
} catch (std::exception& e) { } catch (std::exception& e) {
m_bAllowConfigVars = false; 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 unloadPlugin(PLUGIN, true); // Plugin could've already hooked/done something
return nullptr; return nullptr;
} }
@ -72,8 +72,8 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
PLUGIN->version = PLUGINDATA.version; PLUGIN->version = PLUGINDATA.version;
PLUGIN->name = PLUGINDATA.name; 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, Debug::log(LOG, " [PluginSystem] Plugin {} loaded. Handle: {:x}, path: \"{}\", author: \"{}\", description: \"{}\", version: \"{}\"", PLUGINDATA.name.c_str(),
path.c_str(), PLUGINDATA.author.c_str(), PLUGINDATA.description.c_str(), PLUGINDATA.version.c_str()); (uintptr_t)MODULE, path.c_str(), PLUGINDATA.author.c_str(), PLUGINDATA.description.c_str(), PLUGINDATA.version.c_str());
return PLUGIN; return PLUGIN;
} }
@ -109,7 +109,7 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
dlclose(plugin->m_pHandle); 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; }); 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 // unload all plugins that are no longer present
for (auto& p : m_vLoadedPlugins | std::views::reverse) { for (auto& p : m_vLoadedPlugins | std::views::reverse) {
if (p->m_bLoadedWithConfig && std::find(plugins.begin(), plugins.end(), p->path) == plugins.end()) { 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); unloadPlugin(p.get(), false);
changed = true; changed = true;
} }
@ -137,7 +137,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st
// load all new plugins // load all new plugins
for (auto& path : 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()) { 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); const auto plugin = loadPlugin(path);
if (plugin) { if (plugin) {

View File

@ -140,7 +140,7 @@ static void destroyTI(wl_resource* resource) {
void CTextInputV1ProtocolManager::createTI(wl_client* client, wl_resource* resource, uint32_t id) { void CTextInputV1ProtocolManager::createTI(wl_client* client, wl_resource* resource, uint32_t id) {
const auto PTI = m_pClients.emplace_back(std::make_unique<STextInputV1>()).get(); 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->client = client;
PTI->resourceCaller = resource; PTI->resourceCaller = resource;

View File

@ -149,14 +149,14 @@ void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resou
PFRAME->pWindow = pWindow; PFRAME->pWindow = pWindow;
if (!PFRAME->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); hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
removeFrame(PFRAME); removeFrame(PFRAME);
return; return;
} }
if (!PFRAME->pWindow->m_bIsMapped || PFRAME->pWindow->isHidden()) { 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); hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
removeFrame(PFRAME); removeFrame(PFRAME);
return; return;
@ -223,7 +223,7 @@ void CToplevelExportProtocolManager::copyFrame(wl_client* client, wl_resource* r
} }
if (!PFRAME->pWindow->m_bIsMapped || PFRAME->pWindow->isHidden()) { 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); hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
removeFrame(PFRAME); removeFrame(PFRAME);
return; return;
@ -406,7 +406,7 @@ bool CToplevelExportProtocolManager::copyFrameShm(SScreencopyFrame* frame, times
// copy pixels // copy pixels
const auto PFORMAT = get_gles2_format_from_drm(format); const auto PFORMAT = get_gles2_format_from_drm(format);
if (!PFORMAT) { 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(); g_pHyprOpenGL->end();
wlr_buffer_end_data_ptr_access(frame->buffer); wlr_buffer_end_data_ptr_access(frame->buffer);
if (frame->overlayCursor) if (frame->overlayCursor)

View File

@ -22,14 +22,14 @@ CWaylandResource::CWaylandResource(wl_client* client, const wl_interface* wlInte
m_liResourceDestroy.notify = resourceDestroyNotify; m_liResourceDestroy.notify = resourceDestroyNotify;
wl_resource_add_destroy_listener(m_pWLResource, &m_liResourceDestroy); 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() { void CWaylandResource::markDefunct() {
if (m_bDefunct) if (m_bDefunct)
return; 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; m_bDefunct = true;
wl_resource_set_user_data(m_pWLResource, nullptr); wl_resource_set_user_data(m_pWLResource, nullptr);
} }
@ -40,7 +40,7 @@ CWaylandResource::~CWaylandResource() {
wl_list_remove(&m_liResourceDestroy.link); wl_list_remove(&m_liResourceDestroy.link);
wl_list_init(&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) if (DESTROY)
wl_resource_destroy(m_pWLResource); 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) { void CWaylandResource::setImplementation(const void* impl, wl_resource_destroy_func_t df) {
RASSERT(good(), "Attempted to call setImplementation() on a bad resource"); 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); 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; m_bImplementationSet = true;
} }
void CWaylandResource::setData(void* data) { 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; 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); m_pGlobal = wl_global_create(g_pCompositor->m_sWLDisplay, iface, ver, this, &bindManagerInternal);
if (!m_pGlobal) { 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; return;
} }
m_liDisplayDestroy.notify = displayDestroyInternal; m_liDisplayDestroy.notify = displayDestroyInternal;
wl_display_add_destroy_listener(g_pCompositor->m_sWLDisplay, &m_liDisplayDestroy); 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() { IWaylandProtocol::~IWaylandProtocol() {

View File

@ -3,7 +3,7 @@
bool CFramebuffer::alloc(int w, int h) { bool CFramebuffer::alloc(int w, int h) {
bool firstAlloc = false; 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) { if (m_iFb == (uint32_t)-1) {
firstAlloc = true; firstAlloc = true;
@ -40,9 +40,9 @@ bool CFramebuffer::alloc(int w, int h) {
#endif #endif
auto status = glCheckFramebufferStatus(GL_FRAMEBUFFER); 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); glBindTexture(GL_TEXTURE_2D, 0);

View File

@ -18,10 +18,10 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() {
m_szExtensions = EXTENSIONS; m_szExtensions = EXTENSIONS;
Debug::log(LOG, "Creating the Hypr OpenGL Renderer!"); Debug::log(LOG, "Creating the Hypr OpenGL Renderer!");
Debug::log(LOG, "Using: %s", glGetString(GL_VERSION)); Debug::log(LOG, "Using: {}", (char*)glGetString(GL_VERSION));
Debug::log(LOG, "Vendor: %s", glGetString(GL_VENDOR)); Debug::log(LOG, "Vendor: {}", (char*)glGetString(GL_VENDOR));
Debug::log(LOG, "Renderer: %s", glGetString(GL_RENDERER)); Debug::log(LOG, "Renderer: {}", (char*)glGetString(GL_RENDERER));
Debug::log(LOG, "Supported extensions size: %d", std::count(m_szExtensions.begin(), m_szExtensions.end(), ' ')); Debug::log(LOG, "Supported extensions size: {}", std::count(m_szExtensions.begin(), m_szExtensions.end(), ' '));
#ifdef USE_TRACY_GPU #ifdef USE_TRACY_GPU
@ -50,7 +50,7 @@ GLuint CHyprOpenGLImpl::createProgram(const std::string& vert, const std::string
if (vertCompiled == 0) if (vertCompiled == 0)
return 0; return 0;
} else { } 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); 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) if (fragCompiled == 0)
return 0; return 0;
} else { } 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(); auto prog = glCreateProgram();
@ -1868,7 +1868,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
cairo_surface_destroy(CAIROSURFACE); cairo_surface_destroy(CAIROSURFACE);
cairo_destroy(CAIRO); 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() { void CHyprOpenGLImpl::clearWithTex() {
@ -1900,7 +1900,7 @@ void CHyprOpenGLImpl::destroyMonitorResources(CMonitor* pMonitor) {
g_pHyprOpenGL->m_mMonitorRenderResources.erase(pMonitor); g_pHyprOpenGL->m_mMonitorRenderResources.erase(pMonitor);
g_pHyprOpenGL->m_mMonitorBGTextures.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); wlr_output_rollback(pMonitor->output);
} }

View File

@ -763,7 +763,7 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) {
if (wlr_output_commit(pMonitor->output)) { if (wlr_output_commit(pMonitor->output)) {
if (!m_pLastScanout) { if (!m_pLastScanout) {
m_pLastScanout = PCANDIDATE; 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 { } else {
m_pLastScanout = nullptr; m_pLastScanout = nullptr;
@ -827,7 +827,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (!pMonitor->noFrameSchedule) if (!pMonitor->noFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(pMonitor); g_pCompositor->scheduleFrameForMonitor(pMonitor);
else { 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); 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); 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)) { 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; return;
} }
if (!wlr_output_test(pMonitor->output)) { 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_output_rollback(pMonitor->output);
wlr_gamma_control_v1_send_failed_and_destroy(PGAMMACTRL); 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); wlr_output_lock_software_cursors(pMonitor->output, true);
if (!wlr_output_attach_render(pMonitor->output, &bufferAge)) { 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) if (UNLOCK_SC)
wlr_output_lock_software_cursors(pMonitor->output, false); wlr_output_lock_software_cursors(pMonitor->output, false);
@ -1111,7 +1111,7 @@ void CHyprRenderer::setWindowScanoutMode(CWindow* pWindow) {
if (!pWindow->m_bIsFullscreen) { if (!pWindow->m_bIsFullscreen) {
wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, pWindow->m_pWLSurface.wlr(), nullptr); 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; 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_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, pWindow->m_pWLSurface.wlr(), &feedback);
wlr_linux_dmabuf_feedback_v1_finish(&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) { 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; box.y -= PSTATE->margin.bottom;
} }
if (box.width <= 0 || box.height <= 0) { 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; continue;
} }
// Apply // 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); 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, 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.left, PSTATE->margin.right, PSTATE->margin.bottom); 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); 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); 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; static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE) 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); 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; static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE) 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) { 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; static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE) 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) { 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; static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE) 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) { 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) { 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; pMonitor->activeMonitorRule = *pMonitorRule;
@ -1541,7 +1541,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
if (!pMonitor->m_bEnabled) { if (!pMonitor->m_bEnabled) {
pMonitor->onConnect(true); // enable it. 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; force = true;
} }
@ -1554,7 +1554,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->transform == pMonitorRule->transform && pMonitorRule->enable10bit == pMonitor->enabled10bit && pMonitor->transform == pMonitorRule->transform && pMonitorRule->enable10bit == pMonitor->enabled10bit &&
!memcmp(&pMonitor->customDrmMode, &pMonitorRule->drmMode, sizeof(pMonitor->customDrmMode))) { !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; return true;
} }
@ -1588,12 +1588,12 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
wlr_output_set_mode(pMonitor->output, mode); wlr_output_set_mode(pMonitor->output, mode);
if (!wlr_output_test(pMonitor->output)) { 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, Debug::log(LOG, "Monitor {}: REJECTED available mode: {}x{}@{:2f}!", pMonitor->output->name, (int)pMonitorRule->resolution.x,
(float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f); (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
continue; 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); (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh);
found = true; found = true;
@ -1616,7 +1616,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output); const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
if (!PREFERREDMODE) { 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); (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
return true; return true;
} }
@ -1624,14 +1624,14 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
// Preferred is valid // Preferred is valid
wlr_output_set_mode(pMonitor->output, PREFERREDMODE); 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, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height,
PREFERREDMODE->refresh / 1000.f); PREFERREDMODE->refresh / 1000.f);
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f; pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height); pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
} else { } 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); (float)pMonitorRule->refreshRate);
} }
} }
@ -1666,7 +1666,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output); const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
if (!PREFERREDMODE) { 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); (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
return true; return true;
} }
@ -1674,7 +1674,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
// Preferred is valid // Preferred is valid
wlr_output_set_mode(pMonitor->output, PREFERREDMODE); 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, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height,
PREFERREDMODE->refresh / 1000.f); PREFERREDMODE->refresh / 1000.f);
@ -1682,7 +1682,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height); pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
pMonitor->customDrmMode = {}; pMonitor->customDrmMode = {};
} else { } 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); (float)pMonitorRule->refreshRate);
} }
} }
@ -1723,13 +1723,13 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
} }
if (!success) { 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); (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output); const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
if (!PREFERREDMODE) { 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); (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
return true; return true;
} }
@ -1737,7 +1737,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
// Preferred is valid // Preferred is valid
wlr_output_set_mode(pMonitor->output, PREFERREDMODE); 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, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height,
PREFERREDMODE->refresh / 1000.f); PREFERREDMODE->refresh / 1000.f);
@ -1745,7 +1745,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height); pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
} else { } 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); mode->width, mode->height, mode->refresh / 1000.f);
pMonitor->refreshRate = currentRefresh / 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); const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
if (!PREFERREDMODE) { 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)) { if (!wl_list_empty(&pMonitor->output->modes)) {
wlr_output_mode* mode; wlr_output_mode* mode;
@ -1765,12 +1765,12 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
wlr_output_set_mode(pMonitor->output, mode); wlr_output_set_mode(pMonitor->output, mode);
if (!wlr_output_test(pMonitor->output)) { 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, Debug::log(LOG, "Monitor {}: REJECTED available mode: {}x{}@{:2f}!", pMonitor->output->name, (int)pMonitorRule->resolution.x,
(float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f); (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
continue; 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); (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh);
pMonitor->refreshRate = mode->refresh / 1000.f; 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->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f; 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; pMonitor->enabled10bit = true;
if (!wlr_output_test(pMonitor->output)) { 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); wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XBGR2101010);
if (!wlr_output_test(pMonitor->output)) { 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); wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XRGB8888);
} else { } 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 { } 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 { } else {
wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XRGB8888); 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)) { 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; int x, y;
@ -1853,7 +1853,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
// reload to fix mirrors // reload to fix mirrors
g_pConfigManager->m_bWantsMonitorReload = true; 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->vecPixelSize.y, pMonitor->refreshRate, pMonitor->scale, (int)pMonitor->transform, (int)pMonitor->vecPosition.x, (int)pMonitor->vecPosition.y,
(int)pMonitor->enabled10bit); (int)pMonitor->enabled10bit);