modified:   src/config/ConfigManager.hpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
This commit is contained in:
MightyPlaza 2024-07-05 22:21:19 +01:00
parent 18d3b110df
commit d460220d66
No known key found for this signature in database
GPG key ID: 284C27FD27A6DC0D
4 changed files with 35 additions and 40 deletions

View file

@ -187,7 +187,6 @@ class CConfigManager {
{"forcergbx", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.RGBX; }},
{"immediate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.tearing; }},
{"xray", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.xray; }},
{"windowdance", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.windowDanceCompat; }},
};
std::unordered_map<std::string, std::function<CWindowOverridableVar<int>*(PHLWINDOW)>> miWindowProperties = {

View file

@ -1214,22 +1214,22 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
PWINDOW->setHidden(false);
} else if (PROP == "alpha") {
PWINDOW->m_sWindowData.alpha = CWindowOverridableVar(sAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alpha.value_or_default().m_bOverride}, PRIORITY_SET_PROP);
PWINDOW->m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alpha.value_or_default().m_bOverride}, PRIORITY_SET_PROP);
} else if (PROP == "alphainactive") {
PWINDOW->m_sWindowData.alphaInactive =
CWindowOverridableVar(sAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaInactive.value_or_default().m_bOverride}, PRIORITY_SET_PROP);
CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaInactive.value_or_default().m_bOverride}, PRIORITY_SET_PROP);
} else if (PROP == "alphafullscreen") {
PWINDOW->m_sWindowData.alphaFullscreen =
CWindowOverridableVar(sAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaFullscreen.value_or_default().m_bOverride}, PRIORITY_SET_PROP);
CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaFullscreen.value_or_default().m_bOverride}, PRIORITY_SET_PROP);
} else if (PROP == "alphaoverride") {
PWINDOW->m_sWindowData.alpha =
CWindowOverridableVar(sAlphaValue{PWINDOW->m_sWindowData.alpha.value_or_default().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alpha.value_or_default().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
} else if (PROP == "alphainactiveoverride") {
PWINDOW->m_sWindowData.alphaInactive =
CWindowOverridableVar(sAlphaValue{PWINDOW->m_sWindowData.alphaInactive.value_or_default().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaInactive.value_or_default().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
} else if (PROP == "alphafullscreenoverride") {
PWINDOW->m_sWindowData.alphaFullscreen =
CWindowOverridableVar(sAlphaValue{PWINDOW->m_sWindowData.alphaFullscreen.value_or_default().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaFullscreen.value_or_default().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
} else if (PROP == "activebordercolor" || PROP == "inactivebordercolor") {
CGradientValueData colorData = {};
if (vars.size() > 4) {

View file

@ -628,18 +628,18 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
if (r == "override") {
if (opacityIDX == 1)
m_sWindowData.alpha = CWindowOverridableVar(sAlphaValue{m_sWindowData.alpha.value().m_fAlpha, true}, priority);
m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{m_sWindowData.alpha.value().m_fAlpha, true}, priority);
else if (opacityIDX == 2)
m_sWindowData.alphaInactive = CWindowOverridableVar(sAlphaValue{m_sWindowData.alphaInactive.value().m_fAlpha, true}, priority);
m_sWindowData.alphaInactive = CWindowOverridableVar(SAlphaValue{m_sWindowData.alphaInactive.value().m_fAlpha, true}, priority);
else if (opacityIDX == 3)
m_sWindowData.alphaFullscreen = CWindowOverridableVar(sAlphaValue{m_sWindowData.alphaFullscreen.value().m_fAlpha, true}, priority);
m_sWindowData.alphaFullscreen = CWindowOverridableVar(SAlphaValue{m_sWindowData.alphaFullscreen.value().m_fAlpha, true}, priority);
} else {
if (opacityIDX == 0) {
m_sWindowData.alpha = CWindowOverridableVar(sAlphaValue{std::stof(r), false}, priority);
m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority);
} else if (opacityIDX == 1) {
m_sWindowData.alphaInactive = CWindowOverridableVar(sAlphaValue{std::stof(r), false}, priority);
m_sWindowData.alphaInactive = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority);
} else if (opacityIDX == 2) {
m_sWindowData.alphaFullscreen = CWindowOverridableVar(sAlphaValue{std::stof(r), false}, priority);
m_sWindowData.alphaFullscreen = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority);
} else {
throw std::runtime_error("more than 3 alpha values");
}
@ -1480,9 +1480,6 @@ void CWindow::onX11Configure(CBox box) {
m_bCreatedOverFullscreen = true;
if (!m_sWindowData.windowDanceCompat.value_or_default())
g_pInputManager->refocus();
g_pHyprRenderer->damageWindow(m_pSelf.lock());
}

View file

@ -59,7 +59,7 @@ enum eSuppressEvents {
class IWindowTransformer;
struct sAlphaValue {
struct SAlphaValue {
float m_fAlpha;
bool m_bOverride;
@ -118,7 +118,7 @@ class CWindowOverridableVar {
throw std::bad_optional_access();
}
T value_or(T const& other) {
T value_or(T const other) {
if (has_value())
return value();
else
@ -149,29 +149,28 @@ class CWindowOverridableVar {
};
struct SWindowData {
CWindowOverridableVar<sAlphaValue> alpha = sAlphaValue{1.f, false};
CWindowOverridableVar<sAlphaValue> alphaInactive = sAlphaValue{1.f, false};
CWindowOverridableVar<sAlphaValue> alphaFullscreen = sAlphaValue{1.f, false};
CWindowOverridableVar<SAlphaValue> alpha = SAlphaValue{1.f, false};
CWindowOverridableVar<SAlphaValue> alphaInactive = SAlphaValue{1.f, false};
CWindowOverridableVar<SAlphaValue> alphaFullscreen = SAlphaValue{1.f, false};
CWindowOverridableVar<bool> allowsInput = false;
CWindowOverridableVar<bool> dimAround = false;
CWindowOverridableVar<bool> decorate = true;
CWindowOverridableVar<bool> focusOnActivate = false;
CWindowOverridableVar<bool> keepAspectRatio = false;
CWindowOverridableVar<bool> nearestNeighbor = false;
CWindowOverridableVar<bool> noAnim = false;
CWindowOverridableVar<bool> noBorder = false;
CWindowOverridableVar<bool> noBlur = false;
CWindowOverridableVar<bool> noDim = false;
CWindowOverridableVar<bool> noFocus = false;
CWindowOverridableVar<bool> noMaxSize = false;
CWindowOverridableVar<bool> noRounding = false;
CWindowOverridableVar<bool> noShadow = false;
CWindowOverridableVar<bool> opaque = false;
CWindowOverridableVar<bool> RGBX = false;
CWindowOverridableVar<bool> tearing = false;
CWindowOverridableVar<bool> xray = false;
CWindowOverridableVar<bool> windowDanceCompat = false;
CWindowOverridableVar<bool> allowsInput = false;
CWindowOverridableVar<bool> dimAround = false;
CWindowOverridableVar<bool> decorate = true;
CWindowOverridableVar<bool> focusOnActivate = false;
CWindowOverridableVar<bool> keepAspectRatio = false;
CWindowOverridableVar<bool> nearestNeighbor = false;
CWindowOverridableVar<bool> noAnim = false;
CWindowOverridableVar<bool> noBorder = false;
CWindowOverridableVar<bool> noBlur = false;
CWindowOverridableVar<bool> noDim = false;
CWindowOverridableVar<bool> noFocus = false;
CWindowOverridableVar<bool> noMaxSize = false;
CWindowOverridableVar<bool> noRounding = false;
CWindowOverridableVar<bool> noShadow = false;
CWindowOverridableVar<bool> opaque = false;
CWindowOverridableVar<bool> RGBX = false;
CWindowOverridableVar<bool> tearing = false;
CWindowOverridableVar<bool> xray = false;
CWindowOverridableVar<int> rounding;
CWindowOverridableVar<int> borderSize;