mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-08 11:45:59 +01:00
cleanup: Replace find() with C++20 starts_with(), ends_with() and contains() (#3572)
* Replace find() with C++20 starts_with() and ends_with() * Replace find() with C++20 contains()
This commit is contained in:
parent
43b39e0bc6
commit
442209942f
14 changed files with 120 additions and 122 deletions
|
@ -554,7 +554,7 @@ CMonitor* CCompositor::getMonitorFromName(const std::string& name) {
|
||||||
|
|
||||||
CMonitor* CCompositor::getMonitorFromDesc(const std::string& desc) {
|
CMonitor* CCompositor::getMonitorFromDesc(const std::string& desc) {
|
||||||
for (auto& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m->output->description && std::string(m->output->description).find(desc) == 0)
|
if (m->output->description && std::string(m->output->description).starts_with(desc))
|
||||||
return m.get();
|
return m.get();
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1617,7 +1617,7 @@ CWorkspace* CCompositor::getWorkspaceByName(const std::string& name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorkspace* CCompositor::getWorkspaceByString(const std::string& str) {
|
CWorkspace* CCompositor::getWorkspaceByString(const std::string& str) {
|
||||||
if (str.find("name:") == 0) {
|
if (str.starts_with("name:")) {
|
||||||
return getWorkspaceByName(str.substr(str.find_first_of(':') + 1));
|
return getWorkspaceByName(str.substr(str.find_first_of(':') + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1976,14 +1976,14 @@ CMonitor* CCompositor::getMonitorFromString(const std::string& name) {
|
||||||
Debug::log(ERR, "Error in getMonitorFromString: invalid arg 1");
|
Debug::log(ERR, "Error in getMonitorFromString: invalid arg 1");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} else if (name.find("desc:") == 0) {
|
} else if (name.starts_with("desc:")) {
|
||||||
const auto DESCRIPTION = name.substr(5);
|
const auto DESCRIPTION = name.substr(5);
|
||||||
|
|
||||||
for (auto& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (!m->output)
|
if (!m->output)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (m->output->description && std::string(m->output->description).find(DESCRIPTION) == 0) {
|
if (m->output->description && std::string(m->output->description).starts_with(DESCRIPTION)) {
|
||||||
return m.get();
|
return m.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2245,13 +2245,13 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
|
||||||
|
|
||||||
std::regex regexCheck(regexp);
|
std::regex regexCheck(regexp);
|
||||||
std::string matchCheck;
|
std::string matchCheck;
|
||||||
if (regexp.find("title:") == 0) {
|
if (regexp.starts_with("title:")) {
|
||||||
mode = MODE_TITLE_REGEX;
|
mode = MODE_TITLE_REGEX;
|
||||||
regexCheck = std::regex(regexp.substr(6));
|
regexCheck = std::regex(regexp.substr(6));
|
||||||
} else if (regexp.find("address:") == 0) {
|
} else if (regexp.starts_with("address:")) {
|
||||||
mode = MODE_ADDRESS;
|
mode = MODE_ADDRESS;
|
||||||
matchCheck = regexp.substr(8);
|
matchCheck = regexp.substr(8);
|
||||||
} else if (regexp.find("pid:") == 0) {
|
} else if (regexp.starts_with("pid:")) {
|
||||||
mode = MODE_PID;
|
mode = MODE_PID;
|
||||||
matchCheck = regexp.substr(4);
|
matchCheck = regexp.substr(4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,15 +499,15 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
||||||
m_sAdditionalConfigData.forceOpaque = true;
|
m_sAdditionalConfigData.forceOpaque = true;
|
||||||
} else if (r.szRule == "immediate") {
|
} else if (r.szRule == "immediate") {
|
||||||
m_sAdditionalConfigData.forceTearing = true;
|
m_sAdditionalConfigData.forceTearing = true;
|
||||||
} else if (r.szRule.find("rounding") == 0) {
|
} else if (r.szRule.starts_with("rounding")) {
|
||||||
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 \"{}\" failed with: {}", r.szRule, e.what()); }
|
} catch (std::exception& e) { Debug::log(ERR, "Rounding rule \"{}\" failed with: {}", r.szRule, e.what()); }
|
||||||
} else if (r.szRule.find("bordersize") == 0) {
|
} else if (r.szRule.starts_with("bordersize")) {
|
||||||
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 \"{}\" failed with: {}", r.szRule, e.what()); }
|
} catch (std::exception& e) { Debug::log(ERR, "Bordersize rule \"{}\" failed with: {}", r.szRule, e.what()); }
|
||||||
} else if (r.szRule.find("opacity") == 0) {
|
} else if (r.szRule.starts_with("opacity")) {
|
||||||
try {
|
try {
|
||||||
CVarList vars(r.szRule, 0, ' ');
|
CVarList vars(r.szRule, 0, ' ');
|
||||||
|
|
||||||
|
@ -540,10 +540,10 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"{}\" failed with: {}", r.szRule, e.what()); }
|
} catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"{}\" failed with: {}", r.szRule, 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.starts_with("animation")) {
|
||||||
auto STYLE = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
|
auto STYLE = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
|
||||||
m_sAdditionalConfigData.animationStyle = STYLE;
|
m_sAdditionalConfigData.animationStyle = STYLE;
|
||||||
} else if (r.szRule.find("bordercolor") == 0) {
|
} else if (r.szRule.starts_with("bordercolor")) {
|
||||||
try {
|
try {
|
||||||
std::string colorPart = removeBeginEndSpacesTabs(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
|
std::string colorPart = removeBeginEndSpacesTabs(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
||||||
m_sAdditionalConfigData.dimAround = true;
|
m_sAdditionalConfigData.dimAround = true;
|
||||||
} else if (r.szRule == "keepaspectratio") {
|
} else if (r.szRule == "keepaspectratio") {
|
||||||
m_sAdditionalConfigData.keepAspectRatio = true;
|
m_sAdditionalConfigData.keepAspectRatio = true;
|
||||||
} else if (r.szRule.find("xray") == 0) {
|
} else if (r.szRule.starts_with("xray")) {
|
||||||
CVarList vars(r.szRule, 0, ' ');
|
CVarList vars(r.szRule, 0, ' ');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -369,8 +369,8 @@ void CConfigManager::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::string& VALUE) {
|
void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::string& VALUE) {
|
||||||
if (configValues.find(COMMAND) == configValues.end()) {
|
if (!configValues.contains(COMMAND)) {
|
||||||
if (COMMAND.find("device:") != 0 /* devices parsed later */ && COMMAND.find("plugin:") != 0 /* plugins parsed later */) {
|
if (!COMMAND.starts_with("device:") /* devices parsed later */ && !COMMAND.starts_with("plugin:") /* plugins parsed later */) {
|
||||||
if (COMMAND[0] == '$') {
|
if (COMMAND[0] == '$') {
|
||||||
// register a dynamic var
|
// register a dynamic var
|
||||||
Debug::log(LOG, "Registered dynamic var \"{}\" -> {}", COMMAND, VALUE);
|
Debug::log(LOG, "Registered dynamic var \"{}\" -> {}", COMMAND, VALUE);
|
||||||
|
@ -387,7 +387,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
|
||||||
|
|
||||||
SConfigValue* CONFIGENTRY = nullptr;
|
SConfigValue* CONFIGENTRY = nullptr;
|
||||||
|
|
||||||
if (COMMAND.find("device:") == 0) {
|
if (COMMAND.starts_with("device:")) {
|
||||||
const auto DEVICE = COMMAND.substr(7).substr(0, COMMAND.find_last_of(':') - 7);
|
const auto DEVICE = COMMAND.substr(7).substr(0, COMMAND.find_last_of(':') - 7);
|
||||||
const auto CONFIGVAR = COMMAND.substr(COMMAND.find_last_of(':') + 1);
|
const auto CONFIGVAR = COMMAND.substr(COMMAND.find_last_of(':') + 1);
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIGENTRY = &it->second.at(CONFIGVAR);
|
CONFIGENTRY = &it->second.at(CONFIGVAR);
|
||||||
} else if (COMMAND.find("plugin:") == 0) {
|
} else if (COMMAND.starts_with("plugin:")) {
|
||||||
for (auto& [handle, pMap] : pluginConfigs) {
|
for (auto& [handle, pMap] : pluginConfigs) {
|
||||||
auto it = std::find_if(pMap->begin(), pMap->end(), [&](const auto& other) { return other.first == COMMAND; });
|
auto it = std::find_if(pMap->begin(), pMap->end(), [&](const auto& other) { return other.first == COMMAND; });
|
||||||
if (it == pMap->end()) {
|
if (it == pMap->end()) {
|
||||||
|
@ -645,11 +645,11 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARGS[1].find("pref") == 0) {
|
if (ARGS[1].starts_with("pref")) {
|
||||||
newrule.resolution = Vector2D();
|
newrule.resolution = Vector2D();
|
||||||
} else if (ARGS[1].find("highrr") == 0) {
|
} else if (ARGS[1].starts_with("highrr")) {
|
||||||
newrule.resolution = Vector2D(-1, -1);
|
newrule.resolution = Vector2D(-1, -1);
|
||||||
} else if (ARGS[1].find("highres") == 0) {
|
} else if (ARGS[1].starts_with("highres")) {
|
||||||
newrule.resolution = Vector2D(-1, -2);
|
newrule.resolution = Vector2D(-1, -2);
|
||||||
} else if (parseModeLine(ARGS[1], newrule.drmMode)) {
|
} else if (parseModeLine(ARGS[1], newrule.drmMode)) {
|
||||||
newrule.resolution = Vector2D(newrule.drmMode.hdisplay, newrule.drmMode.vdisplay);
|
newrule.resolution = Vector2D(newrule.drmMode.hdisplay, newrule.drmMode.vdisplay);
|
||||||
|
@ -662,14 +662,14 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
|
||||||
newrule.refreshRate = stof(ARGS[1].substr(ARGS[1].find_first_of('@') + 1));
|
newrule.refreshRate = stof(ARGS[1].substr(ARGS[1].find_first_of('@') + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARGS[2].find("auto") == 0) {
|
if (ARGS[2].starts_with("auto")) {
|
||||||
newrule.offset = Vector2D(-INT32_MAX, -INT32_MAX);
|
newrule.offset = Vector2D(-INT32_MAX, -INT32_MAX);
|
||||||
} else {
|
} else {
|
||||||
newrule.offset.x = stoi(ARGS[2].substr(0, ARGS[2].find_first_of('x')));
|
newrule.offset.x = stoi(ARGS[2].substr(0, ARGS[2].find_first_of('x')));
|
||||||
newrule.offset.y = stoi(ARGS[2].substr(ARGS[2].find_first_of('x') + 1));
|
newrule.offset.y = stoi(ARGS[2].substr(ARGS[2].find_first_of('x') + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARGS[3].find("auto") == 0) {
|
if (ARGS[3].starts_with("auto")) {
|
||||||
newrule.scale = -1;
|
newrule.scale = -1;
|
||||||
} else {
|
} else {
|
||||||
newrule.scale = stof(ARGS[3]);
|
newrule.scale = stof(ARGS[3]);
|
||||||
|
@ -905,7 +905,7 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v
|
||||||
if (KEY != "") {
|
if (KEY != "") {
|
||||||
if (isNumber(KEY) && std::stoi(KEY) > 9)
|
if (isNumber(KEY) && std::stoi(KEY) > 9)
|
||||||
g_pKeybindManager->addKeybind(SKeybind{"", std::stoi(KEY), MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent});
|
g_pKeybindManager->addKeybind(SKeybind{"", std::stoi(KEY), MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent});
|
||||||
else if (KEY.find("code:") == 0 && isNumber(KEY.substr(5)))
|
else if (KEY.starts_with("code:") && isNumber(KEY.substr(5)))
|
||||||
g_pKeybindManager->addKeybind(
|
g_pKeybindManager->addKeybind(
|
||||||
SKeybind{"", std::stoi(KEY.substr(5)), MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent});
|
SKeybind{"", std::stoi(KEY.substr(5)), MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent});
|
||||||
else
|
else
|
||||||
|
@ -924,17 +924,17 @@ void CConfigManager::handleUnbind(const std::string& command, const std::string&
|
||||||
}
|
}
|
||||||
|
|
||||||
bool windowRuleValid(const std::string& RULE) {
|
bool windowRuleValid(const std::string& RULE) {
|
||||||
return !(RULE != "float" && RULE != "tile" && RULE.find("opacity") != 0 && RULE.find("move") != 0 && RULE.find("size") != 0 && RULE.find("minsize") != 0 &&
|
return RULE == "float" || RULE == "tile" || RULE.starts_with("opacity") || RULE.starts_with("move") || RULE.starts_with("size") || RULE.starts_with("minsize") ||
|
||||||
RULE.find("maxsize") != 0 && RULE.find("pseudo") != 0 && RULE.find("monitor") != 0 && RULE.find("idleinhibit") != 0 && RULE != "nofocus" && RULE != "noblur" &&
|
RULE.starts_with("maxsize") || RULE.starts_with("pseudo") || RULE.starts_with("monitor") || RULE.starts_with("idleinhibit") || RULE == "nofocus" || RULE == "noblur" ||
|
||||||
RULE != "noshadow" && RULE != "nodim" && RULE != "noborder" && RULE != "opaque" && RULE != "forceinput" && RULE != "fullscreen" && RULE != "nofullscreenrequest" &&
|
RULE == "noshadow" || RULE == "nodim" || RULE == "noborder" || RULE == "opaque" || RULE == "forceinput" || RULE == "fullscreen" || RULE == "nofullscreenrequest" ||
|
||||||
RULE != "nomaximizerequest" && RULE != "fakefullscreen" && RULE != "nomaxsize" && RULE != "pin" && RULE != "noanim" && RULE != "dimaround" && RULE != "windowdance" &&
|
RULE == "nomaximizerequest" || RULE == "fakefullscreen" || RULE == "nomaxsize" || RULE == "pin" || RULE == "noanim" || RULE == "dimaround" || RULE == "windowdance" ||
|
||||||
RULE != "maximize" && RULE != "keepaspectratio" && RULE.find("animation") != 0 && RULE.find("rounding") != 0 && RULE.find("workspace") != 0 &&
|
RULE == "maximize" || RULE == "keepaspectratio" || RULE.starts_with("animation") || RULE.starts_with("rounding") || RULE.starts_with("workspace") ||
|
||||||
RULE.find("bordercolor") != 0 && RULE != "forcergbx" && RULE != "noinitialfocus" && RULE != "stayfocused" && RULE.find("bordersize") != 0 && RULE.find("xray") != 0 &&
|
RULE.starts_with("bordercolor") || RULE == "forcergbx" || RULE == "noinitialfocus" || RULE == "stayfocused" || RULE.starts_with("bordersize") || RULE.starts_with("xray") ||
|
||||||
RULE.find("center") != 0 && RULE.find("group") != 0 && RULE != "immediate");
|
RULE.starts_with("center") || RULE.starts_with("group") || RULE == "immediate";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool layerRuleValid(const std::string& RULE) {
|
bool layerRuleValid(const std::string& RULE) {
|
||||||
return !(RULE != "noanim" && RULE != "blur" && RULE.find("ignorealpha") != 0 && RULE.find("ignorezero") != 0 && RULE.find("xray") != 0);
|
return RULE == "noanim" || RULE == "blur" || RULE.starts_with("ignorealpha") || RULE.starts_with("ignorezero") || RULE.starts_with("xray");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::handleWindowRule(const std::string& command, const std::string& value) {
|
void CConfigManager::handleWindowRule(const std::string& command, const std::string& value) {
|
||||||
|
@ -958,7 +958,7 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RULE.find("size") == 0 || RULE.find("maxsize") == 0 || RULE.find("minsize") == 0)
|
if (RULE.starts_with("size") || RULE.starts_with("maxsize") || RULE.starts_with("minsize"))
|
||||||
m_dWindowRules.push_front({RULE, VALUE});
|
m_dWindowRules.push_front({RULE, VALUE});
|
||||||
else
|
else
|
||||||
m_dWindowRules.push_back({RULE, VALUE});
|
m_dWindowRules.push_back({RULE, VALUE});
|
||||||
|
@ -1105,14 +1105,14 @@ void CConfigManager::handleWindowRuleV2(const std::string& command, const std::s
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RULE.find("size") == 0 || RULE.find("maxsize") == 0 || RULE.find("minsize") == 0)
|
if (RULE.starts_with("size") || RULE.starts_with("maxsize") || RULE.starts_with("minsize"))
|
||||||
m_dWindowRules.push_front(rule);
|
m_dWindowRules.push_front(rule);
|
||||||
else
|
else
|
||||||
m_dWindowRules.push_back(rule);
|
m_dWindowRules.push_back(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBlur) {
|
void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBlur) {
|
||||||
const bool BYADDRESS = name.find("address:") == 0;
|
const bool BYADDRESS = name.starts_with("address:");
|
||||||
std::string matchName = name;
|
std::string matchName = name;
|
||||||
|
|
||||||
if (BYADDRESS) {
|
if (BYADDRESS) {
|
||||||
|
@ -1133,7 +1133,7 @@ void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBl
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::handleBlurLS(const std::string& command, const std::string& value) {
|
void CConfigManager::handleBlurLS(const std::string& command, const std::string& value) {
|
||||||
if (value.find("remove,") == 0) {
|
if (value.starts_with("remove,")) {
|
||||||
const auto TOREMOVE = removeBeginEndSpacesTabs(value.substr(7));
|
const auto TOREMOVE = removeBeginEndSpacesTabs(value.substr(7));
|
||||||
if (std::erase_if(m_dBlurLSNamespaces, [&](const auto& other) { return other == TOREMOVE; }))
|
if (std::erase_if(m_dBlurLSNamespaces, [&](const auto& other) { return other == TOREMOVE; }))
|
||||||
updateBlurredLS(TOREMOVE, false);
|
updateBlurredLS(TOREMOVE, false);
|
||||||
|
@ -1277,7 +1277,7 @@ void CConfigManager::handleSource(const std::string& command, const std::string&
|
||||||
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.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseError != "" && parseError.find("Config error at line") != 0) {
|
if (parseError != "" && !parseError.starts_with("Config error at line")) {
|
||||||
parseError = "Config error at line " + std::to_string(linenum) + " (" + configCurrentPath + "): " + parseError;
|
parseError = "Config error at line " + std::to_string(linenum) + " (" + configCurrentPath + "): " + parseError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1350,7 +1350,7 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
|
||||||
}
|
}
|
||||||
} else if (COMMAND == "monitor")
|
} else if (COMMAND == "monitor")
|
||||||
handleMonitor(COMMAND, VALUE);
|
handleMonitor(COMMAND, VALUE);
|
||||||
else if (COMMAND.find("bind") == 0)
|
else if (COMMAND.starts_with("bind"))
|
||||||
handleBind(COMMAND, VALUE);
|
handleBind(COMMAND, VALUE);
|
||||||
else if (COMMAND == "unbind")
|
else if (COMMAND == "unbind")
|
||||||
handleUnbind(COMMAND, VALUE);
|
handleUnbind(COMMAND, VALUE);
|
||||||
|
@ -1374,9 +1374,9 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
|
||||||
handleBlurLS(COMMAND, VALUE);
|
handleBlurLS(COMMAND, VALUE);
|
||||||
else if (COMMAND == "wsbind")
|
else if (COMMAND == "wsbind")
|
||||||
handleBindWS(COMMAND, VALUE);
|
handleBindWS(COMMAND, VALUE);
|
||||||
else if (COMMAND.find("env") == 0)
|
else if (COMMAND.starts_with("env"))
|
||||||
handleEnv(COMMAND, VALUE);
|
handleEnv(COMMAND, VALUE);
|
||||||
else if (COMMAND.find("plugin") == 0)
|
else if (COMMAND.starts_with("plugin"))
|
||||||
handlePlugin(COMMAND, VALUE);
|
handlePlugin(COMMAND, VALUE);
|
||||||
else {
|
else {
|
||||||
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
|
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
|
||||||
|
@ -1389,7 +1389,7 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
|
||||||
|
|
||||||
// invalidate layouts if they changed
|
// invalidate layouts if they changed
|
||||||
if (needsLayoutRecalc) {
|
if (needsLayoutRecalc) {
|
||||||
if (needsLayoutRecalc == 1 || COMMAND.contains("gaps_") || COMMAND.find("dwindle:") == 0 || COMMAND.find("master:") == 0) {
|
if (needsLayoutRecalc == 1 || COMMAND.contains("gaps_") || COMMAND.starts_with("dwindle:") || COMMAND.starts_with("master:")) {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
||||||
}
|
}
|
||||||
|
@ -1424,7 +1424,7 @@ void CConfigManager::applyUserDefinedVars(std::string& line, const size_t equals
|
||||||
const auto STRAFTERDOLLAR = line.substr(dollarPlace + 1);
|
const auto STRAFTERDOLLAR = line.substr(dollarPlace + 1);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (auto& [var, value] : configDynamicVars) {
|
for (auto& [var, value] : configDynamicVars) {
|
||||||
if (STRAFTERDOLLAR.find(var) == 0) {
|
if (STRAFTERDOLLAR.starts_with(var)) {
|
||||||
line.replace(dollarPlace, var.length() + 1, value);
|
line.replace(dollarPlace, var.length() + 1, value);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1434,7 +1434,7 @@ void CConfigManager::applyUserDefinedVars(std::string& line, const size_t equals
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// maybe env?
|
// maybe env?
|
||||||
for (auto& [var, value] : environmentVariables) {
|
for (auto& [var, value] : environmentVariables) {
|
||||||
if (STRAFTERDOLLAR.find(var) == 0) {
|
if (STRAFTERDOLLAR.starts_with(var)) {
|
||||||
line.replace(dollarPlace, var.length() + 1, value);
|
line.replace(dollarPlace, var.length() + 1, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1600,7 +1600,7 @@ void CConfigManager::loadConfigLoadVars() {
|
||||||
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.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseError != "" && parseError.find("Config error at line") != 0) {
|
if (parseError != "" && !parseError.starts_with("Config error at line")) {
|
||||||
parseError = "Config error at line " + std::to_string(linenum) + " (" + mainConfigPath + "): " + parseError;
|
parseError = "Config error at line " + std::to_string(linenum) + " (" + mainConfigPath + "): " + parseError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1816,7 +1816,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const std::string& name, const st
|
||||||
|
|
||||||
for (auto& r : m_dMonitorRules) {
|
for (auto& r : m_dMonitorRules) {
|
||||||
if (r.name == name ||
|
if (r.name == name ||
|
||||||
(r.name.find("desc:") == 0 &&
|
(r.name.starts_with("desc:") &&
|
||||||
(r.name.substr(5) == displayName || r.name.substr(5) == removeBeginEndSpacesTabs(displayName.substr(0, displayName.find_first_of('(')))))) {
|
(r.name.substr(5) == displayName || r.name.substr(5) == removeBeginEndSpacesTabs(displayName.substr(0, displayName.find_first_of('(')))))) {
|
||||||
found = &r;
|
found = &r;
|
||||||
break;
|
break;
|
||||||
|
@ -1872,7 +1872,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
|
||||||
// check if we have a matching rule
|
// check if we have a matching rule
|
||||||
if (!rule.v2) {
|
if (!rule.v2) {
|
||||||
try {
|
try {
|
||||||
if (rule.szValue.find("title:") == 0) {
|
if (rule.szValue.starts_with("title:")) {
|
||||||
// we have a title rule.
|
// we have a title rule.
|
||||||
std::regex RULECHECK(rule.szValue.substr(6));
|
std::regex RULECHECK(rule.szValue.substr(6));
|
||||||
|
|
||||||
|
@ -1930,7 +1930,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
|
||||||
if (!PWORKSPACE)
|
if (!PWORKSPACE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (rule.szWorkspace.find("name:") == 0) {
|
if (rule.szWorkspace.starts_with("name:")) {
|
||||||
if (PWORKSPACE->m_szName != rule.szWorkspace.substr(5))
|
if (PWORKSPACE->m_szName != rule.szWorkspace.substr(5))
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1988,7 +1988,7 @@ std::vector<SLayerRule> CConfigManager::getMatchingRules(SLayerSurface* pLS) {
|
||||||
return returns;
|
return returns;
|
||||||
|
|
||||||
for (auto& lr : m_dLayerRules) {
|
for (auto& lr : m_dLayerRules) {
|
||||||
if (lr.targetNamespace.find("address:0x") == 0) {
|
if (lr.targetNamespace.starts_with("address:0x")) {
|
||||||
if (std::format("address:0x{:x}", (uintptr_t)pLS) != lr.targetNamespace)
|
if (std::format("address:0x{:x}", (uintptr_t)pLS) != lr.targetNamespace)
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2110,9 +2110,7 @@ bool CConfigManager::deviceConfigExists(const std::string& dev) {
|
||||||
auto copy = dev;
|
auto copy = dev;
|
||||||
std::replace(copy.begin(), copy.end(), ' ', '-');
|
std::replace(copy.begin(), copy.end(), ' ', '-');
|
||||||
|
|
||||||
const auto it = deviceConfigs.find(copy);
|
return deviceConfigs.contains(copy);
|
||||||
|
|
||||||
return it != deviceConfigs.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConfigManager::shouldBlurLS(const std::string& ns) {
|
bool CConfigManager::shouldBlurLS(const std::string& ns) {
|
||||||
|
@ -2233,7 +2231,7 @@ CMonitor* CConfigManager::getBoundMonitorForWS(const std::string& wsname) {
|
||||||
|
|
||||||
std::string CConfigManager::getBoundMonitorStringForWS(const std::string& wsname) {
|
std::string CConfigManager::getBoundMonitorStringForWS(const std::string& wsname) {
|
||||||
for (auto& wr : m_dWorkspaceRules) {
|
for (auto& wr : m_dWorkspaceRules) {
|
||||||
const auto WSNAME = wr.workspaceName.find("name:") == 0 ? wr.workspaceName.substr(5) : wr.workspaceName;
|
const auto WSNAME = wr.workspaceName.starts_with("name:") ? wr.workspaceName.substr(5) : wr.workspaceName;
|
||||||
|
|
||||||
if (WSNAME == wsname) {
|
if (WSNAME == wsname) {
|
||||||
return wr.monitor;
|
return wr.monitor;
|
||||||
|
|
|
@ -961,7 +961,7 @@ std::string dispatchSetProp(std::string request) {
|
||||||
bool lock = false;
|
bool lock = false;
|
||||||
|
|
||||||
if (vars.size() > 4) {
|
if (vars.size() > 4) {
|
||||||
if (vars[4].find("lock") == 0) {
|
if (vars[4].starts_with("lock")) {
|
||||||
lock = true;
|
lock = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1271,7 +1271,7 @@ std::string getReply(std::string request) {
|
||||||
return layersRequest(format);
|
return layersRequest(format);
|
||||||
else if (request == "version")
|
else if (request == "version")
|
||||||
return versionRequest(format);
|
return versionRequest(format);
|
||||||
else if (request.find("reload") == 0)
|
else if (request.starts_with("reload"))
|
||||||
return reloadRequest(request);
|
return reloadRequest(request);
|
||||||
else if (request == "devices")
|
else if (request == "devices")
|
||||||
return devicesRequest(format);
|
return devicesRequest(format);
|
||||||
|
@ -1285,27 +1285,27 @@ std::string getReply(std::string request) {
|
||||||
return globalShortcutsRequest(format);
|
return globalShortcutsRequest(format);
|
||||||
else if (request == "animations")
|
else if (request == "animations")
|
||||||
return animationsRequest(format);
|
return animationsRequest(format);
|
||||||
else if (request.find("plugin") == 0)
|
else if (request.starts_with("plugin"))
|
||||||
return dispatchPlugin(request);
|
return dispatchPlugin(request);
|
||||||
else if (request.find("notify") == 0)
|
else if (request.starts_with("notify"))
|
||||||
return dispatchNotify(request);
|
return dispatchNotify(request);
|
||||||
else if (request.find("setprop") == 0)
|
else if (request.starts_with("setprop"))
|
||||||
return dispatchSetProp(request);
|
return dispatchSetProp(request);
|
||||||
else if (request.find("seterror") == 0)
|
else if (request.starts_with("seterror"))
|
||||||
return dispatchSeterror(request);
|
return dispatchSeterror(request);
|
||||||
else if (request.find("switchxkblayout") == 0)
|
else if (request.starts_with("switchxkblayout"))
|
||||||
return switchXKBLayoutRequest(request);
|
return switchXKBLayoutRequest(request);
|
||||||
else if (request.find("output") == 0)
|
else if (request.starts_with("output"))
|
||||||
return dispatchOutput(request);
|
return dispatchOutput(request);
|
||||||
else if (request.find("dispatch") == 0)
|
else if (request.starts_with("dispatch"))
|
||||||
return dispatchRequest(request);
|
return dispatchRequest(request);
|
||||||
else if (request.find("keyword") == 0)
|
else if (request.starts_with("keyword"))
|
||||||
return dispatchKeyword(request);
|
return dispatchKeyword(request);
|
||||||
else if (request.find("setcursor") == 0)
|
else if (request.starts_with("setcursor"))
|
||||||
return dispatchSetCursor(request);
|
return dispatchSetCursor(request);
|
||||||
else if (request.find("getoption") == 0)
|
else if (request.starts_with("getoption"))
|
||||||
return dispatchGetOption(request, format);
|
return dispatchGetOption(request, format);
|
||||||
else if (request.find("[[BATCH]]") == 0)
|
else if (request.starts_with("[[BATCH]]"))
|
||||||
return dispatchBatch(request);
|
return dispatchBatch(request);
|
||||||
|
|
||||||
return "unknown request";
|
return "unknown request";
|
||||||
|
|
|
@ -117,7 +117,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
PWINDOW->m_szInitialClass = g_pXWaylandManager->getAppIDClass(PWINDOW);
|
PWINDOW->m_szInitialClass = g_pXWaylandManager->getAppIDClass(PWINDOW);
|
||||||
|
|
||||||
for (auto& r : WINDOWRULES) {
|
for (auto& r : WINDOWRULES) {
|
||||||
if (r.szRule.find("monitor") == 0) {
|
if (r.szRule.starts_with("monitor")) {
|
||||||
try {
|
try {
|
||||||
const auto MONITORSTR = removeBeginEndSpacesTabs(r.szRule.substr(r.szRule.find(' ')));
|
const auto MONITORSTR = removeBeginEndSpacesTabs(r.szRule.substr(r.szRule.find(' ')));
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
Debug::log(LOG, "Rule monitor, applying to {:mw}", PWINDOW);
|
Debug::log(LOG, "Rule monitor, applying to {:mw}", PWINDOW);
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "Rule monitor failed, rule: {} -> {} | err: {}", r.szRule, r.szValue, e.what()); }
|
} catch (std::exception& e) { Debug::log(ERR, "Rule monitor failed, rule: {} -> {} | err: {}", r.szRule, r.szValue, e.what()); }
|
||||||
} else if (r.szRule.find("workspace") == 0) {
|
} else if (r.szRule.starts_with("workspace")) {
|
||||||
// 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);
|
||||||
|
|
||||||
|
@ -167,19 +167,19 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
requestedWorkspace = "";
|
requestedWorkspace = "";
|
||||||
|
|
||||||
Debug::log(LOG, "Rule workspace matched by {}, {} applied.", PWINDOW, r.szValue);
|
Debug::log(LOG, "Rule workspace matched by {}, {} applied.", PWINDOW, r.szValue);
|
||||||
} else if (r.szRule.find("float") == 0) {
|
} else if (r.szRule.starts_with("float")) {
|
||||||
PWINDOW->m_bIsFloating = true;
|
PWINDOW->m_bIsFloating = true;
|
||||||
} else if (r.szRule.find("tile") == 0) {
|
} else if (r.szRule.starts_with("tile")) {
|
||||||
PWINDOW->m_bIsFloating = false;
|
PWINDOW->m_bIsFloating = false;
|
||||||
} else if (r.szRule.find("pseudo") == 0) {
|
} else if (r.szRule.starts_with("pseudo")) {
|
||||||
PWINDOW->m_bIsPseudotiled = true;
|
PWINDOW->m_bIsPseudotiled = true;
|
||||||
} else if (r.szRule.find("nofocus") == 0) {
|
} else if (r.szRule.starts_with("nofocus")) {
|
||||||
PWINDOW->m_bNoFocus = true;
|
PWINDOW->m_bNoFocus = true;
|
||||||
} else if (r.szRule.find("noinitialfocus") == 0) {
|
} else if (r.szRule.starts_with("noinitialfocus")) {
|
||||||
PWINDOW->m_bNoInitialFocus = true;
|
PWINDOW->m_bNoInitialFocus = true;
|
||||||
} else if (r.szRule.find("nofullscreenrequest") == 0) {
|
} else if (r.szRule.starts_with("nofullscreenrequest")) {
|
||||||
PWINDOW->m_bNoFullscreenRequest = true;
|
PWINDOW->m_bNoFullscreenRequest = true;
|
||||||
} else if (r.szRule.find("nomaximizerequest") == 0) {
|
} else if (r.szRule.starts_with("nomaximizerequest")) {
|
||||||
PWINDOW->m_bNoMaximizeRequest = true;
|
PWINDOW->m_bNoMaximizeRequest = true;
|
||||||
} else if (r.szRule == "fullscreen") {
|
} else if (r.szRule == "fullscreen") {
|
||||||
requestsFullscreen = true;
|
requestsFullscreen = true;
|
||||||
|
@ -199,7 +199,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
overridingNoMaximize = true;
|
overridingNoMaximize = true;
|
||||||
} else if (r.szRule == "stayfocused") {
|
} else if (r.szRule == "stayfocused") {
|
||||||
PWINDOW->m_bStayFocused = true;
|
PWINDOW->m_bStayFocused = true;
|
||||||
} else if (r.szRule.find("group") == 0) {
|
} else if (r.szRule.starts_with("group")) {
|
||||||
if (PWINDOW->m_eGroupRules & GROUP_OVERRIDE)
|
if (PWINDOW->m_eGroupRules & GROUP_OVERRIDE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
vPrev = v;
|
vPrev = v;
|
||||||
}
|
}
|
||||||
} else if (r.szRule.find("idleinhibit") == 0) {
|
} else if (r.szRule.starts_with("idleinhibit")) {
|
||||||
auto IDLERULE = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
|
auto IDLERULE = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
|
||||||
|
|
||||||
if (IDLERULE == "none") {
|
if (IDLERULE == "none") {
|
||||||
|
@ -273,7 +273,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
const CVarList WORKSPACEARGS = CVarList(requestedWorkspace, 0, ' ');
|
const CVarList WORKSPACEARGS = CVarList(requestedWorkspace, 0, ' ');
|
||||||
|
|
||||||
if (!WORKSPACEARGS[0].empty()) {
|
if (!WORKSPACEARGS[0].empty()) {
|
||||||
if (WORKSPACEARGS[WORKSPACEARGS.size() - 1].find("silent") == 0)
|
if (WORKSPACEARGS[WORKSPACEARGS.size() - 1].starts_with("silent"))
|
||||||
workspaceSilent = true;
|
workspaceSilent = true;
|
||||||
|
|
||||||
std::string requestedWorkspaceName;
|
std::string requestedWorkspaceName;
|
||||||
|
@ -309,7 +309,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
// size and move rules
|
// size and move rules
|
||||||
for (auto& r : WINDOWRULES) {
|
for (auto& r : WINDOWRULES) {
|
||||||
if (r.szRule.find("size") == 0) {
|
if (r.szRule.starts_with("size")) {
|
||||||
try {
|
try {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
||||||
|
@ -331,7 +331,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
PWINDOW->setHidden(false);
|
||||||
} catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r.szRule, r.szValue); }
|
} catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r.szRule, r.szValue); }
|
||||||
} else if (r.szRule.find("minsize") == 0) {
|
} else if (r.szRule.starts_with("minsize")) {
|
||||||
try {
|
try {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
||||||
|
@ -345,7 +345,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
PWINDOW->setHidden(false);
|
||||||
} catch (...) { Debug::log(LOG, "Rule minsize failed, rule: {} -> {}", r.szRule, r.szValue); }
|
} catch (...) { Debug::log(LOG, "Rule minsize failed, rule: {} -> {}", r.szRule, r.szValue); }
|
||||||
} else if (r.szRule.find("maxsize") == 0) {
|
} else if (r.szRule.starts_with("maxsize")) {
|
||||||
try {
|
try {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
||||||
|
@ -359,16 +359,16 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
PWINDOW->setHidden(false);
|
||||||
} catch (...) { Debug::log(LOG, "Rule maxsize failed, rule: {} -> {}", r.szRule, r.szValue); }
|
} catch (...) { Debug::log(LOG, "Rule maxsize failed, rule: {} -> {}", r.szRule, r.szValue); }
|
||||||
} else if (r.szRule.find("move") == 0) {
|
} else if (r.szRule.starts_with("move")) {
|
||||||
try {
|
try {
|
||||||
auto value = r.szRule.substr(r.szRule.find(' ') + 1);
|
auto value = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
|
|
||||||
const bool ONSCREEN = value.find("onscreen") == 0;
|
const bool ONSCREEN = value.starts_with("onscreen");
|
||||||
|
|
||||||
if (ONSCREEN)
|
if (ONSCREEN)
|
||||||
value = value.substr(value.find_first_of(' ') + 1);
|
value = value.substr(value.find_first_of(' ') + 1);
|
||||||
|
|
||||||
const bool CURSOR = value.find("cursor") == 0;
|
const bool CURSOR = value.starts_with("cursor");
|
||||||
|
|
||||||
if (CURSOR)
|
if (CURSOR)
|
||||||
value = value.substr(value.find_first_of(' ') + 1);
|
value = value.substr(value.find_first_of(' ') + 1);
|
||||||
|
@ -379,7 +379,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
int posX = 0;
|
int posX = 0;
|
||||||
int posY = 0;
|
int posY = 0;
|
||||||
|
|
||||||
if (POSXSTR.find("100%-") == 0) {
|
if (POSXSTR.starts_with("100%-")) {
|
||||||
const auto POSXRAW = POSXSTR.substr(5);
|
const auto POSXRAW = POSXSTR.substr(5);
|
||||||
posX =
|
posX =
|
||||||
PMONITOR->vecSize.x - (!POSXRAW.contains('%') ? std::stoi(POSXRAW) : std::stof(POSXRAW.substr(0, POSXRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
|
PMONITOR->vecSize.x - (!POSXRAW.contains('%') ? std::stoi(POSXRAW) : std::stof(POSXRAW.substr(0, POSXRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
|
||||||
|
@ -398,7 +398,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (POSYSTR.find("100%-") == 0) {
|
if (POSYSTR.starts_with("100%-")) {
|
||||||
const auto POSYRAW = POSYSTR.substr(5);
|
const auto POSYRAW = POSYSTR.substr(5);
|
||||||
posY =
|
posY =
|
||||||
PMONITOR->vecSize.y - (!POSYRAW.contains('%') ? std::stoi(POSYRAW) : std::stof(POSYRAW.substr(0, POSYRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
|
PMONITOR->vecSize.y - (!POSYRAW.contains('%') ? std::stoi(POSYRAW) : std::stof(POSYRAW.substr(0, POSYRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
|
||||||
|
@ -433,7 +433,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
PWINDOW->setHidden(false);
|
||||||
} catch (...) { Debug::log(LOG, "Rule move failed, rule: {} -> {}", r.szRule, r.szValue); }
|
} catch (...) { Debug::log(LOG, "Rule move failed, rule: {} -> {}", r.szRule, r.szValue); }
|
||||||
} else if (r.szRule.find("center") == 0) {
|
} else if (r.szRule.starts_with("center")) {
|
||||||
auto RESERVEDOFFSET = Vector2D();
|
auto RESERVEDOFFSET = Vector2D();
|
||||||
const auto ARGS = CVarList(r.szRule, 2, ' ');
|
const auto ARGS = CVarList(r.szRule, 2, ' ');
|
||||||
if (ARGS[1] == "1")
|
if (ARGS[1] == "1")
|
||||||
|
|
|
@ -250,7 +250,7 @@ bool isDirection(const std::string& arg) {
|
||||||
|
|
||||||
int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||||
int result = INT_MAX;
|
int result = INT_MAX;
|
||||||
if (in.find("special") == 0) {
|
if (in.starts_with("special")) {
|
||||||
outName = "special";
|
outName = "special";
|
||||||
|
|
||||||
if (in.length() > 8) {
|
if (in.length() > 8) {
|
||||||
|
@ -264,7 +264,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return SPECIAL_WORKSPACE_START;
|
return SPECIAL_WORKSPACE_START;
|
||||||
} else if (in.find("name:") == 0) {
|
} else if (in.starts_with("name:")) {
|
||||||
const auto WORKSPACENAME = in.substr(in.find_first_of(':') + 1);
|
const auto WORKSPACENAME = in.substr(in.find_first_of(':') + 1);
|
||||||
const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME);
|
const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME);
|
||||||
if (!WORKSPACE) {
|
if (!WORKSPACE) {
|
||||||
|
@ -273,14 +273,14 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||||
result = WORKSPACE->m_iID;
|
result = WORKSPACE->m_iID;
|
||||||
}
|
}
|
||||||
outName = WORKSPACENAME;
|
outName = WORKSPACENAME;
|
||||||
} else if (in.find("empty") == 0) {
|
} else if (in.starts_with("empty")) {
|
||||||
int id = 0;
|
int id = 0;
|
||||||
while (++id < INT_MAX) {
|
while (++id < INT_MAX) {
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(id);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(id);
|
||||||
if (!PWORKSPACE || (g_pCompositor->getWindowsOnWorkspace(id) == 0))
|
if (!PWORKSPACE || (g_pCompositor->getWindowsOnWorkspace(id) == 0))
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
} else if (in.find("prev") == 0) {
|
} else if (in.starts_with("prev")) {
|
||||||
if (!g_pCompositor->m_pLastMonitor)
|
if (!g_pCompositor->m_pLastMonitor)
|
||||||
return INT_MAX;
|
return INT_MAX;
|
||||||
|
|
||||||
|
@ -391,12 +391,12 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||||
int beginID = finalWSID;
|
int beginID = finalWSID;
|
||||||
int curID = finalWSID;
|
int curID = finalWSID;
|
||||||
while (--curID > 0 && remainingWSes > 0) {
|
while (--curID > 0 && remainingWSes > 0) {
|
||||||
if (invalidWSes.find(curID) == invalidWSes.end()) {
|
if (!invalidWSes.contains(curID)) {
|
||||||
remainingWSes--;
|
remainingWSes--;
|
||||||
}
|
}
|
||||||
finalWSID = curID;
|
finalWSID = curID;
|
||||||
}
|
}
|
||||||
if (finalWSID <= 0 || invalidWSes.find(finalWSID) != invalidWSes.end()) {
|
if (finalWSID <= 0 || invalidWSes.contains(finalWSID)) {
|
||||||
if (namedWSes.size()) {
|
if (namedWSes.size()) {
|
||||||
// Go to the named workspaces
|
// Go to the named workspaces
|
||||||
// Need remainingWSes more
|
// Need remainingWSes more
|
||||||
|
@ -416,7 +416,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||||
if (walkDir == '+') {
|
if (walkDir == '+') {
|
||||||
int curID = finalWSID;
|
int curID = finalWSID;
|
||||||
while (++curID < INT32_MAX && remainingWSes > 0) {
|
while (++curID < INT32_MAX && remainingWSes > 0) {
|
||||||
if (invalidWSes.find(curID) == invalidWSes.end()) {
|
if (!invalidWSes.contains(curID)) {
|
||||||
remainingWSes--;
|
remainingWSes--;
|
||||||
}
|
}
|
||||||
finalWSID = curID;
|
finalWSID = curID;
|
||||||
|
@ -628,11 +628,11 @@ int64_t getPPIDof(int64_t pid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t configStringToInt(const std::string& VALUE) {
|
int64_t configStringToInt(const std::string& VALUE) {
|
||||||
if (VALUE.find("0x") == 0) {
|
if (VALUE.starts_with("0x")) {
|
||||||
// Values with 0x are hex
|
// Values with 0x are hex
|
||||||
const auto VALUEWITHOUTHEX = VALUE.substr(2);
|
const auto VALUEWITHOUTHEX = VALUE.substr(2);
|
||||||
return stol(VALUEWITHOUTHEX, nullptr, 16);
|
return stol(VALUEWITHOUTHEX, nullptr, 16);
|
||||||
} else if (VALUE.find("rgba(") == 0 && VALUE.find(')') == VALUE.length() - 1) {
|
} else if (VALUE.starts_with("rgba(") && VALUE.ends_with(')')) {
|
||||||
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) {
|
||||||
|
@ -644,7 +644,7 @@ int64_t configStringToInt(const std::string& VALUE) {
|
||||||
|
|
||||||
// now we need to RGBA -> ARGB. The config holds ARGB only.
|
// now we need to RGBA -> ARGB. The config holds ARGB only.
|
||||||
return (RGBA >> 8) + 0x1000000 * (RGBA & 0xFF);
|
return (RGBA >> 8) + 0x1000000 * (RGBA & 0xFF);
|
||||||
} else if (VALUE.find("rgb(") == 0 && VALUE.find(')') == VALUE.length() - 1) {
|
} else if (VALUE.starts_with("rgb(") && VALUE.ends_with(')')) {
|
||||||
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) {
|
||||||
|
@ -655,9 +655,9 @@ int64_t configStringToInt(const std::string& VALUE) {
|
||||||
const auto RGB = std::stol(VALUEWITHOUTFUNC, nullptr, 16);
|
const auto RGB = std::stol(VALUEWITHOUTFUNC, nullptr, 16);
|
||||||
|
|
||||||
return RGB + 0xFF000000; // 0xFF for opaque
|
return RGB + 0xFF000000; // 0xFF for opaque
|
||||||
} else if (VALUE.find("true") == 0 || VALUE.find("on") == 0 || VALUE.find("yes") == 0) {
|
} else if (VALUE.starts_with("true") || VALUE.starts_with("on") || VALUE.starts_with("yes")) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (VALUE.find("false") == 0 || VALUE.find("off") == 0 || VALUE.find("no") == 0) {
|
} else if (VALUE.starts_with("false") || VALUE.starts_with("off") || VALUE.starts_with("no")) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return std::stoll(VALUE);
|
return std::stoll(VALUE);
|
||||||
|
|
|
@ -20,7 +20,7 @@ void SLayerSurface::applyRules() {
|
||||||
noAnimations = true;
|
noAnimations = true;
|
||||||
else if (rule.rule == "blur")
|
else if (rule.rule == "blur")
|
||||||
forceBlur = true;
|
forceBlur = true;
|
||||||
else if (rule.rule.find("ignorealpha") == 0 || rule.rule.find("ignorezero") == 0) {
|
else if (rule.rule.starts_with("ignorealpha") || rule.rule.starts_with("ignorezero")) {
|
||||||
const auto FIRST_SPACE_POS = rule.rule.find_first_of(' ');
|
const auto FIRST_SPACE_POS = rule.rule.find_first_of(' ');
|
||||||
std::string alphaValue = "";
|
std::string alphaValue = "";
|
||||||
if (FIRST_SPACE_POS != std::string::npos)
|
if (FIRST_SPACE_POS != std::string::npos)
|
||||||
|
@ -31,7 +31,7 @@ void SLayerSurface::applyRules() {
|
||||||
if (!alphaValue.empty())
|
if (!alphaValue.empty())
|
||||||
ignoreAlphaValue = std::stof(alphaValue);
|
ignoreAlphaValue = std::stof(alphaValue);
|
||||||
} catch (...) { Debug::log(ERR, "Invalid value passed to ignoreAlpha"); }
|
} catch (...) { Debug::log(ERR, "Invalid value passed to ignoreAlpha"); }
|
||||||
} else if (rule.rule.find("xray") == 0) {
|
} else if (rule.rule.starts_with("xray")) {
|
||||||
CVarList vars{rule.rule, 0, ' '};
|
CVarList vars{rule.rule, 0, ' '};
|
||||||
try {
|
try {
|
||||||
xray = configStringToInt(vars[1]);
|
xray = configStringToInt(vars[1]);
|
||||||
|
|
|
@ -40,7 +40,7 @@ CWorkspace::~CWorkspace() {
|
||||||
void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
||||||
const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
|
const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
|
||||||
|
|
||||||
if (ANIMSTYLE.find("slidefade") == 0) {
|
if (ANIMSTYLE.starts_with("slidefade")) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||||
float movePerc = 100.f;
|
float movePerc = 100.f;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
||||||
m_fAlpha.setValueAndWarp(1.f);
|
m_fAlpha.setValueAndWarp(1.f);
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||||
|
|
||||||
if (ANIMSTYLE.find("slidefadevert") == 0) {
|
if (ANIMSTYLE.starts_with("slidefadevert")) {
|
||||||
if (in) {
|
if (in) {
|
||||||
m_fAlpha.setValueAndWarp(0.f);
|
m_fAlpha.setValueAndWarp(0.f);
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
|
m_vRenderOffset.setValueAndWarp(Vector2D(0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
|
||||||
|
|
|
@ -429,7 +429,7 @@ void CAnimationManager::onWindowPostCreateClose(CWindow* pWindow, bool close) {
|
||||||
|
|
||||||
if (pWindow->m_sAdditionalConfigData.animationStyle != "") {
|
if (pWindow->m_sAdditionalConfigData.animationStyle != "") {
|
||||||
// the window has config'd special anim
|
// the window has config'd special anim
|
||||||
if (pWindow->m_sAdditionalConfigData.animationStyle.find("slide") == 0) {
|
if (pWindow->m_sAdditionalConfigData.animationStyle.starts_with("slide")) {
|
||||||
if (pWindow->m_sAdditionalConfigData.animationStyle.contains(' ')) {
|
if (pWindow->m_sAdditionalConfigData.animationStyle.contains(' ')) {
|
||||||
// has a direction
|
// has a direction
|
||||||
animationSlide(pWindow, pWindow->m_sAdditionalConfigData.animationStyle.substr(pWindow->m_sAdditionalConfigData.animationStyle.find(' ') + 1), close);
|
animationSlide(pWindow, pWindow->m_sAdditionalConfigData.animationStyle.substr(pWindow->m_sAdditionalConfigData.animationStyle.find(' ') + 1), close);
|
||||||
|
@ -458,7 +458,7 @@ void CAnimationManager::onWindowPostCreateClose(CWindow* pWindow, bool close) {
|
||||||
// anim popin, fallback
|
// anim popin, fallback
|
||||||
|
|
||||||
float minPerc = 0.f;
|
float minPerc = 0.f;
|
||||||
if (ANIMSTYLE.find("%") != 0) {
|
if (!ANIMSTYLE.starts_with("%")) {
|
||||||
try {
|
try {
|
||||||
auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' '));
|
auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' '));
|
||||||
minPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
minPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
||||||
|
@ -473,10 +473,10 @@ void CAnimationManager::onWindowPostCreateClose(CWindow* pWindow, bool close) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CAnimationManager::styleValidInConfigVar(const std::string& config, const std::string& style) {
|
std::string CAnimationManager::styleValidInConfigVar(const std::string& config, const std::string& style) {
|
||||||
if (config.find("window") == 0) {
|
if (config.starts_with("window")) {
|
||||||
if (style == "slide") {
|
if (style == "slide") {
|
||||||
return "";
|
return "";
|
||||||
} else if (style.find("popin") == 0) {
|
} else if (style.starts_with("popin")) {
|
||||||
// try parsing
|
// try parsing
|
||||||
float minPerc = 0.f;
|
float minPerc = 0.f;
|
||||||
if (style.find("%") != std::string::npos) {
|
if (style.find("%") != std::string::npos) {
|
||||||
|
@ -497,7 +497,7 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
|
||||||
} else if (config == "workspaces" || config == "specialWorkspace") {
|
} else if (config == "workspaces" || config == "specialWorkspace") {
|
||||||
if (style == "slide" || style == "slidevert" || style == "fade")
|
if (style == "slide" || style == "slidevert" || style == "fade")
|
||||||
return "";
|
return "";
|
||||||
else if (style.find("slidefade") == 0) {
|
else if (style.starts_with("slidefade")) {
|
||||||
// try parsing
|
// try parsing
|
||||||
float movePerc = 0.f;
|
float movePerc = 0.f;
|
||||||
if (style.find("%") != std::string::npos) {
|
if (style.find("%") != std::string::npos) {
|
||||||
|
|
|
@ -808,9 +808,9 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
||||||
const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
||||||
const bool EXPLICITPREVIOUS = args.find("previous") == 0;
|
const bool EXPLICITPREVIOUS = args.starts_with("previous");
|
||||||
|
|
||||||
if (args.find("previous") == 0) {
|
if (args.starts_with("previous")) {
|
||||||
// Do nothing if there's no previous workspace, otherwise switch to it.
|
// Do nothing if there's no previous workspace, otherwise switch to it.
|
||||||
if (PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1) {
|
if (PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1) {
|
||||||
Debug::log(LOG, "No previous workspace to change to");
|
Debug::log(LOG, "No previous workspace to change to");
|
||||||
|
@ -1094,7 +1094,7 @@ void CKeybindManager::swapActive(std::string args) {
|
||||||
void CKeybindManager::moveActiveTo(std::string args) {
|
void CKeybindManager::moveActiveTo(std::string args) {
|
||||||
char arg = args[0];
|
char arg = args[0];
|
||||||
|
|
||||||
if (args.find("mon:") == 0) {
|
if (args.starts_with("mon:")) {
|
||||||
const auto PNEWMONITOR = g_pCompositor->getMonitorFromString(args.substr(4));
|
const auto PNEWMONITOR = g_pCompositor->getMonitorFromString(args.substr(4));
|
||||||
if (!PNEWMONITOR)
|
if (!PNEWMONITOR)
|
||||||
return;
|
return;
|
||||||
|
@ -1221,7 +1221,7 @@ void CKeybindManager::alterSplitRatio(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (splitratio == 0) {
|
if (splitratio == 0) {
|
||||||
if (args.find("exact") == 0) {
|
if (args.starts_with("exact")) {
|
||||||
exact = true;
|
exact = true;
|
||||||
splitratio = getPlusMinusKeywordResult(args.substr(5), 0);
|
splitratio = getPlusMinusKeywordResult(args.substr(5), 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1721,10 +1721,10 @@ void CKeybindManager::toggleOpaque(std::string unused) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::dpms(std::string arg) {
|
void CKeybindManager::dpms(std::string arg) {
|
||||||
bool enable = arg.find("on") == 0;
|
bool enable = arg.starts_with("on");
|
||||||
std::string port = "";
|
std::string port = "";
|
||||||
|
|
||||||
if (arg.find("toggle") == 0)
|
if (arg.starts_with("toggle"))
|
||||||
enable = !std::any_of(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](const auto& other) { return !other->dpmsStatus; }); // enable if any is off
|
enable = !std::any_of(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](const auto& other) { return !other->dpmsStatus; }); // enable if any is off
|
||||||
|
|
||||||
if (arg.find_first_of(' ') != std::string::npos)
|
if (arg.find_first_of(' ') != std::string::npos)
|
||||||
|
|
|
@ -1001,7 +1001,7 @@ void CInputManager::setPointerConfigs() {
|
||||||
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
|
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
|
||||||
} else if (ACCELPROFILE == "flat") {
|
} else if (ACCELPROFILE == "flat") {
|
||||||
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
|
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
|
||||||
} else if (ACCELPROFILE.find("custom") == 0) {
|
} else if (ACCELPROFILE.starts_with("custom")) {
|
||||||
CVarList args = {ACCELPROFILE, 0, ' '};
|
CVarList args = {ACCELPROFILE, 0, ' '};
|
||||||
try {
|
try {
|
||||||
double step = std::stod(args[1]);
|
double step = std::stod(args[1]);
|
||||||
|
|
|
@ -51,7 +51,7 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
||||||
static auto* const PSWIPENUMBER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_numbered")->intValue;
|
static auto* const PSWIPENUMBER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_numbered")->intValue;
|
||||||
static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue;
|
static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue;
|
||||||
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.find("slidefadevert") == 0;
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
|
||||||
|
|
||||||
// commit
|
// commit
|
||||||
std::string wsname = "";
|
std::string wsname = "";
|
||||||
|
@ -200,7 +200,7 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
||||||
static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue;
|
static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue;
|
||||||
|
|
||||||
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.find("slidefadevert") == 0;
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
|
||||||
|
|
||||||
m_sActiveSwipe.delta += VERTANIMS ? (*PSWIPEINVR ? -e->dy : e->dy) : (*PSWIPEINVR ? -e->dx : e->dx);
|
m_sActiveSwipe.delta += VERTANIMS ? (*PSWIPEINVR ? -e->dy : e->dy) : (*PSWIPEINVR ? -e->dx : e->dx);
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ APICALL bool HyprlandAPI::addConfigValue(HANDLE handle, const std::string& name,
|
||||||
if (!PLUGIN)
|
if (!PLUGIN)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (name.find("plugin:") != 0)
|
if (!name.starts_with("plugin:"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
g_pConfigManager->addPluginConfigVar(handle, name, value);
|
g_pConfigManager->addPluginConfigVar(handle, name, value);
|
||||||
|
|
|
@ -122,7 +122,7 @@ void CHyprOpenGLImpl::begin(CMonitor* pMonitor, CRegion* pDamage, bool fake) {
|
||||||
m_iWLROutputFb = m_iCurrentOutputFb;
|
m_iWLROutputFb = m_iCurrentOutputFb;
|
||||||
|
|
||||||
// ensure a framebuffer for the monitor exists
|
// ensure a framebuffer for the monitor exists
|
||||||
if (m_mMonitorRenderResources.find(pMonitor) == m_mMonitorRenderResources.end() || m_RenderData.pCurrentMonData->primaryFB.m_vSize != pMonitor->vecPixelSize) {
|
if (!m_mMonitorRenderResources.contains(pMonitor) || m_RenderData.pCurrentMonData->primaryFB.m_vSize != pMonitor->vecPixelSize) {
|
||||||
m_RenderData.pCurrentMonData->stencilTex.allocate();
|
m_RenderData.pCurrentMonData->stencilTex.allocate();
|
||||||
|
|
||||||
m_RenderData.pCurrentMonData->primaryFB.m_pStencilTex = &m_RenderData.pCurrentMonData->stencilTex;
|
m_RenderData.pCurrentMonData->primaryFB.m_pStencilTex = &m_RenderData.pCurrentMonData->stencilTex;
|
||||||
|
|
Loading…
Reference in a new issue