added ls blurring

This commit is contained in:
vaxerski 2022-07-06 22:12:03 +02:00
parent 6a16f11d63
commit 1cf2f378d4
5 changed files with 35 additions and 1 deletions

View file

@ -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) { void CConfigManager::handleDefaultWorkspace(const std::string& command, const std::string& value) {
const auto DISPLAY = value.substr(0, value.find_first_of(',')); 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 == "animation") handleAnimation(COMMAND, VALUE);
else if (COMMAND == "source") handleSource(COMMAND, VALUE); else if (COMMAND == "source") handleSource(COMMAND, VALUE);
else if (COMMAND == "submap") handleSubmap(COMMAND, VALUE); else if (COMMAND == "submap") handleSubmap(COMMAND, VALUE);
else if (COMMAND == "blurls") handleBlurLS(COMMAND, VALUE);
else else
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE); configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
@ -772,6 +777,7 @@ void CConfigManager::loadConfigLoadVars() {
m_mAdditionalReservedAreas.clear(); m_mAdditionalReservedAreas.clear();
configDynamicVars.clear(); configDynamicVars.clear();
deviceConfigs.clear(); deviceConfigs.clear();
m_dBlurLSNamespaces.clear();
// paths // paths
configPaths.clear(); configPaths.clear();
@ -1103,3 +1109,12 @@ bool CConfigManager::deviceConfigExists(const std::string& dev) {
return it != deviceConfigs.end(); return it != deviceConfigs.end();
} }
bool CConfigManager::shouldBlurLS(const std::string& ns) {
for (auto& bls : m_dBlurLSNamespaces) {
if (bls == ns) {
return true;
}
}
return false;
}

View file

@ -65,6 +65,7 @@ public:
float getDeviceFloat(const std::string&, const std::string&); float getDeviceFloat(const std::string&, const std::string&);
std::string getDeviceString(const std::string&, const std::string&); std::string getDeviceString(const std::string&, const std::string&);
bool deviceConfigExists(const std::string&); bool deviceConfigExists(const std::string&);
bool shouldBlurLS(const std::string&);
SConfigValue* getConfigValuePtr(std::string); SConfigValue* getConfigValuePtr(std::string);
@ -102,6 +103,7 @@ private:
std::deque<SMonitorRule> m_dMonitorRules; std::deque<SMonitorRule> m_dMonitorRules;
std::deque<SWindowRule> m_dWindowRules; std::deque<SWindowRule> m_dWindowRules;
std::deque<std::string> m_dBlurLSNamespaces;
bool firstExecDispatched = false; bool firstExecDispatched = false;
std::deque<std::string> firstExecRequests; std::deque<std::string> firstExecRequests;
@ -127,6 +129,7 @@ private:
void handleAnimation(const std::string&, const std::string&); void handleAnimation(const std::string&, const std::string&);
void handleSource(const std::string&, const std::string&); void handleSource(const std::string&, const std::string&);
void handleSubmap(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; inline std::unique_ptr<CConfigManager> g_pConfigManager;

View file

@ -51,6 +51,8 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
WLRLAYERSURFACE->data = layerSurface; WLRLAYERSURFACE->data = layerSurface;
layerSurface->monitorID = PMONITOR->ID; 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()); Debug::log(LOG, "LayerSurface %x (namespace %s layer %d) created on monitor %s", layerSurface->layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer, PMONITOR->szName.c_str());
} }

View file

@ -31,6 +31,8 @@ struct SLayerSurface {
bool fadingOut = false; bool fadingOut = false;
bool readyToDelete = false; bool readyToDelete = false;
bool forceBlur = false;
// For the list lookup // For the list lookup
bool operator==(const SLayerSurface& rhs) { bool operator==(const SLayerSurface& rhs) {
return layerSurface == rhs.layerSurface && monitorID == rhs.monitorID; return layerSurface == rhs.layerSurface && monitorID == rhs.monitorID;
@ -62,6 +64,9 @@ struct SRenderData {
// for custom round values // for custom round values
int rounding = -1; // -1 means not set int rounding = -1; // -1 means not set
// for blurring
bool blur = false;
}; };
struct SKeyboard { struct SKeyboard {

View file

@ -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; float rounding = RDATA->dontRound ? 0 : RDATA->rounding == -1 ? *PROUNDING : RDATA->rounding;
if (RDATA->surface && surface == RDATA->surface) { 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) { if (RDATA->decorate) {
auto col = g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColor.col(); 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.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.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.rounding = pWindow->m_sAdditionalConfigData.rounding;
renderdata.blur = true; // if it shouldn't, it will be ignored later
// apply window special data // apply window special data
if (pWindow->m_sSpecialRenderData.alphaInactive == -1) 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}; SRenderData renderdata = {pMonitor->output, time, pLayer->geometry.x, pLayer->geometry.y};
renderdata.fadeAlpha = pLayer->alpha.fl(); 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); wlr_surface_for_each_surface(pLayer->layerSurface->surface, renderSurface, &renderdata);
} }