summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-28 17:48:01 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-28 17:48:01 +0200
commit7f1f14fe85f53fcf12849632d3f003f00cca7578 (patch)
treed82738e23b95ec401e5ccc0c859203b61fe8cd42 /src
parent7d442d48514e62a41e5bad0176adb8428dd112b3 (diff)
Added a rounding rule
Diffstat (limited to 'src')
-rw-r--r--src/Window.hpp1
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/events/Windows.cpp6
-rw-r--r--src/helpers/WLClasses.hpp3
-rw-r--r--src/render/Renderer.cpp7
5 files changed, 16 insertions, 2 deletions
diff --git a/src/Window.hpp b/src/Window.hpp
index c7b711c2..238d02e0 100644
--- a/src/Window.hpp
+++ b/src/Window.hpp
@@ -11,6 +11,7 @@ struct SWindowSpecialRenderData {
struct SWindowAdditionalConfigData {
std::string animationStyle = "";
+ int rounding = -1; // -1 means no
};
class CWindow {
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 48371fbb..281267c6 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -412,6 +412,7 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str
&& RULE.find("monitor") != 0
&& RULE.find("nofocus") != 0
&& RULE.find("animation") != 0
+ && RULE.find("rounding") != 0
&& RULE.find("workspace") != 0) {
Debug::log(ERR, "Invalid rule found: %s", RULE.c_str());
parseError = "Invalid rule found: " + RULE;
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index 2133a37f..9d432b1d 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -101,6 +101,12 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_bIsPseudotiled = true;
} else if (r.szRule.find("nofocus") == 0) {
PWINDOW->m_bNoFocus = true;
+ } else if (r.szRule.find("rounding") == 0) {
+ try {
+ PWINDOW->m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
+ } catch (std::exception& e) {
+ Debug::log(ERR, "Rounding rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());
+ }
} else if (r.szRule.find("opacity") == 0) {
try {
PWINDOW->m_sSpecialRenderData.alpha = std::stof(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp
index 5add3e51..e547f541 100644
--- a/src/helpers/WLClasses.hpp
+++ b/src/helpers/WLClasses.hpp
@@ -57,6 +57,9 @@ struct SRenderData {
// for decorations (border)
bool decorate = false;
+
+ // for custom round values
+ int rounding = -1; // -1 means not set
};
struct SKeyboard {
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 23ff3073..1a3512f3 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -19,10 +19,12 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
}
scaleBox(&windowBox, RDATA->output->scale);
+ float rounding = RDATA->dontRound ? 0 : RDATA->rounding == -1 ? g_pConfigManager->getInt("decoration:rounding") : RDATA->rounding;
+
if (RDATA->surface && surface == RDATA->surface)
- g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"), RDATA->decorate);
+ g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, rounding, RDATA->decorate);
else
- g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"), false, false);
+ g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, false, false);
wlr_surface_send_frame_done(surface, RDATA->when);
@@ -99,6 +101,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (PWORKSPACE->m_fAlpha.fl() / 255.f);
renderdata.alpha = pWindow->m_bIsFullscreen ? g_pConfigManager->getFloat("decoration:fullscreen_opacity") : pWindow == g_pCompositor->m_pLastWindow ? g_pConfigManager->getFloat("decoration:active_opacity") : g_pConfigManager->getFloat("decoration:inactive_opacity");
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders;
+ renderdata.rounding = pWindow->m_sAdditionalConfigData.rounding;
// apply window special data
renderdata.alpha *= pWindow->m_sSpecialRenderData.alpha;