Merge remote-tracking branch 'upstream/main' into pin-fullscreen

This commit is contained in:
littleblack111 2024-11-21 17:21:49 +08:00
commit 55c781f3f8
No known key found for this signature in database
GPG key ID: 45AE0FF5962FA6EF
5 changed files with 10 additions and 10 deletions

View file

@ -2102,13 +2102,13 @@ std::optional<std::string> CConfigManager::handleAnimation(const std::string& co
PANIM->second.pValues = &PANIM->second; PANIM->second.pValues = &PANIM->second;
// This helper casts strings like "1", "true", "off", "yes"... to int. // This helper casts strings like "1", "true", "off", "yes"... to int.
int64_t enabledInt = configStringToInt(ARGS[1]) == 1; int64_t enabledInt = configStringToInt(ARGS[1]).value_or(0) == 1;
// Checking that the int is 1 or 0 because the helper can return integers out of range. // Checking that the int is 1 or 0 because the helper can return integers out of range.
if (enabledInt != 0 && enabledInt != 1) if (enabledInt != 0 && enabledInt != 1)
return "invalid animation on/off state"; return "invalid animation on/off state";
PANIM->second.internalEnabled = configStringToInt(ARGS[1]) == 1; PANIM->second.internalEnabled = configStringToInt(ARGS[1]).value_or(0) == 1;
if (PANIM->second.internalEnabled) { if (PANIM->second.internalEnabled) {
// speed // speed

View file

@ -707,7 +707,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
*(search->second(m_pSelf.lock())) = CWindowOverridableVar(true, priority); *(search->second(m_pSelf.lock())) = CWindowOverridableVar(true, priority);
} else { } else {
try { try {
*(search->second(m_pSelf.lock())) = CWindowOverridableVar((bool)configStringToInt(VARS[1]), priority); *(search->second(m_pSelf.lock())) = CWindowOverridableVar((bool)configStringToInt(VARS[1]).value_or(0), priority);
} catch (...) {} } catch (...) {}
} }
} else if (auto search = g_pConfigManager->miWindowProperties.find(VARS[0]); search != g_pConfigManager->miWindowProperties.end()) { } else if (auto search = g_pConfigManager->miWindowProperties.find(VARS[0]); search != g_pConfigManager->miWindowProperties.end()) {

View file

@ -332,7 +332,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
const auto SHOULDBESPECIAL = configStringToInt(prop); const auto SHOULDBESPECIAL = configStringToInt(prop);
if ((bool)SHOULDBESPECIAL != m_bIsSpecialWorkspace) if (SHOULDBESPECIAL && (bool)*SHOULDBESPECIAL != m_bIsSpecialWorkspace)
return false; return false;
continue; continue;
} }
@ -367,7 +367,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
const auto WANTSNAMED = configStringToInt(prop); const auto WANTSNAMED = configStringToInt(prop);
if (WANTSNAMED != (m_iID <= -1337)) if (WANTSNAMED && *WANTSNAMED != (m_iID <= -1337))
return false; return false;
continue; continue;
} }

View file

@ -2961,13 +2961,13 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP); CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP);
} else if (PROP == "alphaoverride") { } else if (PROP == "alphaoverride") {
PWINDOW->m_sWindowData.alpha = PWINDOW->m_sWindowData.alpha =
CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alpha.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP); CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alpha.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
} else if (PROP == "alphainactiveoverride") { } else if (PROP == "alphainactiveoverride") {
PWINDOW->m_sWindowData.alphaInactive = PWINDOW->m_sWindowData.alphaInactive =
CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaInactive.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP); CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaInactive.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
} else if (PROP == "alphafullscreenoverride") { } else if (PROP == "alphafullscreenoverride") {
PWINDOW->m_sWindowData.alphaFullscreen = PWINDOW->m_sWindowData.alphaFullscreen =
CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP); CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
} else if (PROP == "activebordercolor" || PROP == "inactivebordercolor") { } else if (PROP == "activebordercolor" || PROP == "inactivebordercolor") {
CGradientValueData colorData = {}; CGradientValueData colorData = {};
if (vars.size() > 4) { if (vars.size() > 4) {
@ -2998,7 +2998,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
else if (VAL == "unset") else if (VAL == "unset")
pWindowDataElement->unset(PRIORITY_SET_PROP); pWindowDataElement->unset(PRIORITY_SET_PROP);
else else
*pWindowDataElement = CWindowOverridableVar((bool)configStringToInt(VAL), PRIORITY_SET_PROP); *pWindowDataElement = CWindowOverridableVar((bool)configStringToInt(VAL).value_or(0), PRIORITY_SET_PROP);
} else if (auto search = g_pConfigManager->miWindowProperties.find(PROP); search != g_pConfigManager->miWindowProperties.end()) { } else if (auto search = g_pConfigManager->miWindowProperties.find(PROP); search != g_pConfigManager->miWindowProperties.end()) {
if (VAL == "unset") if (VAL == "unset")
search->second(PWINDOW)->unset(PRIORITY_SET_PROP); search->second(PWINDOW)->unset(PRIORITY_SET_PROP);

View file

@ -174,7 +174,6 @@ static void renderSurface(SP<CWLSurfaceResource> surface, int x, int y, void* da
} }
const auto RDATA = (SRenderData*)data; const auto RDATA = (SRenderData*)data;
const bool BLUR = RDATA->blur && !TEXTURE->m_bOpaque;
const auto INTERACTIVERESIZEINPROGRESS = RDATA->pWindow && g_pInputManager->currentlyDraggedWindow && g_pInputManager->dragMode == MBIND_RESIZE; const auto INTERACTIVERESIZEINPROGRESS = RDATA->pWindow && g_pInputManager->currentlyDraggedWindow && g_pInputManager->dragMode == MBIND_RESIZE;
TRACY_GPU_ZONE("RenderSurface"); TRACY_GPU_ZONE("RenderSurface");
@ -183,6 +182,7 @@ static void renderSurface(SP<CWLSurfaceResource> surface, int x, int y, void* da
auto PSURFACE = CWLSurface::fromResource(surface); auto PSURFACE = CWLSurface::fromResource(surface);
const float ALPHA = RDATA->alpha * RDATA->fadeAlpha * (PSURFACE ? PSURFACE->m_pAlphaModifier : 1.F); const float ALPHA = RDATA->alpha * RDATA->fadeAlpha * (PSURFACE ? PSURFACE->m_pAlphaModifier : 1.F);
const bool BLUR = RDATA->blur && (!TEXTURE->m_bOpaque || ALPHA < 1.F);
CBox windowBox; CBox windowBox;
if (RDATA->surface && surface == RDATA->surface) { if (RDATA->surface && surface == RDATA->surface) {