mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 01:25:58 +01:00
Merge branch 'main' into rework_rounding_shader
This commit is contained in:
commit
168a326609
3 changed files with 40 additions and 14 deletions
|
@ -170,7 +170,25 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
|
|||
}
|
||||
|
||||
bool isNumber(const std::string& str, bool allowfloat) {
|
||||
return std::ranges::all_of(str.begin(), str.end(), [&](char c) { return isdigit(c) != 0 || c == '-' || (allowfloat && c == '.'); });
|
||||
|
||||
std::string copy = str;
|
||||
if (*copy.begin() == '-')
|
||||
copy = copy.substr(1);
|
||||
|
||||
bool point = !allowfloat;
|
||||
for (auto& c : copy) {
|
||||
if (c == '.') {
|
||||
if (point)
|
||||
return false;
|
||||
point = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!std::isdigit(c))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isDirection(const std::string& arg) {
|
||||
|
@ -192,7 +210,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
|||
}
|
||||
outName = WORKSPACENAME;
|
||||
} else {
|
||||
if (in[0] == 'm' || in[0] == 'e') {
|
||||
if ((in[0] == 'm' || in[0] == 'e') && (in[1] == '-' || in[1] == '+') && isNumber(in.substr(2))) {
|
||||
bool onAllMonitors = in[0] == 'e';
|
||||
|
||||
if (!g_pCompositor->m_pLastMonitor) {
|
||||
|
@ -253,14 +271,22 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
|||
outName = g_pCompositor->getWorkspaceByID(currentID)->m_szName;
|
||||
|
||||
} else {
|
||||
if (in[0] == '+' || in[0] == '-') {
|
||||
if (g_pCompositor->m_pLastMonitor)
|
||||
result = std::max((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1);
|
||||
else if (isNumber(in))
|
||||
result = std::max(std::stoi(in), 1);
|
||||
else {
|
||||
Debug::log(ERR, "Relative workspace on no mon!");
|
||||
result = INT_MAX;
|
||||
}
|
||||
} else if (isNumber(in))
|
||||
result = std::max(std::stoi(in), 1);
|
||||
else {
|
||||
// maybe name
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByName(in);
|
||||
if (PWORKSPACE)
|
||||
result = PWORKSPACE->m_iID;
|
||||
}
|
||||
|
||||
outName = std::to_string(result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -819,8 +819,8 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
|||
return;
|
||||
}
|
||||
|
||||
auto PSAVEDSIZE = PWINDOW->m_vRealSize.vec();
|
||||
auto PSAVEDPOS = PWINDOW->m_vRealPosition.vec();
|
||||
auto PSAVEDSIZE = PWINDOW->m_vRealSize.goalv();
|
||||
auto PSAVEDPOS = PWINDOW->m_vRealPosition.goalv();
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
|
||||
|
||||
|
|
|
@ -22,17 +22,17 @@ inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVar
|
|||
|
||||
if (primitiveMultisample == 1 && dist > radius - 1.0) {
|
||||
float distances = 0.0;
|
||||
if (length(pixCoord - vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (length(pixCoord - vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (length(pixCoord - vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
if (length(pixCoord - vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
if (length(pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (length(pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (length(pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
if (length(pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
|
||||
if (distances == 0.0)
|
||||
discard;
|
||||
|
||||
distances = distances / 4.0;
|
||||
|
||||
/* )#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances; */
|
||||
)#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue