summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-06 22:12:03 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-06 22:12:03 +0200
commit1cf2f378d4a0e5e3da757d90404c2816a6765626 (patch)
tree642ada164ed224ecc8efcf691ffaae06eee57c36 /src
parent6a16f11d63cead0b8526f442c18727a6f3dc76ea (diff)
added ls blurring
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp15
-rw-r--r--src/config/ConfigManager.hpp3
-rw-r--r--src/events/Layers.cpp2
-rw-r--r--src/helpers/WLClasses.hpp5
-rw-r--r--src/render/Renderer.cpp11
5 files changed, 35 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index ded23733..2e594a4f 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -552,6 +552,10 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str
}
+void CConfigManager::handleBlurLS(const std::string& command, const std::string& value) {
+ m_dBlurLSNamespaces.emplace_back(value);
+}
+
void CConfigManager::handleDefaultWorkspace(const std::string& command, const std::string& value) {
const auto DISPLAY = value.substr(0, value.find_first_of(','));
@@ -670,6 +674,7 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
else if (COMMAND == "animation") handleAnimation(COMMAND, VALUE);
else if (COMMAND == "source") handleSource(COMMAND, VALUE);
else if (COMMAND == "submap") handleSubmap(COMMAND, VALUE);
+ else if (COMMAND == "blurls") handleBlurLS(COMMAND, VALUE);
else
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
@@ -772,6 +777,7 @@ void CConfigManager::loadConfigLoadVars() {
m_mAdditionalReservedAreas.clear();
configDynamicVars.clear();
deviceConfigs.clear();
+ m_dBlurLSNamespaces.clear();
// paths
configPaths.clear();
@@ -1103,3 +1109,12 @@ bool CConfigManager::deviceConfigExists(const std::string& dev) {
return it != deviceConfigs.end();
}
+bool CConfigManager::shouldBlurLS(const std::string& ns) {
+ for (auto& bls : m_dBlurLSNamespaces) {
+ if (bls == ns) {
+ return true;
+ }
+ }
+
+ return false;
+}
diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp
index bcb2fbe5..1d281c40 100644
--- a/src/config/ConfigManager.hpp
+++ b/src/config/ConfigManager.hpp
@@ -65,6 +65,7 @@ public:
float getDeviceFloat(const std::string&, const std::string&);
std::string getDeviceString(const std::string&, const std::string&);
bool deviceConfigExists(const std::string&);
+ bool shouldBlurLS(const std::string&);
SConfigValue* getConfigValuePtr(std::string);
@@ -102,6 +103,7 @@ private:
std::deque<SMonitorRule> m_dMonitorRules;
std::deque<SWindowRule> m_dWindowRules;
+ std::deque<std::string> m_dBlurLSNamespaces;
bool firstExecDispatched = false;
std::deque<std::string> firstExecRequests;
@@ -127,6 +129,7 @@ private:
void handleAnimation(const std::string&, const std::string&);
void handleSource(const std::string&, const std::string&);
void handleSubmap(const std::string&, const std::string&);
+ void handleBlurLS(const std::string&, const std::string&);
};
inline std::unique_ptr<CConfigManager> g_pConfigManager; \ No newline at end of file
diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp
index 495dfc1b..d924935b 100644
--- a/src/events/Layers.cpp
+++ b/src/events/Layers.cpp
@@ -51,6 +51,8 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
WLRLAYERSURFACE->data = layerSurface;
layerSurface->monitorID = PMONITOR->ID;
+ layerSurface->forceBlur = g_pConfigManager->shouldBlurLS(layerSurface->szNamespace);
+
Debug::log(LOG, "LayerSurface %x (namespace %s layer %d) created on monitor %s", layerSurface->layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer, PMONITOR->szName.c_str());
}
diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp
index 0ab4c52b..b06390b5 100644
--- a/src/helpers/WLClasses.hpp
+++ b/src/helpers/WLClasses.hpp
@@ -31,6 +31,8 @@ struct SLayerSurface {
bool fadingOut = false;
bool readyToDelete = false;
+ bool forceBlur = false;
+
// For the list lookup
bool operator==(const SLayerSurface& rhs) {
return layerSurface == rhs.layerSurface && monitorID == rhs.monitorID;
@@ -62,6 +64,9 @@ struct SRenderData {
// for custom round values
int rounding = -1; // -1 means not set
+
+ // for blurring
+ bool blur = false;
};
struct SKeyboard {
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 307229a1..aea9401c 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -23,7 +23,10 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
float rounding = RDATA->dontRound ? 0 : RDATA->rounding == -1 ? *PROUNDING : RDATA->rounding;
if (RDATA->surface && surface == RDATA->surface) {
- g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, rounding);
+ if (RDATA->blur)
+ g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, rounding);
+ else
+ g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
if (RDATA->decorate) {
auto col = g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColor.col();
@@ -169,6 +172,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
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 && (pWindow->m_bIsFloating ? *PNOFLOATINGBORDERS == 0 : true) && (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL);
renderdata.rounding = pWindow->m_sAdditionalConfigData.rounding;
+ renderdata.blur = true; // if it shouldn't, it will be ignored later
// apply window special data
if (pWindow->m_sSpecialRenderData.alphaInactive == -1)
@@ -221,6 +225,11 @@ void CHyprRenderer::renderLayer(SLayerSurface* pLayer, SMonitor* pMonitor, times
SRenderData renderdata = {pMonitor->output, time, pLayer->geometry.x, pLayer->geometry.y};
renderdata.fadeAlpha = pLayer->alpha.fl();
+ renderdata.blur = pLayer->forceBlur;
+ renderdata.surface = pLayer->layerSurface->surface;
+ renderdata.decorate = false;
+ renderdata.w = pLayer->geometry.width;
+ renderdata.h = pLayer->geometry.height;
wlr_surface_for_each_surface(pLayer->layerSurface->surface, renderSurface, &renderdata);
}