summaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authorPhilip Damianik <39028343+pdamianik@users.noreply.github.com>2023-09-06 21:45:37 +0200
committerGitHub <noreply@github.com>2023-09-06 21:45:37 +0200
commit8c83852704ad8d78b839bd532d73b3b9e44724b9 (patch)
tree6e750b39b0b6af35c9a0b3b1385a7925936bcecd /src/managers
parent60c01dab01e3b58abf12c49f4a2fb224900ae401 (diff)
internal: Remove all `.c_str()` calls when using `std::vformat` (#3198)
Signed-off-by: pdamianik <39028343+pdamianik@users.noreply.github.com>
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/EventManager.cpp6
-rw-r--r--src/managers/HookSystemManager.cpp2
-rw-r--r--src/managers/KeybindManager.cpp20
-rw-r--r--src/managers/LayoutManager.cpp4
-rw-r--r--src/managers/input/IdleInhibitor.cpp2
-rw-r--r--src/managers/input/InputManager.cpp12
-rw-r--r--src/managers/input/Swipe.cpp2
7 files changed, 23 insertions, 25 deletions
diff --git a/src/managers/EventManager.cpp b/src/managers/EventManager.cpp
index 2e723c44..64b4f6bf 100644
--- a/src/managers/EventManager.cpp
+++ b/src/managers/EventManager.cpp
@@ -79,7 +79,7 @@ void CEventManager::startThread() {
sockaddr_in clientAddress;
socklen_t clientSize = sizeof(clientAddress);
- Debug::log(LOG, "Hypr socket 2 started at {}", socketPath.c_str());
+ Debug::log(LOG, "Hypr socket 2 started at {}", socketPath);
while (1) {
const auto ACCEPTEDCONNECTION = accept4(SOCKET, (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC);
@@ -112,7 +112,7 @@ void CEventManager::flushEvents() {
for (auto& fd : m_dAcceptedSocketFDs) {
try {
write(fd.first, eventString.c_str(), eventString.length());
- } catch(...) {}
+ } catch (...) {}
}
}
@@ -124,7 +124,7 @@ void CEventManager::flushEvents() {
void CEventManager::postEvent(const SHyprIPCEvent event) {
if (g_pCompositor->m_bIsShuttingDown) {
- Debug::log(WARN, "Suppressed (ignoreevents true / shutting down) event of type {}, content: {}", event.event.c_str(), event.data.c_str());
+ Debug::log(WARN, "Suppressed (ignoreevents true / shutting down) event of type {}, content: {}", event.event, event.data);
return;
}
diff --git a/src/managers/HookSystemManager.cpp b/src/managers/HookSystemManager.cpp
index 4b6d9461..b82d6f83 100644
--- a/src/managers/HookSystemManager.cpp
+++ b/src/managers/HookSystemManager.cpp
@@ -73,7 +73,7 @@ std::vector<SCallbackFNPtr>* CHookSystemManager::getVecForEvent(const std::strin
if (IT != m_lpRegisteredHooks.end())
return &IT->second;
- Debug::log(LOG, " [hookSystem] New hook event registered: {}", event.c_str());
+ Debug::log(LOG, " [hookSystem] New hook event registered: {}", event);
return &m_lpRegisteredHooks.emplace_back(std::make_pair<>(event, std::vector<SCallbackFNPtr>{})).second;
} \ No newline at end of file
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index d9371718..c7beda7c 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -428,10 +428,10 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string&
// Should never happen, as we check in the ConfigManager, but oh well
if (DISPATCHER == m_mDispatchers.end()) {
- Debug::log(ERR, "Invalid handler in a keybind! (handler {} does not exist)", k.handler.c_str());
+ Debug::log(ERR, "Invalid handler in a keybind! (handler {} does not exist)", k.handler);
} else {
// call the dispatcher
- Debug::log(LOG, "Keybind triggered, calling dispatcher ({}, {}, {})", modmask, key.c_str(), keysym);
+ Debug::log(LOG, "Keybind triggered, calling dispatcher ({}, {}, {})", modmask, key, keysym);
m_iPassPressed = (int)pressed;
@@ -603,7 +603,7 @@ void CKeybindManager::spawn(std::string args) {
}
uint64_t CKeybindManager::spawnRaw(std::string args) {
- Debug::log(LOG, "Executing {}", args.c_str());
+ Debug::log(LOG, "Executing {}", args);
int socket[2];
if (pipe(socket) != 0) {
@@ -1415,7 +1415,7 @@ void CKeybindManager::workspaceOpt(std::string args) {
}
}
} else {
- Debug::log(ERR, "Invalid arg in workspaceOpt, opt \"{}\" doesn't exist.", args.c_str());
+ Debug::log(ERR, "Invalid arg in workspaceOpt, opt \"{}\" doesn't exist.", args);
return;
}
@@ -1433,9 +1433,7 @@ void CKeybindManager::renameWorkspace(std::string args) {
} else {
g_pCompositor->renameWorkspace(std::stoi(args), "");
}
- } catch (std::exception& e) {
- Debug::log(ERR, "Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. \"{}\": \"{}\"", args.c_str(), e.what());
- }
+ } catch (std::exception& e) { Debug::log(ERR, "Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. \"{}\": \"{}\"", args, e.what()); }
}
void CKeybindManager::exitHyprland(std::string argz) {
@@ -1661,7 +1659,7 @@ void CKeybindManager::focusWindow(std::string regexp) {
if (!PWINDOW)
return;
- Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_szTitle.c_str());
+ Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_szTitle);
if (g_pCompositor->m_pLastMonitor->activeWorkspace != PWINDOW->m_iWorkspaceID) {
Debug::log(LOG, "Fake executing workspace to move focus");
@@ -1692,14 +1690,14 @@ void CKeybindManager::setSubmap(std::string submap) {
for (auto& k : g_pKeybindManager->m_lKeybinds) {
if (k.submap == submap) {
m_szCurrentSelectedSubmap = submap;
- Debug::log(LOG, "Changed keybind submap to {}", submap.c_str());
+ Debug::log(LOG, "Changed keybind submap to {}", submap);
g_pEventManager->postEvent(SHyprIPCEvent{"submap", submap});
EMIT_HOOK_EVENT("submap", m_szCurrentSelectedSubmap);
return;
}
}
- Debug::log(ERR, "Cannot set submap {}, submap doesn't exist (wasn't registered!)", submap.c_str());
+ Debug::log(ERR, "Cannot set submap {}, submap doesn't exist (wasn't registered!)", submap);
}
void CKeybindManager::pass(std::string regexp) {
@@ -1816,7 +1814,7 @@ void CKeybindManager::dpms(std::string arg) {
m->dpmsStatus = enable;
if (!wlr_output_commit(m->output)) {
- Debug::log(ERR, "Couldn't commit output {}", m->szName.c_str());
+ Debug::log(ERR, "Couldn't commit output {}", m->szName);
}
if (enable)
diff --git a/src/managers/LayoutManager.cpp b/src/managers/LayoutManager.cpp
index e3a358a2..bf4ca8bd 100644
--- a/src/managers/LayoutManager.cpp
+++ b/src/managers/LayoutManager.cpp
@@ -31,7 +31,7 @@ bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) {
m_vLayouts.emplace_back(std::make_pair<>(name, layout));
- Debug::log(LOG, "Added new layout {} at {:x}", name.c_str(), (uintptr_t)layout);
+ Debug::log(LOG, "Added new layout {} at {:x}", name, (uintptr_t)layout);
return true;
}
@@ -45,7 +45,7 @@ bool CLayoutManager::removeLayout(IHyprLayout* layout) {
if (m_iCurrentLayoutID == IT - m_vLayouts.begin())
switchToLayout("dwindle");
- Debug::log(LOG, "Removed a layout {} at {:x}", IT->first.c_str(), (uintptr_t)layout);
+ Debug::log(LOG, "Removed a layout {} at {:x}", IT->first, (uintptr_t)layout);
std::erase(m_vLayouts, *IT);
diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp
index 809606b1..86553729 100644
--- a/src/managers/input/IdleInhibitor.cpp
+++ b/src/managers/input/IdleInhibitor.cpp
@@ -33,7 +33,7 @@ void CInputManager::newIdleInhibitor(wlr_idle_inhibitor_v1* pInhibitor) {
PINHIBIT->pWindow = g_pCompositor->getWindowFromSurface(pInhibitor->surface);
if (PINHIBIT->pWindow)
- Debug::log(LOG, "IdleInhibitor got window {:x} ({})", (uintptr_t)PINHIBIT->pWindow, PINHIBIT->pWindow->m_szTitle.c_str());
+ Debug::log(LOG, "IdleInhibitor got window {:x} ({})", (uintptr_t)PINHIBIT->pWindow, PINHIBIT->pWindow->m_szTitle);
recheckIdleInhibitorStatus();
}
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index edd7ad1d..b7bcdf95 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -743,7 +743,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
- Debug::log(LOG, "ApplyConfigToKeyboard for \"{}\", hasconfig: {}", pKeyboard->name.c_str(), (int)HASCONFIG);
+ Debug::log(LOG, "ApplyConfigToKeyboard for \"{}\", hasconfig: {}", pKeyboard->name, (int)HASCONFIG);
ASSERT(pKeyboard);
@@ -1029,7 +1029,7 @@ void CInputManager::setPointerConfigs() {
libinput_device_config_scroll_set_button_lock(LIBINPUTDEV,
SCROLLBUTTONLOCK == 0 ? LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED : LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED);
- Debug::log(LOG, "Applied config to mouse {}, sens {:.2f}", m.name.c_str(), LIBINPUTSENS);
+ Debug::log(LOG, "Applied config to mouse {}, sens {:.2f}", m.name, LIBINPUTSENS);
}
}
}
@@ -1414,7 +1414,7 @@ void CInputManager::setTabletConfigs() {
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(t.wlrDevice);
const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(t.name, "transform", "input:tablet:transform"), 0, 7);
- Debug::log(LOG, "Setting calibration matrix for device {}", t.name.c_str());
+ Debug::log(LOG, "Setting calibration matrix for device {}", t.name);
libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]);
const auto OUTPUT = g_pConfigManager->getDeviceString(t.name, "output", "input:tablet:output");
@@ -1454,17 +1454,17 @@ void CInputManager::newSwitch(wlr_input_device* pDevice) {
if (PDEVICE->status != -1 && PDEVICE->status == E->switch_state)
return;
- Debug::log(LOG, "Switch {} fired, triggering binds.", NAME.c_str());
+ Debug::log(LOG, "Switch {} fired, triggering binds.", NAME);
g_pKeybindManager->onSwitchEvent(NAME);
switch (E->switch_state) {
case WLR_SWITCH_STATE_ON:
- Debug::log(LOG, "Switch {} turn on, triggering binds.", NAME.c_str());
+ Debug::log(LOG, "Switch {} turn on, triggering binds.", NAME);
g_pKeybindManager->onSwitchOnEvent(NAME);
break;
case WLR_SWITCH_STATE_OFF:
- Debug::log(LOG, "Switch {} turn off, triggering binds.", NAME.c_str());
+ Debug::log(LOG, "Switch {} turn off, triggering binds.", NAME);
g_pKeybindManager->onSwitchOffEvent(NAME);
break;
}
diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp
index 8d04c4a8..c1aa42f3 100644
--- a/src/managers/input/Swipe.cpp
+++ b/src/managers/input/Swipe.cpp
@@ -25,7 +25,7 @@ void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) {
void CInputManager::beginWorkspaceSwipe() {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace);
- Debug::log(LOG, "Starting a swipe from {}", PWORKSPACE->m_szName.c_str());
+ Debug::log(LOG, "Starting a swipe from {}", PWORKSPACE->m_szName);
m_sActiveSwipe.pWorkspaceBegin = PWORKSPACE;
m_sActiveSwipe.delta = 0;