mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 17:09:49 +01:00
internal: Make static analysis more happy (#8767)
* make functions used in 1 file static * fix invalid substr param -1 * give default initializer to borderGradier * move RASSERT from printf to std::print
This commit is contained in:
parent
7c43eed2c1
commit
5b714f05f8
14 changed files with 59 additions and 57 deletions
|
@ -50,7 +50,7 @@
|
||||||
using namespace Hyprutils::String;
|
using namespace Hyprutils::String;
|
||||||
using namespace Aquamarine;
|
using namespace Aquamarine;
|
||||||
|
|
||||||
int handleCritSignal(int signo, void* data) {
|
static int handleCritSignal(int signo, void* data) {
|
||||||
Debug::log(LOG, "Hyprland received signal {}", signo);
|
Debug::log(LOG, "Hyprland received signal {}", signo);
|
||||||
|
|
||||||
if (signo == SIGTERM || signo == SIGINT || signo == SIGKILL)
|
if (signo == SIGTERM || signo == SIGINT || signo == SIGKILL)
|
||||||
|
@ -59,7 +59,7 @@ int handleCritSignal(int signo, void* data) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleUnrecoverableSignal(int sig) {
|
static void handleUnrecoverableSignal(int sig) {
|
||||||
|
|
||||||
// remove our handlers
|
// remove our handlers
|
||||||
signal(SIGABRT, SIG_DFL);
|
signal(SIGABRT, SIG_DFL);
|
||||||
|
@ -83,7 +83,7 @@ void handleUnrecoverableSignal(int sig) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleUserSignal(int sig) {
|
static void handleUserSignal(int sig) {
|
||||||
if (sig == SIGUSR1) {
|
if (sig == SIGUSR1) {
|
||||||
// means we have to unwind a timed out event
|
// means we have to unwind a timed out event
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
|
@ -103,7 +103,7 @@ static eLogLevel aqLevelToHl(Aquamarine::eBackendLogLevel level) {
|
||||||
return NONE;
|
return NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void aqLog(Aquamarine::eBackendLogLevel level, std::string msg) {
|
static void aqLog(Aquamarine::eBackendLogLevel level, std::string msg) {
|
||||||
Debug::log(aqLevelToHl(level), "[AQ] {}", msg);
|
Debug::log(aqLevelToHl(level), "[AQ] {}", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ std::string CHyprCtl::getMonitorData(Hyprutils::Memory::CSharedPointer<CMonitor>
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string monitorsRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string monitorsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
auto allMonitors = false;
|
auto allMonitors = false;
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ std::string CHyprCtl::getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string clientsRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string clientsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "[";
|
result += "[";
|
||||||
|
@ -368,7 +368,8 @@ static std::string getWorkspaceRuleData(const SWorkspaceRule& r, eHyprCtlOutputF
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string activeWorkspaceRequest(eHyprCtlOutputFormat format, std::string request) {
|
|
||||||
|
static std::string activeWorkspaceRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
if (!g_pCompositor->m_pLastMonitor)
|
if (!g_pCompositor->m_pLastMonitor)
|
||||||
return "unsafe state";
|
return "unsafe state";
|
||||||
|
|
||||||
|
@ -381,7 +382,7 @@ std::string activeWorkspaceRequest(eHyprCtlOutputFormat format, std::string requ
|
||||||
return CHyprCtl::getWorkspaceData(w, format);
|
return CHyprCtl::getWorkspaceData(w, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string workspacesRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string workspacesRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
|
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
|
@ -402,7 +403,7 @@ std::string workspacesRequest(eHyprCtlOutputFormat format, std::string request)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string workspaceRulesRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string workspaceRulesRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "[";
|
result += "[";
|
||||||
|
@ -422,7 +423,7 @@ std::string workspaceRulesRequest(eHyprCtlOutputFormat format, std::string reque
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string activeWindowRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string activeWindowRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!validMapped(PWINDOW))
|
if (!validMapped(PWINDOW))
|
||||||
|
@ -436,7 +437,7 @@ std::string activeWindowRequest(eHyprCtlOutputFormat format, std::string request
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
|
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
|
@ -510,7 +511,7 @@ std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string layoutsRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string layoutsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "[";
|
result += "[";
|
||||||
|
@ -532,7 +533,7 @@ std::string layoutsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string configErrorsRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string configErrorsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
std::string currErrors = g_pConfigManager->getErrors();
|
std::string currErrors = g_pConfigManager->getErrors();
|
||||||
CVarList errLines(currErrors, 0, '\n');
|
CVarList errLines(currErrors, 0, '\n');
|
||||||
|
@ -555,7 +556,7 @@ std::string configErrorsRequest(eHyprCtlOutputFormat format, std::string request
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
|
|
||||||
auto getModState = [](SP<IKeyboard> keyboard, const char* xkbModName) -> bool {
|
auto getModState = [](SP<IKeyboard> keyboard, const char* xkbModName) -> bool {
|
||||||
|
@ -725,7 +726,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string animationsRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string animationsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string ret = "";
|
std::string ret = "";
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
ret += "animations:\n";
|
ret += "animations:\n";
|
||||||
|
@ -778,7 +779,7 @@ std::string animationsRequest(eHyprCtlOutputFormat format, std::string request)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string rollinglogRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string rollinglogRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
|
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
|
@ -792,7 +793,7 @@ std::string rollinglogRequest(eHyprCtlOutputFormat format, std::string request)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string ret = "";
|
std::string ret = "";
|
||||||
const auto SHORTCUTS = PROTO::globalShortcuts->getAllShortcuts();
|
const auto SHORTCUTS = PROTO::globalShortcuts->getAllShortcuts();
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
|
@ -815,7 +816,7 @@ std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::string requ
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string ret = "";
|
std::string ret = "";
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
for (auto const& kb : g_pKeybindManager->m_vKeybinds) {
|
for (auto const& kb : g_pKeybindManager->m_vKeybinds) {
|
||||||
|
@ -1018,7 +1019,7 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchRequest(eHyprCtlOutputFormat format, std::string in) {
|
static std::string dispatchRequest(eHyprCtlOutputFormat format, std::string in) {
|
||||||
// get rid of the dispatch keyword
|
// get rid of the dispatch keyword
|
||||||
in = in.substr(in.find_first_of(' ') + 1);
|
in = in.substr(in.find_first_of(' ') + 1);
|
||||||
|
|
||||||
|
@ -1039,7 +1040,7 @@ std::string dispatchRequest(eHyprCtlOutputFormat format, std::string in) {
|
||||||
return res.success ? "ok" : res.error;
|
return res.success ? "ok" : res.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
|
static std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
|
||||||
// Find the first space to strip the keyword keyword
|
// Find the first space to strip the keyword keyword
|
||||||
auto const firstSpacePos = in.find_first_of(' ');
|
auto const firstSpacePos = in.find_first_of(' ');
|
||||||
if (firstSpacePos == std::string::npos) // Handle the case where there's no space found (invalid input)
|
if (firstSpacePos == std::string::npos) // Handle the case where there's no space found (invalid input)
|
||||||
|
@ -1105,7 +1106,7 @@ std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string reloadRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string reloadRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
|
|
||||||
const auto REQMODE = request.substr(request.find_last_of(' ') + 1);
|
const auto REQMODE = request.substr(request.find_last_of(' ') + 1);
|
||||||
|
|
||||||
|
@ -1120,17 +1121,17 @@ std::string reloadRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string killRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string killRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
g_pInputManager->setClickMode(CLICKMODE_KILL);
|
g_pInputManager->setClickMode(CLICKMODE_KILL);
|
||||||
|
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string splashRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string splashRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return g_pCompositor->m_szCurrentSplash;
|
return g_pCompositor->m_szCurrentSplash;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cursorPosRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string cursorPosRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal().floor();
|
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal().floor();
|
||||||
|
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
|
@ -1148,7 +1149,7 @@ std::string cursorPosRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchBatch(eHyprCtlOutputFormat format, std::string request) {
|
static std::string dispatchBatch(eHyprCtlOutputFormat format, std::string request) {
|
||||||
// split by ;
|
// split by ;
|
||||||
|
|
||||||
request = request.substr(9);
|
request = request.substr(9);
|
||||||
|
@ -1182,7 +1183,7 @@ std::string dispatchBatch(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return reply.substr(0, std::max(static_cast<int>(reply.size() - DELIMITER.size()), 0));
|
return reply.substr(0, std::max(static_cast<int>(reply.size() - DELIMITER.size()), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchSetCursor(eHyprCtlOutputFormat format, std::string request) {
|
static std::string dispatchSetCursor(eHyprCtlOutputFormat format, std::string request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
|
|
||||||
const auto SIZESTR = vars[vars.size() - 1];
|
const auto SIZESTR = vars[vars.size() - 1];
|
||||||
|
@ -1206,7 +1207,7 @@ std::string dispatchSetCursor(eHyprCtlOutputFormat format, std::string request)
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
|
|
||||||
const auto KB = vars[1];
|
const auto KB = vars[1];
|
||||||
|
@ -1281,7 +1282,7 @@ std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::string requ
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchSeterror(eHyprCtlOutputFormat format, std::string request) {
|
static std::string dispatchSeterror(eHyprCtlOutputFormat format, std::string request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
|
|
||||||
std::string errorMessage = "";
|
std::string errorMessage = "";
|
||||||
|
@ -1310,12 +1311,12 @@ std::string dispatchSeterror(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
|
static std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
|
||||||
auto result = g_pKeybindManager->m_mDispatchers["setprop"](request.substr(request.find_first_of(' ') + 1, -1));
|
auto result = g_pKeybindManager->m_mDispatchers["setprop"](request.substr(request.find_first_of(' ') + 1));
|
||||||
return "DEPRECATED: use hyprctl dispatch setprop instead" + (result.success ? "" : "\n" + result.error);
|
return "DEPRECATED: use hyprctl dispatch setprop instead" + (result.success ? "" : "\n" + result.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchGetOption(eHyprCtlOutputFormat format, std::string request) {
|
static std::string dispatchGetOption(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string curitem = "";
|
std::string curitem = "";
|
||||||
|
|
||||||
auto nextItem = [&]() {
|
auto nextItem = [&]() {
|
||||||
|
@ -1371,7 +1372,7 @@ std::string dispatchGetOption(eHyprCtlOutputFormat format, std::string request)
|
||||||
return "invalid type (internal error)";
|
return "invalid type (internal error)";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string decorationRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string decorationRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
const auto PWINDOW = g_pCompositor->getWindowByRegex(vars[1]);
|
const auto PWINDOW = g_pCompositor->getWindowByRegex(vars[1]);
|
||||||
|
|
||||||
|
@ -1397,7 +1398,7 @@ std::string decorationRequest(eHyprCtlOutputFormat format, std::string request)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchOutput(eHyprCtlOutputFormat format, std::string request) {
|
static std::string dispatchOutput(eHyprCtlOutputFormat format, std::string request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
|
|
||||||
if (vars.size() < 2)
|
if (vars.size() < 2)
|
||||||
|
@ -1452,7 +1453,7 @@ std::string dispatchOutput(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchPlugin(eHyprCtlOutputFormat format, std::string request) {
|
static std::string dispatchPlugin(eHyprCtlOutputFormat format, std::string request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
|
|
||||||
if (vars.size() < 2)
|
if (vars.size() < 2)
|
||||||
|
@ -1521,7 +1522,7 @@ std::string dispatchPlugin(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchNotify(eHyprCtlOutputFormat format, std::string request) {
|
static std::string dispatchNotify(eHyprCtlOutputFormat format, std::string request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
|
|
||||||
if (vars.size() < 5)
|
if (vars.size() < 5)
|
||||||
|
@ -1576,7 +1577,7 @@ std::string dispatchNotify(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchDismissNotify(eHyprCtlOutputFormat format, std::string request) {
|
static std::string dispatchDismissNotify(eHyprCtlOutputFormat format, std::string request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
|
|
||||||
int amount = -1;
|
int amount = -1;
|
||||||
|
@ -1596,7 +1597,7 @@ std::string dispatchDismissNotify(eHyprCtlOutputFormat format, std::string reque
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getIsLocked(eHyprCtlOutputFormat format, std::string request) {
|
static std::string getIsLocked(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string lockedStr = g_pSessionLockManager->isSessionLocked() ? "true" : "false";
|
std::string lockedStr = g_pSessionLockManager->isSessionLocked() ? "true" : "false";
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON)
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON)
|
||||||
lockedStr = std::format(R"#(
|
lockedStr = std::format(R"#(
|
||||||
|
@ -1608,7 +1609,7 @@ std::string getIsLocked(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return lockedStr;
|
return lockedStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getDescriptions(eHyprCtlOutputFormat format, std::string request) {
|
static std::string getDescriptions(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string json = "{";
|
std::string json = "{";
|
||||||
const auto& DESCS = g_pConfigManager->getAllDescriptions();
|
const auto& DESCS = g_pConfigManager->getAllDescriptions();
|
||||||
|
|
||||||
|
@ -1623,7 +1624,7 @@ std::string getDescriptions(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string submapRequest(eHyprCtlOutputFormat format, std::string request) {
|
static std::string submapRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string submap = g_pKeybindManager->getCurrentSubmap();
|
std::string submap = g_pKeybindManager->getCurrentSubmap();
|
||||||
if (submap.empty())
|
if (submap.empty())
|
||||||
submap = "default";
|
submap = "default";
|
||||||
|
@ -1792,7 +1793,7 @@ std::string CHyprCtl::makeDynamicCall(const std::string& input) {
|
||||||
return getReply(input);
|
return getReply(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool successWrite(int fd, const std::string& data, bool needLog = true) {
|
static bool successWrite(int fd, const std::string& data, bool needLog = true) {
|
||||||
if (write(fd, data.c_str(), data.length()) > 0)
|
if (write(fd, data.c_str(), data.length()) > 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1805,7 +1806,7 @@ bool successWrite(int fd, const std::string& data, bool needLog = true) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void runWritingDebugLogThread(const int conn) {
|
static void runWritingDebugLogThread(const int conn) {
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
Debug::log(LOG, "In followlog thread, got connection, start writing: {}", conn);
|
Debug::log(LOG, "In followlog thread, got connection, start writing: {}", conn);
|
||||||
//will be finished, when reading side close connection
|
//will be finished, when reading side close connection
|
||||||
|
@ -1828,11 +1829,11 @@ void runWritingDebugLogThread(const int conn) {
|
||||||
}).detach();
|
}).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFollowUpRollingLogRequest(const std::string& request) {
|
static bool isFollowUpRollingLogRequest(const std::string& request) {
|
||||||
return request.contains("rollinglog") && request.contains("f");
|
return request.contains("rollinglog") && request.contains("f");
|
||||||
}
|
}
|
||||||
|
|
||||||
int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
|
static int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
|
||||||
if (mask & WL_EVENT_ERROR || mask & WL_EVENT_HANGUP)
|
if (mask & WL_EVENT_ERROR || mask & WL_EVENT_HANGUP)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
|
|
||||||
inline auto iconBackendFromLayout(PangoLayout* layout) {
|
static inline auto iconBackendFromLayout(PangoLayout* layout) {
|
||||||
// preference: Nerd > FontAwesome > text
|
// preference: Nerd > FontAwesome > text
|
||||||
auto eIconBackendChecks = std::array<eIconBackend, 2>{ICONS_BACKEND_NF, ICONS_BACKEND_FA};
|
auto eIconBackendChecks = std::array<eIconBackend, 2>{ICONS_BACKEND_NF, ICONS_BACKEND_FA};
|
||||||
for (auto iconID : eIconBackendChecks) {
|
for (auto iconID : eIconBackendChecks) {
|
||||||
|
|
|
@ -473,7 +473,7 @@ PHLWINDOW CWindow::x11TransientFor() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregisterVar(void* ptr) {
|
static void unregisterVar(void* ptr) {
|
||||||
((CBaseAnimatedVariable*)ptr)->unregister();
|
((CBaseAnimatedVariable*)ptr)->unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ using namespace Hyprutils::String;
|
||||||
// //
|
// //
|
||||||
// ------------------------------------------------------------ //
|
// ------------------------------------------------------------ //
|
||||||
|
|
||||||
void setAnimToMove(void* data) {
|
static void setAnimToMove(void* data) {
|
||||||
auto* const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove");
|
auto* const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove");
|
||||||
|
|
||||||
CBaseAnimatedVariable* animvar = (CBaseAnimatedVariable*)data;
|
CBaseAnimatedVariable* animvar = (CBaseAnimatedVariable*)data;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
using namespace Hyprutils::String;
|
using namespace Hyprutils::String;
|
||||||
using namespace Hyprutils::Utils;
|
using namespace Hyprutils::Utils;
|
||||||
|
|
||||||
int ratHandler(void* data) {
|
static int ratHandler(void* data) {
|
||||||
g_pHyprRenderer->renderMonitor(((CMonitor*)data)->self.lock());
|
g_pHyprRenderer->renderMonitor(((CMonitor*)data)->self.lock());
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CGradientValueData;
|
||||||
|
|
||||||
struct SWindowRenderLayoutHints {
|
struct SWindowRenderLayoutHints {
|
||||||
bool isBorderGradient = false;
|
bool isBorderGradient = false;
|
||||||
CGradientValueData* borderGradient;
|
CGradientValueData* borderGradient = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SLayoutMessageHeader {
|
struct SLayoutMessageHeader {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
|
#include <print>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "helpers/memory/Memory.hpp"
|
#include "helpers/memory/Memory.hpp"
|
||||||
|
@ -49,7 +50,7 @@
|
||||||
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \
|
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \
|
||||||
std::format(reason, ##__VA_ARGS__), __LINE__, \
|
std::format(reason, ##__VA_ARGS__), __LINE__, \
|
||||||
([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })()); \
|
([]() 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."); \
|
std::print("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
|
||||||
raise(SIGABRT); \
|
raise(SIGABRT); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ using namespace Hyprutils::String;
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
void help() {
|
static void help() {
|
||||||
std::println("usage: Hyprland [arg [...]].\n");
|
std::println("usage: Hyprland [arg [...]].\n");
|
||||||
std::println(R"(Arguments:
|
std::println(R"(Arguments:
|
||||||
--help -h - Show this message again
|
--help -h - Show this message again
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include <hyprgraphics/color/Color.hpp>
|
#include <hyprgraphics/color/Color.hpp>
|
||||||
|
|
||||||
int wlTick(SP<CEventLoopTimer> self, void* data) {
|
static int wlTick(SP<CEventLoopTimer> self, void* data) {
|
||||||
if (g_pAnimationManager)
|
if (g_pAnimationManager)
|
||||||
g_pAnimationManager->onTicked();
|
g_pAnimationManager->onTicked();
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ bool CKeybindManager::ensureMouseBindState() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateRelativeCursorCoords() {
|
static void updateRelativeCursorCoords() {
|
||||||
static auto PNOWARPS = CConfigValue<Hyprlang::INT>("cursor:no_warps");
|
static auto PNOWARPS = CConfigValue<Hyprlang::INT>("cursor:no_warps");
|
||||||
|
|
||||||
if (*PNOWARPS)
|
if (*PNOWARPS)
|
||||||
|
@ -1095,7 +1095,7 @@ SDispatchResult CKeybindManager::toggleActivePseudo(std::string args) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSPACE PCURRENTWORKSPACE) {
|
static SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSPACE PCURRENTWORKSPACE) {
|
||||||
if (!args.starts_with("previous")) {
|
if (!args.starts_with("previous")) {
|
||||||
return getWorkspaceIDNameFromString(args);
|
return getWorkspaceIDNameFromString(args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
|
|
||||||
int handleTimer(void* data) {
|
static int handleTimer(void* data) {
|
||||||
const auto PTM = (CThreadManager*)data;
|
const auto PTM = (CThreadManager*)data;
|
||||||
|
|
||||||
static auto PDISABLECFGRELOAD = CConfigValue<Hyprlang::INT>("misc:disable_autoreload");
|
static auto PDISABLECFGRELOAD = CConfigValue<Hyprlang::INT>("misc:disable_autoreload");
|
||||||
|
|
|
@ -21,7 +21,7 @@ const std::vector<const char*> ASSET_PATHS = {
|
||||||
"/usr/local/share",
|
"/usr/local/share",
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void loadGLProc(void* pProc, const char* name) {
|
static inline void loadGLProc(void* pProc, const char* name) {
|
||||||
void* proc = (void*)eglGetProcAddress(name);
|
void* proc = (void*)eglGetProcAddress(name);
|
||||||
if (proc == nullptr) {
|
if (proc == nullptr) {
|
||||||
Debug::log(CRIT, "[Tracy GPU Profiling] eglGetProcAddress({}) failed", name);
|
Debug::log(CRIT, "[Tracy GPU Profiling] eglGetProcAddress({}) failed", name);
|
||||||
|
|
|
@ -51,13 +51,13 @@ static bool setCloseOnExec(int fd, bool cloexec) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanUpSocket(int fd, const char* path) {
|
static void cleanUpSocket(int fd, const char* path) {
|
||||||
close(fd);
|
close(fd);
|
||||||
if (path[0])
|
if (path[0])
|
||||||
unlink(path);
|
unlink(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void closeSocketSafely(int& fd) {
|
static inline void closeSocketSafely(int& fd) {
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue