aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRyan <[email protected]>2024-11-23 09:29:29 -0500
committerGitHub <[email protected]>2024-11-23 14:29:29 +0000
commit451d7a41fc87529854c4116c96a7c6a46568a1ee (patch)
tree1489ca7b9f11cfde13114c25a2c32e3c62f02846 /src
parent00d6261cc06716eac6bdfc9d4426c3a54597098c (diff)
downloadHyprland-451d7a41fc87529854c4116c96a7c6a46568a1ee.tar.gz
Hyprland-451d7a41fc87529854c4116c96a7c6a46568a1ee.zip
renderer: add option to blur IME popups (#8521)
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigDescriptions.hpp12
-rw-r--r--src/config/ConfigManager.cpp2
-rw-r--r--src/render/Renderer.cpp11
3 files changed, 24 insertions, 1 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp
index 2e3a6720..45379140 100644
--- a/src/config/ConfigDescriptions.hpp
+++ b/src/config/ConfigDescriptions.hpp
@@ -331,6 +331,18 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.type = CONFIG_OPTION_FLOAT,
.data = SConfigOptionDescription::SFloatData{0.2, 0, 1},
},
+ SConfigOptionDescription{
+ .value = "blur:input_methods",
+ .description = "whether to blur input methods (e.g. fcitx5)",
+ .type = CONFIG_OPTION_BOOL,
+ .data = SConfigOptionDescription::SBoolData{false},
+ },
+ SConfigOptionDescription{
+ .value = "blur:input_methods_ignorealpha",
+ .description = "works like ignorealpha in layer rules. If pixel opacity is below set value, will not blur. [0.0 - 1.0]",
+ .type = CONFIG_OPTION_FLOAT,
+ .data = SConfigOptionDescription::SFloatData{0.2, 0, 1},
+ },
/*
* animations:
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index f6734011..32f64f0a 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -429,6 +429,8 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("decoration:blur:special", Hyprlang::INT{0});
m_pConfig->addConfigValue("decoration:blur:popups", Hyprlang::INT{0});
m_pConfig->addConfigValue("decoration:blur:popups_ignorealpha", {0.2F});
+ m_pConfig->addConfigValue("decoration:blur:input_methods", Hyprlang::INT{0});
+ m_pConfig->addConfigValue("decoration:blur:input_methods_ignorealpha", {0.2F});
m_pConfig->addConfigValue("decoration:active_opacity", {1.F});
m_pConfig->addConfigValue("decoration:inactive_opacity", {1.F});
m_pConfig->addConfigValue("decoration:fullscreen_opacity", {1.F});
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 57490d23..dae62851 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -850,12 +850,21 @@ void CHyprRenderer::renderIMEPopup(CInputPopup* pPopup, PHLMONITOR pMonitor, tim
const auto SURF = pPopup->getSurface();
- renderdata.blur = false;
renderdata.surface = SURF;
renderdata.decorate = false;
renderdata.w = SURF->current.size.x;
renderdata.h = SURF->current.size.y;
+ static auto PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
+ static auto PBLURIMES = CConfigValue<Hyprlang::INT>("decoration:blur:input_methods");
+ static auto PBLURIGNOREA = CConfigValue<Hyprlang::FLOAT>("decoration:blur:input_methods_ignorealpha");
+
+ renderdata.blur = *PBLURIMES && *PBLUR;
+ if (renderdata.blur) {
+ g_pHyprOpenGL->m_RenderData.discardMode |= DISCARD_ALPHA;
+ g_pHyprOpenGL->m_RenderData.discardOpacity = *PBLURIGNOREA;
+ }
+
SURF->breadthfirst([](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) { renderSurface(s, offset.x, offset.y, data); }, &renderdata);
}