renderer: add "noscreenshare" layer rule (#11664)
This commit is contained in:
parent
45f007d412
commit
26f293523a
5 changed files with 27 additions and 2 deletions
|
|
@ -4,7 +4,7 @@
|
|||
#include <algorithm>
|
||||
#include "../debug/Log.hpp"
|
||||
|
||||
static const auto RULES = std::unordered_set<std::string>{"noanim", "blur", "blurpopups", "dimaround"};
|
||||
static const auto RULES = std::unordered_set<std::string>{"noanim", "blur", "blurpopups", "dimaround", "noscreenshare"};
|
||||
static const auto RULES_PREFIX = std::unordered_set<std::string>{"ignorealpha", "ignorezero", "xray", "animation", "order", "abovelock"};
|
||||
|
||||
CLayerRule::CLayerRule(const std::string& rule_, const std::string& ns_) : m_targetNamespace(ns_), m_rule(rule_) {
|
||||
|
|
@ -21,6 +21,8 @@ CLayerRule::CLayerRule(const std::string& rule_, const std::string& ns_) : m_tar
|
|||
m_ruleType = RULE_BLURPOPUPS;
|
||||
else if (m_rule == "dimaround")
|
||||
m_ruleType = RULE_DIMAROUND;
|
||||
else if (m_rule == "noscreenshare")
|
||||
m_ruleType = RULE_NOSCREENSHARE;
|
||||
else if (m_rule.starts_with("ignorealpha"))
|
||||
m_ruleType = RULE_IGNOREALPHA;
|
||||
else if (m_rule.starts_with("ignorezero"))
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class CLayerRule {
|
|||
RULE_ANIMATION,
|
||||
RULE_ORDER,
|
||||
RULE_ZUMBA,
|
||||
RULE_NOSCREENSHARE
|
||||
};
|
||||
|
||||
eRuleType m_ruleType = RULE_INVALID;
|
||||
|
|
|
|||
|
|
@ -388,8 +388,9 @@ void CLayerSurface::applyRules() {
|
|||
m_noAnimations = false;
|
||||
m_forceBlur = false;
|
||||
m_ignoreAlpha = false;
|
||||
m_ignoreAlphaValue = 0.f;
|
||||
m_dimAround = false;
|
||||
m_noScreenShare = false;
|
||||
m_ignoreAlphaValue = 0.f;
|
||||
m_xray = -1;
|
||||
m_animationStyle.reset();
|
||||
|
||||
|
|
@ -425,6 +426,10 @@ void CLayerSurface::applyRules() {
|
|||
m_dimAround = true;
|
||||
break;
|
||||
}
|
||||
case CLayerRule::RULE_NOSCREENSHARE: {
|
||||
m_noScreenShare = true;
|
||||
break;
|
||||
}
|
||||
case CLayerRule::RULE_XRAY: {
|
||||
CVarList vars{rule->m_rule, 0, ' '};
|
||||
m_xray = configStringToInt(vars[1]).value_or(false);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class CLayerSurface {
|
|||
bool m_ignoreAlpha = false;
|
||||
float m_ignoreAlphaValue = 0.f;
|
||||
bool m_dimAround = false;
|
||||
bool m_noScreenShare = false;
|
||||
int64_t m_order = 0;
|
||||
bool m_aboveLockscreen = false;
|
||||
bool m_aboveLockscreenInteractable = false;
|
||||
|
|
|
|||
|
|
@ -211,6 +211,22 @@ void CScreencopyFrame::renderMon() {
|
|||
g_pHyprOpenGL->setRenderModifEnabled(true);
|
||||
g_pHyprOpenGL->popMonitorTransformEnabled();
|
||||
|
||||
for (auto const& l : g_pCompositor->m_layers) {
|
||||
if (!l->m_noScreenShare)
|
||||
continue;
|
||||
|
||||
if UNLIKELY ((!l->m_mapped && !l->m_fadingOut) || l->m_alpha->value() == 0.f)
|
||||
continue;
|
||||
|
||||
const auto REALPOS = l->m_realPosition->value();
|
||||
const auto REALSIZE = l->m_realSize->value();
|
||||
|
||||
const auto noScreenShareBox =
|
||||
CBox{REALPOS.x, REALPOS.y, std::max(REALSIZE.x, 5.0), std::max(REALSIZE.y, 5.0)}.translate(-m_monitor->m_position).scale(m_monitor->m_scale).translate(-m_box.pos());
|
||||
|
||||
g_pHyprOpenGL->renderRect(noScreenShareBox, Colors::BLACK, {});
|
||||
}
|
||||
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (!w->m_windowData.noScreenShare.valueOrDefault())
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue