mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-10 10:09:49 +01:00
core: move parts of the animation system to hyprutils (#8868)
* core: change animation manager to use Hyprutils::Animation * config: move animation config to hyprutils animation tree * use g_pAnimationManager->createAnimation and the new PHLANIMVAR template * core: use CGenericAnimatedVariabled::{enabled,setConfig,getStyle} and adapt callbacks * core: adapt animated variable usage (dereference the shared pointer) * misc: bump CMakeLists to hyprutils 0.3.3
This commit is contained in:
parent
c7086f936a
commit
5642ed331d
44 changed files with 1031 additions and 1664 deletions
|
@ -104,7 +104,7 @@ find_package(OpenGL REQUIRED COMPONENTS ${GLES_VERSION})
|
|||
pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine>=0.4.5)
|
||||
pkg_check_modules(hyprlang_dep REQUIRED IMPORTED_TARGET hyprlang>=0.3.2)
|
||||
pkg_check_modules(hyprcursor_dep REQUIRED IMPORTED_TARGET hyprcursor>=0.1.7)
|
||||
pkg_check_modules(hyprutils_dep REQUIRED IMPORTED_TARGET hyprutils>=0.2.3)
|
||||
pkg_check_modules(hyprutils_dep REQUIRED IMPORTED_TARGET hyprutils>=0.3.3)
|
||||
pkg_check_modules(hyprgraphics_dep REQUIRED IMPORTED_TARGET hyprgraphics>=0.1.1)
|
||||
|
||||
add_compile_definitions(AQUAMARINE_VERSION="${aquamarine_dep_VERSION}")
|
||||
|
|
|
@ -569,7 +569,7 @@ void CCompositor::initManagers(eManagersInitStage stage) {
|
|||
g_pKeybindManager = std::make_unique<CKeybindManager>();
|
||||
|
||||
Debug::log(LOG, "Creating the AnimationManager!");
|
||||
g_pAnimationManager = std::make_unique<CAnimationManager>();
|
||||
g_pAnimationManager = std::make_unique<CHyprAnimationManager>();
|
||||
|
||||
Debug::log(LOG, "Creating the ConfigManager!");
|
||||
g_pConfigManager = std::make_unique<CConfigManager>();
|
||||
|
@ -964,11 +964,11 @@ SP<CWLSurfaceResource> CCompositor::vectorWindowToSurface(const Vector2D& pos, P
|
|||
|
||||
if (PPOPUP) {
|
||||
const auto OFF = PPOPUP->coordsRelativeToParent();
|
||||
sl = pos - pWindow->m_vRealPosition.goal() - OFF;
|
||||
sl = pos - pWindow->m_vRealPosition->goal() - OFF;
|
||||
return PPOPUP->m_pWLSurface->resource();
|
||||
}
|
||||
|
||||
auto [surf, local] = pWindow->m_pWLSurface->resource()->at(pos - pWindow->m_vRealPosition.goal(), true);
|
||||
auto [surf, local] = pWindow->m_pWLSurface->resource()->at(pos - pWindow->m_vRealPosition->goal(), true);
|
||||
if (surf) {
|
||||
sl = local;
|
||||
return surf;
|
||||
|
@ -982,7 +982,7 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindo
|
|||
return {};
|
||||
|
||||
if (pWindow->m_bIsX11)
|
||||
return vec - pWindow->m_vRealPosition.goal();
|
||||
return vec - pWindow->m_vRealPosition->goal();
|
||||
|
||||
const auto PPOPUP = pWindow->m_pPopupHead->at(vec);
|
||||
if (PPOPUP)
|
||||
|
@ -1001,9 +1001,9 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindo
|
|||
CBox geom = pWindow->m_pXDGSurface->current.geometry;
|
||||
|
||||
if (std::get<1>(iterData) == Vector2D{-1337, -1337})
|
||||
return vec - pWindow->m_vRealPosition.goal();
|
||||
return vec - pWindow->m_vRealPosition->goal();
|
||||
|
||||
return vec - pWindow->m_vRealPosition.goal() - std::get<1>(iterData) + Vector2D{geom.x, geom.y};
|
||||
return vec - pWindow->m_vRealPosition->goal() - std::get<1>(iterData) + Vector2D{geom.x, geom.y};
|
||||
}
|
||||
|
||||
PHLMONITOR CCompositor::getMonitorFromOutput(SP<Aquamarine::IOutput> out) {
|
||||
|
@ -1211,7 +1211,7 @@ void CCompositor::focusSurface(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindo
|
|||
SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, PHLMONITOR monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
||||
for (auto const& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) {
|
||||
for (auto const& ls : lsl | std::views::reverse) {
|
||||
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->mapped) || ls->alpha.value() == 0.f)
|
||||
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->mapped) || ls->alpha->value() == 0.f)
|
||||
continue;
|
||||
|
||||
auto SURFACEAT = ls->popupHead->at(pos, true);
|
||||
|
@ -1229,7 +1229,7 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& po
|
|||
|
||||
SP<CWLSurfaceResource> CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<PHLLSREF>* layerSurfaces, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
||||
for (auto const& ls : *layerSurfaces | std::views::reverse) {
|
||||
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha.value() == 0.f)
|
||||
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha->value() == 0.f)
|
||||
continue;
|
||||
|
||||
auto [surf, local] = ls->layerSurface->surface->at(pos - ls->geometry.pos(), true);
|
||||
|
@ -1378,7 +1378,7 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) {
|
|||
if (w->monitorID() != monid && w->m_pMonitor)
|
||||
continue;
|
||||
|
||||
if (!w->m_bFadingOut || w->m_fAlpha.value() == 0.f) {
|
||||
if (!w->m_bFadingOut || w->m_fAlpha->value() == 0.f) {
|
||||
|
||||
w->m_bFadingOut = false;
|
||||
|
||||
|
@ -1831,8 +1831,8 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) {
|
|||
|
||||
pWindow->m_cRealBorderColorPrevious = pWindow->m_cRealBorderColor;
|
||||
pWindow->m_cRealBorderColor = grad;
|
||||
pWindow->m_fBorderFadeAnimationProgress.setValueAndWarp(0.f);
|
||||
pWindow->m_fBorderFadeAnimationProgress = 1.f;
|
||||
pWindow->m_fBorderFadeAnimationProgress->setValueAndWarp(0.f);
|
||||
*pWindow->m_fBorderFadeAnimationProgress = 1.f;
|
||||
};
|
||||
|
||||
const bool IS_SHADOWED_BY_MODAL = pWindow->m_pXDGSurface && pWindow->m_pXDGSurface->toplevel && pWindow->m_pXDGSurface->toplevel->anyChildModal();
|
||||
|
@ -1855,18 +1855,18 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) {
|
|||
}
|
||||
|
||||
// tick angle if it's not running (aka dead)
|
||||
if (!pWindow->m_fBorderAngleAnimationProgress.isBeingAnimated())
|
||||
pWindow->m_fBorderAngleAnimationProgress.setValueAndWarp(0.f);
|
||||
if (!pWindow->m_fBorderAngleAnimationProgress->isBeingAnimated())
|
||||
pWindow->m_fBorderAngleAnimationProgress->setValueAndWarp(0.f);
|
||||
|
||||
// opacity
|
||||
const auto PWORKSPACE = pWindow->m_pWorkspace;
|
||||
if (pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN)) {
|
||||
pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaFullscreen.valueOrDefault().applyAlpha(*PFULLSCREENALPHA);
|
||||
*pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaFullscreen.valueOrDefault().applyAlpha(*PFULLSCREENALPHA);
|
||||
} else {
|
||||
if (pWindow == m_pLastWindow)
|
||||
pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alpha.valueOrDefault().applyAlpha(*PACTIVEALPHA);
|
||||
*pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alpha.valueOrDefault().applyAlpha(*PACTIVEALPHA);
|
||||
else
|
||||
pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaInactive.valueOrDefault().applyAlpha(*PINACTIVEALPHA);
|
||||
*pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaInactive.valueOrDefault().applyAlpha(*PINACTIVEALPHA);
|
||||
}
|
||||
|
||||
// dim
|
||||
|
@ -1879,16 +1879,16 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) {
|
|||
if (IS_SHADOWED_BY_MODAL)
|
||||
goalDim += (1.F - goalDim) / 2.F;
|
||||
|
||||
pWindow->m_fDimPercent = goalDim;
|
||||
*pWindow->m_fDimPercent = goalDim;
|
||||
|
||||
// shadow
|
||||
if (!pWindow->isX11OverrideRedirect() && !pWindow->m_bX11DoesntWantBorders) {
|
||||
if (pWindow == m_pLastWindow)
|
||||
pWindow->m_cRealShadowColor = CHyprColor(*PSHADOWCOL);
|
||||
*pWindow->m_cRealShadowColor = CHyprColor(*PSHADOWCOL);
|
||||
else
|
||||
pWindow->m_cRealShadowColor = CHyprColor(*PSHADOWCOLINACTIVE != INT64_MAX ? *PSHADOWCOLINACTIVE : *PSHADOWCOL);
|
||||
*pWindow->m_cRealShadowColor = CHyprColor(*PSHADOWCOLINACTIVE != INT64_MAX ? *PSHADOWCOLINACTIVE : *PSHADOWCOL);
|
||||
} else {
|
||||
pWindow->m_cRealShadowColor.setValueAndWarp(CHyprColor(0, 0, 0, 0)); // no shadow
|
||||
pWindow->m_cRealShadowColor->setValueAndWarp(CHyprColor(0, 0, 0, 0)); // no shadow
|
||||
}
|
||||
|
||||
pWindow->updateWindowDecos();
|
||||
|
@ -1932,11 +1932,11 @@ void CCompositor::swapActiveWorkspaces(PHLMONITOR pMonitorA, PHLMONITOR pMonitor
|
|||
|
||||
// additionally, move floating and fs windows manually
|
||||
if (w->m_bIsFloating)
|
||||
w->m_vRealPosition = w->m_vRealPosition.goal() - pMonitorA->vecPosition + pMonitorB->vecPosition;
|
||||
*w->m_vRealPosition = w->m_vRealPosition->goal() - pMonitorA->vecPosition + pMonitorB->vecPosition;
|
||||
|
||||
if (w->isFullscreen()) {
|
||||
w->m_vRealPosition = pMonitorB->vecPosition;
|
||||
w->m_vRealSize = pMonitorB->vecSize;
|
||||
*w->m_vRealPosition = pMonitorB->vecPosition;
|
||||
*w->m_vRealSize = pMonitorB->vecSize;
|
||||
}
|
||||
|
||||
w->updateToplevel();
|
||||
|
@ -1957,11 +1957,11 @@ void CCompositor::swapActiveWorkspaces(PHLMONITOR pMonitorA, PHLMONITOR pMonitor
|
|||
|
||||
// additionally, move floating and fs windows manually
|
||||
if (w->m_bIsFloating)
|
||||
w->m_vRealPosition = w->m_vRealPosition.goal() - pMonitorB->vecPosition + pMonitorA->vecPosition;
|
||||
*w->m_vRealPosition = w->m_vRealPosition->goal() - pMonitorB->vecPosition + pMonitorA->vecPosition;
|
||||
|
||||
if (w->isFullscreen()) {
|
||||
w->m_vRealPosition = pMonitorA->vecPosition;
|
||||
w->m_vRealSize = pMonitorA->vecSize;
|
||||
*w->m_vRealPosition = pMonitorA->vecPosition;
|
||||
*w->m_vRealSize = pMonitorA->vecSize;
|
||||
}
|
||||
|
||||
w->updateToplevel();
|
||||
|
@ -2135,14 +2135,14 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMo
|
|||
if (w->m_bIsMapped && !w->isHidden()) {
|
||||
if (POLDMON) {
|
||||
if (w->m_bIsFloating)
|
||||
w->m_vRealPosition = w->m_vRealPosition.goal() - POLDMON->vecPosition + pMonitor->vecPosition;
|
||||
*w->m_vRealPosition = w->m_vRealPosition->goal() - POLDMON->vecPosition + pMonitor->vecPosition;
|
||||
|
||||
if (w->isFullscreen()) {
|
||||
w->m_vRealPosition = pMonitor->vecPosition;
|
||||
w->m_vRealSize = pMonitor->vecSize;
|
||||
*w->m_vRealPosition = pMonitor->vecPosition;
|
||||
*w->m_vRealSize = pMonitor->vecSize;
|
||||
}
|
||||
} else {
|
||||
w->m_vRealPosition = Vector2D{(int)w->m_vRealPosition.goal().x % (int)pMonitor->vecSize.x, (int)w->m_vRealPosition.goal().y % (int)pMonitor->vecSize.y};
|
||||
*w->m_vRealPosition = Vector2D{(int)w->m_vRealPosition->goal().x % (int)pMonitor->vecSize.x, (int)w->m_vRealPosition->goal().y % (int)pMonitor->vecSize.y};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2216,9 +2216,9 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) {
|
|||
continue;
|
||||
|
||||
if (!FULLSCREEN)
|
||||
w->m_fAlpha = 1.f;
|
||||
*w->m_fAlpha = 1.f;
|
||||
else if (!w->isFullscreen())
|
||||
w->m_fAlpha = !w->m_bCreatedOverFullscreen ? 0.f : 1.f;
|
||||
*w->m_fAlpha = !w->m_bCreatedOverFullscreen ? 0.f : 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2227,7 +2227,7 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) {
|
|||
if (pWorkspace->m_iID == PMONITOR->activeWorkspaceID() || pWorkspace->m_iID == PMONITOR->activeSpecialWorkspaceID()) {
|
||||
for (auto const& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||
if (!ls->fadingOut)
|
||||
ls->alpha = FULLSCREEN && pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
|
||||
*ls->alpha = FULLSCREEN && pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2317,7 +2317,7 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS
|
|||
|
||||
updateFullscreenFadeOnWorkspace(PWORKSPACE);
|
||||
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal(), true);
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize->goal(), true);
|
||||
|
||||
PWORKSPACE->forceReportSizesToWindows();
|
||||
|
||||
|
@ -2573,7 +2573,7 @@ PHLWORKSPACE CCompositor::createNewWorkspace(const WORKSPACEID& id, const MONITO
|
|||
|
||||
const auto PWORKSPACE = m_vWorkspaces.emplace_back(CWorkspace::create(id, getMonitorFromID(monID), NAME, SPECIAL, isEmpty));
|
||||
|
||||
PWORKSPACE->m_fAlpha.setValueAndWarp(0);
|
||||
PWORKSPACE->m_fAlpha->setValueAndWarp(0);
|
||||
|
||||
return PWORKSPACE;
|
||||
}
|
||||
|
@ -2659,7 +2659,7 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor
|
|||
const PHLWINDOW pFirstWindowOnWorkspace = pWorkspace->getFirstWindow();
|
||||
const int visibleWindowsOnWorkspace = pWorkspace->getWindows(std::nullopt, true);
|
||||
const auto PWINDOWMONITOR = pWindow->m_pMonitor.lock();
|
||||
const auto POSTOMON = pWindow->m_vRealPosition.goal() - PWINDOWMONITOR->vecPosition;
|
||||
const auto POSTOMON = pWindow->m_vRealPosition->goal() - PWINDOWMONITOR->vecPosition;
|
||||
const auto PWORKSPACEMONITOR = pWorkspace->m_pMonitor.lock();
|
||||
|
||||
if (!pWindow->m_bIsFloating)
|
||||
|
@ -2696,7 +2696,7 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor
|
|||
g_pLayoutManager->getCurrentLayout()->onWindowCreatedTiling(pWindow);
|
||||
|
||||
if (pWindow->m_bIsFloating)
|
||||
pWindow->m_vRealPosition = POSTOMON + PWORKSPACEMONITOR->vecPosition;
|
||||
*pWindow->m_vRealPosition = POSTOMON + PWORKSPACEMONITOR->vecPosition;
|
||||
}
|
||||
|
||||
pWindow->updateToplevel();
|
||||
|
@ -2721,8 +2721,8 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor
|
|||
g_pCompositor->updateSuspendedStates();
|
||||
|
||||
if (!WASVISIBLE && pWindow->m_pWorkspace && pWindow->m_pWorkspace->isVisible()) {
|
||||
pWindow->m_fMovingFromWorkspaceAlpha.setValueAndWarp(0.F);
|
||||
pWindow->m_fMovingFromWorkspaceAlpha = 1.F;
|
||||
pWindow->m_fMovingFromWorkspaceAlpha->setValueAndWarp(0.F);
|
||||
*pWindow->m_fMovingFromWorkspaceAlpha = 1.F;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "../protocols/LayerShell.hpp"
|
||||
#include "../xwayland/XWayland.hpp"
|
||||
#include "../protocols/OutputManagement.hpp"
|
||||
#include "managers/AnimationManager.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
@ -32,6 +33,7 @@
|
|||
#include <hyprutils/string/String.hpp>
|
||||
#include <filesystem>
|
||||
using namespace Hyprutils::String;
|
||||
using namespace Hyprutils::Animation;
|
||||
|
||||
//NOLINTNEXTLINE
|
||||
extern "C" char** environ;
|
||||
|
@ -681,7 +683,6 @@ CConfigManager::CConfigManager() {
|
|||
|
||||
m_pConfig->commence();
|
||||
|
||||
setDefaultAnimationVars();
|
||||
resetHLConfig();
|
||||
|
||||
Debug::log(INFO,
|
||||
|
@ -780,76 +781,46 @@ void CConfigManager::reload() {
|
|||
}
|
||||
|
||||
void CConfigManager::setDefaultAnimationVars() {
|
||||
if (isFirstLaunch) {
|
||||
INITANIMCFG("__internal_fadeCTM");
|
||||
m_AnimationTree.createNode("__internal_fadeCTM");
|
||||
m_AnimationTree.createNode("global");
|
||||
|
||||
INITANIMCFG("global");
|
||||
INITANIMCFG("windows");
|
||||
INITANIMCFG("layers");
|
||||
INITANIMCFG("fade");
|
||||
INITANIMCFG("border");
|
||||
INITANIMCFG("borderangle");
|
||||
// global
|
||||
m_AnimationTree.createNode("windows", "global");
|
||||
m_AnimationTree.createNode("layers", "global");
|
||||
m_AnimationTree.createNode("fade", "global");
|
||||
m_AnimationTree.createNode("border", "global");
|
||||
m_AnimationTree.createNode("borderangle", "global");
|
||||
m_AnimationTree.createNode("workspaces", "global");
|
||||
|
||||
// windows
|
||||
INITANIMCFG("windowsIn");
|
||||
INITANIMCFG("windowsOut");
|
||||
INITANIMCFG("windowsMove");
|
||||
// layer
|
||||
m_AnimationTree.createNode("layersIn", "layers");
|
||||
m_AnimationTree.createNode("layersOut", "layers");
|
||||
|
||||
// layers
|
||||
INITANIMCFG("layersIn");
|
||||
INITANIMCFG("layersOut");
|
||||
// windows
|
||||
m_AnimationTree.createNode("windowsIn", "windows");
|
||||
m_AnimationTree.createNode("windowsOut", "windows");
|
||||
m_AnimationTree.createNode("windowsMove", "windows");
|
||||
|
||||
// fade
|
||||
INITANIMCFG("fadeIn");
|
||||
INITANIMCFG("fadeOut");
|
||||
INITANIMCFG("fadeSwitch");
|
||||
INITANIMCFG("fadeShadow");
|
||||
INITANIMCFG("fadeDim");
|
||||
// fade
|
||||
m_AnimationTree.createNode("fadeIn", "fade");
|
||||
m_AnimationTree.createNode("fadeOut", "fade");
|
||||
m_AnimationTree.createNode("fadeSwitch", "fade");
|
||||
m_AnimationTree.createNode("fadeShadow", "fade");
|
||||
m_AnimationTree.createNode("fadeDim", "fade");
|
||||
m_AnimationTree.createNode("fadeLayers", "fade");
|
||||
m_AnimationTree.createNode("fadeLayersIn", "fadeLayers");
|
||||
m_AnimationTree.createNode("fadeLayersOut", "fadeLayers");
|
||||
|
||||
// border
|
||||
// workspaces
|
||||
m_AnimationTree.createNode("workspacesIn", "workspaces");
|
||||
m_AnimationTree.createNode("workspacesOut", "workspaces");
|
||||
m_AnimationTree.createNode("specialWorkspace", "workspaces");
|
||||
m_AnimationTree.createNode("specialWorkspaceIn", "specialWorkspace");
|
||||
m_AnimationTree.createNode("specialWorkspaceOut", "specialWorkspace");
|
||||
|
||||
// workspaces
|
||||
INITANIMCFG("workspaces");
|
||||
INITANIMCFG("workspacesIn");
|
||||
INITANIMCFG("workspacesOut");
|
||||
INITANIMCFG("specialWorkspace");
|
||||
INITANIMCFG("specialWorkspaceIn");
|
||||
INITANIMCFG("specialWorkspaceOut");
|
||||
}
|
||||
|
||||
// init the values
|
||||
animationConfig["global"] = {false, "default", "", 8.f, 1, &animationConfig["general"], nullptr};
|
||||
|
||||
animationConfig["__internal_fadeCTM"] = {false, "linear", "", 5.F, 1, &animationConfig["__internal_fadeCTM"], nullptr};
|
||||
|
||||
CREATEANIMCFG("windows", "global");
|
||||
CREATEANIMCFG("layers", "global");
|
||||
CREATEANIMCFG("fade", "global");
|
||||
CREATEANIMCFG("border", "global");
|
||||
CREATEANIMCFG("borderangle", "global");
|
||||
CREATEANIMCFG("workspaces", "global");
|
||||
|
||||
CREATEANIMCFG("layersIn", "layers");
|
||||
CREATEANIMCFG("layersOut", "layers");
|
||||
|
||||
CREATEANIMCFG("windowsIn", "windows");
|
||||
CREATEANIMCFG("windowsOut", "windows");
|
||||
CREATEANIMCFG("windowsMove", "windows");
|
||||
|
||||
CREATEANIMCFG("fadeIn", "fade");
|
||||
CREATEANIMCFG("fadeOut", "fade");
|
||||
CREATEANIMCFG("fadeSwitch", "fade");
|
||||
CREATEANIMCFG("fadeShadow", "fade");
|
||||
CREATEANIMCFG("fadeDim", "fade");
|
||||
CREATEANIMCFG("fadeLayers", "fade");
|
||||
CREATEANIMCFG("fadeLayersIn", "fadeLayers");
|
||||
CREATEANIMCFG("fadeLayersOut", "fadeLayers");
|
||||
|
||||
CREATEANIMCFG("workspacesIn", "workspaces");
|
||||
CREATEANIMCFG("workspacesOut", "workspaces");
|
||||
CREATEANIMCFG("specialWorkspace", "workspaces");
|
||||
CREATEANIMCFG("specialWorkspaceIn", "specialWorkspace");
|
||||
CREATEANIMCFG("specialWorkspaceOut", "specialWorkspace");
|
||||
// init the root nodes
|
||||
m_AnimationTree.setConfigForNode("global", 1, 8.f, "", "default");
|
||||
m_AnimationTree.setConfigForNode("__internal_fadeCTM", 1, 5.f, "", "linear");
|
||||
}
|
||||
|
||||
std::optional<std::string> CConfigManager::resetHLConfig() {
|
||||
|
@ -857,6 +828,8 @@ std::optional<std::string> CConfigManager::resetHLConfig() {
|
|||
m_vWindowRules.clear();
|
||||
g_pKeybindManager->clearKeybinds();
|
||||
g_pAnimationManager->removeAllBeziers();
|
||||
g_pAnimationManager->addBezierWithName("linear", Vector2D(0.0, 0.0), Vector2D(1.0, 1.0));
|
||||
|
||||
m_mAdditionalReservedAreas.clear();
|
||||
m_dBlurLSNamespaces.clear();
|
||||
m_vWorkspaceRules.clear();
|
||||
|
@ -1647,8 +1620,8 @@ void CConfigManager::ensureVRR(PHLMONITOR pMonitor) {
|
|||
}
|
||||
}
|
||||
|
||||
SAnimationPropertyConfig* CConfigManager::getAnimationPropertyConfig(const std::string& name) {
|
||||
return &animationConfig[name];
|
||||
SP<SAnimationPropertyConfig> CConfigManager::getAnimationPropertyConfig(const std::string& name) {
|
||||
return m_AnimationTree.getConfig(name);
|
||||
}
|
||||
|
||||
void CConfigManager::addParseError(const std::string& err) {
|
||||
|
@ -1711,8 +1684,8 @@ ICustomConfigValueData::~ICustomConfigValueData() {
|
|||
; // empty
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, SAnimationPropertyConfig> CConfigManager::getAnimationConfig() {
|
||||
return animationConfig;
|
||||
const std::unordered_map<std::string, SP<SAnimationPropertyConfig>>& CConfigManager::getAnimationConfig() {
|
||||
return m_AnimationTree.getFullConfig();
|
||||
}
|
||||
|
||||
void CConfigManager::addPluginConfigVar(HANDLE handle, const std::string& name, const Hyprlang::CConfigValue& value) {
|
||||
|
@ -2058,17 +2031,6 @@ std::optional<std::string> CConfigManager::handleBezier(const std::string& comma
|
|||
return {};
|
||||
}
|
||||
|
||||
void CConfigManager::setAnimForChildren(SAnimationPropertyConfig* const ANIM) {
|
||||
for (auto& [name, anim] : animationConfig) {
|
||||
if (anim.pParentAnimation == ANIM && !anim.overridden) {
|
||||
// if a child isnt overridden, set the values of the parent
|
||||
anim.pValues = ANIM->pValues;
|
||||
|
||||
setAnimForChildren(&anim);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::optional<std::string> CConfigManager::handleAnimation(const std::string& command, const std::string& args) {
|
||||
const auto ARGS = CVarList(args);
|
||||
|
||||
|
@ -2077,14 +2039,9 @@ std::optional<std::string> CConfigManager::handleAnimation(const std::string& co
|
|||
// anim name
|
||||
const auto ANIMNAME = ARGS[0];
|
||||
|
||||
const auto PANIM = animationConfig.find(ANIMNAME);
|
||||
|
||||
if (PANIM == animationConfig.end())
|
||||
if (!m_AnimationTree.nodeExists(ANIMNAME))
|
||||
return "no such animation";
|
||||
|
||||
PANIM->second.overridden = true;
|
||||
PANIM->second.pValues = &PANIM->second;
|
||||
|
||||
// This helper casts strings like "1", "true", "off", "yes"... to int.
|
||||
int64_t enabledInt = configStringToInt(ARGS[1]).value_or(0) == 1;
|
||||
|
||||
|
@ -2092,33 +2049,31 @@ std::optional<std::string> CConfigManager::handleAnimation(const std::string& co
|
|||
if (enabledInt != 0 && enabledInt != 1)
|
||||
return "invalid animation on/off state";
|
||||
|
||||
PANIM->second.internalEnabled = configStringToInt(ARGS[1]).value_or(0) == 1;
|
||||
if (enabledInt) {
|
||||
int64_t speed = -1;
|
||||
|
||||
if (PANIM->second.internalEnabled) {
|
||||
// speed
|
||||
if (isNumber(ARGS[2], true)) {
|
||||
PANIM->second.internalSpeed = std::stof(ARGS[2]);
|
||||
speed = std::stof(ARGS[2]);
|
||||
|
||||
if (PANIM->second.internalSpeed <= 0) {
|
||||
PANIM->second.internalSpeed = 1.f;
|
||||
if (speed <= 0) {
|
||||
speed = 1.f;
|
||||
return "invalid speed";
|
||||
}
|
||||
} else {
|
||||
PANIM->second.internalSpeed = 10.f;
|
||||
speed = 10.f;
|
||||
return "invalid speed";
|
||||
}
|
||||
|
||||
// curve
|
||||
PANIM->second.internalBezier = ARGS[3];
|
||||
std::string bezierName = ARGS[3];
|
||||
m_AnimationTree.setConfigForNode(ANIMNAME, enabledInt, speed, ARGS[3], ARGS[4]);
|
||||
|
||||
if (!g_pAnimationManager->bezierExists(ARGS[3])) {
|
||||
PANIM->second.internalBezier = "default";
|
||||
if (!g_pAnimationManager->bezierExists(bezierName)) {
|
||||
const auto PANIMNODE = m_AnimationTree.getConfig(ANIMNAME);
|
||||
PANIMNODE->internalBezier = "default";
|
||||
return "no such bezier";
|
||||
}
|
||||
|
||||
// style
|
||||
PANIM->second.internalStyle = ARGS[4];
|
||||
|
||||
if (ARGS[4] != "") {
|
||||
auto ERR = g_pAnimationManager->styleValidInConfigVar(ANIMNAME, ARGS[4]);
|
||||
|
||||
|
@ -2127,9 +2082,6 @@ std::optional<std::string> CConfigManager::handleAnimation(const std::string& co
|
|||
}
|
||||
}
|
||||
|
||||
// now, check for children, recursively
|
||||
setAnimForChildren(&PANIM->second);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <hyprutils/animation/AnimationConfig.hpp>
|
||||
#define CONFIG_MANAGER_H
|
||||
|
||||
#include <map>
|
||||
|
@ -23,9 +24,6 @@
|
|||
|
||||
#include <hyprlang.hpp>
|
||||
|
||||
#define INITANIMCFG(name) animationConfig[name] = {}
|
||||
#define CREATEANIMCFG(name, parent) animationConfig[name] = {false, "", "", 0.f, -1, &animationConfig["global"], &animationConfig[parent]}
|
||||
|
||||
#define HANDLE void*
|
||||
|
||||
struct SWorkspaceRule {
|
||||
|
@ -54,18 +52,6 @@ struct SMonitorAdditionalReservedArea {
|
|||
int right = 0;
|
||||
};
|
||||
|
||||
struct SAnimationPropertyConfig {
|
||||
bool overridden = true;
|
||||
|
||||
std::string internalBezier = "";
|
||||
std::string internalStyle = "";
|
||||
float internalSpeed = 0.f;
|
||||
int internalEnabled = -1;
|
||||
|
||||
SAnimationPropertyConfig* pValues = nullptr;
|
||||
SAnimationPropertyConfig* pParentAnimation = nullptr;
|
||||
};
|
||||
|
||||
struct SPluginKeyword {
|
||||
HANDLE handle = nullptr;
|
||||
std::string name = "";
|
||||
|
@ -181,32 +167,32 @@ class CConfigManager {
|
|||
|
||||
std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas;
|
||||
|
||||
std::unordered_map<std::string, SAnimationPropertyConfig> getAnimationConfig();
|
||||
const std::unordered_map<std::string, SP<Hyprutils::Animation::SAnimationPropertyConfig>>& getAnimationConfig();
|
||||
|
||||
void addPluginConfigVar(HANDLE handle, const std::string& name, const Hyprlang::CConfigValue& value);
|
||||
void addPluginConfigVar(HANDLE handle, const std::string& name, const Hyprlang::CConfigValue& value);
|
||||
void addPluginKeyword(HANDLE handle, const std::string& name, Hyprlang::PCONFIGHANDLERFUNC fun, Hyprlang::SHandlerOptions opts = {});
|
||||
void removePluginConfig(HANDLE handle);
|
||||
|
||||
// no-op when done.
|
||||
void dispatchExecOnce();
|
||||
void dispatchExecShutdown();
|
||||
void dispatchExecOnce();
|
||||
void dispatchExecShutdown();
|
||||
|
||||
void performMonitorReload();
|
||||
void ensureMonitorStatus();
|
||||
void ensureVRR(PHLMONITOR pMonitor = nullptr);
|
||||
void performMonitorReload();
|
||||
void ensureMonitorStatus();
|
||||
void ensureVRR(PHLMONITOR pMonitor = nullptr);
|
||||
|
||||
bool shouldUseSoftwareCursors();
|
||||
bool shouldUseSoftwareCursors();
|
||||
|
||||
std::string parseKeyword(const std::string&, const std::string&);
|
||||
std::string parseKeyword(const std::string&, const std::string&);
|
||||
|
||||
void addParseError(const std::string&);
|
||||
void addParseError(const std::string&);
|
||||
|
||||
SAnimationPropertyConfig* getAnimationPropertyConfig(const std::string&);
|
||||
SP<Hyprutils::Animation::SAnimationPropertyConfig> getAnimationPropertyConfig(const std::string&);
|
||||
|
||||
void addExecRule(const SExecRequestedRule&);
|
||||
void addExecRule(const SExecRequestedRule&);
|
||||
|
||||
void handlePluginLoads();
|
||||
std::string getErrors();
|
||||
void handlePluginLoads();
|
||||
std::string getErrors();
|
||||
|
||||
// keywords
|
||||
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
|
||||
|
@ -269,39 +255,38 @@ class CConfigManager {
|
|||
bool isLaunchingExecOnce = false; // For exec-once to skip initial ws tracking
|
||||
|
||||
private:
|
||||
std::unique_ptr<Hyprlang::CConfig> m_pConfig;
|
||||
std::unique_ptr<Hyprlang::CConfig> m_pConfig;
|
||||
|
||||
std::vector<std::string> configPaths; // stores all the config paths
|
||||
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
|
||||
std::vector<std::string> configPaths; // stores all the config paths
|
||||
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
|
||||
|
||||
std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values
|
||||
Hyprutils::Animation::CAnimationConfigTree m_AnimationTree;
|
||||
|
||||
std::string m_szCurrentSubmap = ""; // For storing the current keybind submap
|
||||
std::string m_szCurrentSubmap = ""; // For storing the current keybind submap
|
||||
|
||||
std::vector<SExecRequestedRule> execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty
|
||||
std::vector<SExecRequestedRule> execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty
|
||||
|
||||
std::vector<std::string> m_vDeclaredPlugins;
|
||||
std::vector<SPluginKeyword> pluginKeywords;
|
||||
std::vector<SPluginVariable> pluginVariables;
|
||||
std::vector<std::string> m_vDeclaredPlugins;
|
||||
std::vector<SPluginKeyword> pluginKeywords;
|
||||
std::vector<SPluginVariable> pluginVariables;
|
||||
|
||||
bool isFirstLaunch = true; // For exec-once
|
||||
bool isFirstLaunch = true; // For exec-once
|
||||
|
||||
std::vector<SMonitorRule> m_vMonitorRules;
|
||||
std::vector<SWorkspaceRule> m_vWorkspaceRules;
|
||||
std::vector<SP<CWindowRule>> m_vWindowRules;
|
||||
std::vector<SP<CLayerRule>> m_vLayerRules;
|
||||
std::vector<std::string> m_dBlurLSNamespaces;
|
||||
std::vector<SMonitorRule> m_vMonitorRules;
|
||||
std::vector<SWorkspaceRule> m_vWorkspaceRules;
|
||||
std::vector<SP<CWindowRule>> m_vWindowRules;
|
||||
std::vector<SP<CLayerRule>> m_vLayerRules;
|
||||
std::vector<std::string> m_dBlurLSNamespaces;
|
||||
|
||||
bool firstExecDispatched = false;
|
||||
bool m_bManualCrashInitiated = false;
|
||||
std::vector<std::string> firstExecRequests;
|
||||
std::vector<std::string> finalExecRequests;
|
||||
bool firstExecDispatched = false;
|
||||
bool m_bManualCrashInitiated = false;
|
||||
std::vector<std::string> firstExecRequests;
|
||||
std::vector<std::string> finalExecRequests;
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
|
||||
std::string m_szConfigErrors = "";
|
||||
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
|
||||
std::string m_szConfigErrors = "";
|
||||
|
||||
// internal methods
|
||||
void setAnimForChildren(SAnimationPropertyConfig* const);
|
||||
void updateBlurredLS(const std::string&, const bool);
|
||||
void setDefaultAnimationVars();
|
||||
std::optional<std::string> resetHLConfig();
|
||||
|
|
|
@ -248,8 +248,8 @@ std::string CHyprCtl::getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) {
|
|||
"focusHistoryID": {},
|
||||
"inhibitingIdle": {}
|
||||
}},)#",
|
||||
(uintptr_t)w.get(), (w->m_bIsMapped ? "true" : "false"), (w->isHidden() ? "true" : "false"), (int)w->m_vRealPosition.goal().x, (int)w->m_vRealPosition.goal().y,
|
||||
(int)w->m_vRealSize.goal().x, (int)w->m_vRealSize.goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID,
|
||||
(uintptr_t)w.get(), (w->m_bIsMapped ? "true" : "false"), (w->isHidden() ? "true" : "false"), (int)w->m_vRealPosition->goal().x, (int)w->m_vRealPosition->goal().y,
|
||||
(int)w->m_vRealSize->goal().x, (int)w->m_vRealSize->goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID,
|
||||
escapeJSONStrings(!w->m_pWorkspace ? "" : w->m_pWorkspace->m_szName), ((int)w->m_bIsFloating == 1 ? "true" : "false"), (w->m_bIsPseudotiled ? "true" : "false"),
|
||||
(int64_t)w->monitorID(), escapeJSONStrings(w->m_szClass), escapeJSONStrings(w->m_szTitle), escapeJSONStrings(w->m_szInitialClass),
|
||||
escapeJSONStrings(w->m_szInitialTitle), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"),
|
||||
|
@ -261,11 +261,12 @@ std::string CHyprCtl::getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) {
|
|||
"{}\n\tinitialClass: {}\n\tinitialTitle: {}\n\tpid: "
|
||||
"{}\n\txwayland: {}\n\tpinned: "
|
||||
"{}\n\tfullscreen: {}\n\tfullscreenClient: {}\n\tgrouped: {}\n\ttags: {}\n\tswallowing: {:x}\n\tfocusHistoryID: {}\n\tinhibitingIdle: {}\n\n",
|
||||
(uintptr_t)w.get(), w->m_szTitle, (int)w->m_bIsMapped, (int)w->isHidden(), (int)w->m_vRealPosition.goal().x, (int)w->m_vRealPosition.goal().y,
|
||||
(int)w->m_vRealSize.goal().x, (int)w->m_vRealSize.goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID, (!w->m_pWorkspace ? "" : w->m_pWorkspace->m_szName),
|
||||
(int)w->m_bIsFloating, (int)w->m_bIsPseudotiled, (int64_t)w->monitorID(), w->m_szClass, w->m_szTitle, w->m_szInitialClass, w->m_szInitialTitle, w->getPID(),
|
||||
(int)w->m_bIsX11, (int)w->m_bPinned, (uint8_t)w->m_sFullscreenState.internal, (uint8_t)w->m_sFullscreenState.client, getGroupedData(w, format), getTagsData(w, format),
|
||||
(uintptr_t)w->m_pSwallowed.lock().get(), getFocusHistoryID(w), (int)g_pInputManager->isWindowInhibiting(w, false));
|
||||
(uintptr_t)w.get(), w->m_szTitle, (int)w->m_bIsMapped, (int)w->isHidden(), (int)w->m_vRealPosition->goal().x, (int)w->m_vRealPosition->goal().y,
|
||||
(int)w->m_vRealSize->goal().x, (int)w->m_vRealSize->goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID,
|
||||
(!w->m_pWorkspace ? "" : w->m_pWorkspace->m_szName), (int)w->m_bIsFloating, (int)w->m_bIsPseudotiled, (int64_t)w->monitorID(), w->m_szClass, w->m_szTitle,
|
||||
w->m_szInitialClass, w->m_szInitialTitle, w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned, (uint8_t)w->m_sFullscreenState.internal,
|
||||
(uint8_t)w->m_sFullscreenState.client, getGroupedData(w, format), getTagsData(w, format), (uintptr_t)w->m_pSwallowed.lock().get(), getFocusHistoryID(w),
|
||||
(int)g_pInputManager->isWindowInhibiting(w, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -732,8 +733,8 @@ static std::string animationsRequest(eHyprCtlOutputFormat format, std::string re
|
|||
ret += "animations:\n";
|
||||
|
||||
for (auto const& ac : g_pConfigManager->getAnimationConfig()) {
|
||||
ret += std::format("\n\tname: {}\n\t\toverriden: {}\n\t\tbezier: {}\n\t\tenabled: {}\n\t\tspeed: {:.2f}\n\t\tstyle: {}\n", ac.first, (int)ac.second.overridden,
|
||||
ac.second.internalBezier, ac.second.internalEnabled, ac.second.internalSpeed, ac.second.internalStyle);
|
||||
ret += std::format("\n\tname: {}\n\t\toverriden: {}\n\t\tbezier: {}\n\t\tenabled: {}\n\t\tspeed: {:.2f}\n\t\tstyle: {}\n", ac.first, (int)ac.second->overridden,
|
||||
ac.second->internalBezier, ac.second->internalEnabled, ac.second->internalSpeed, ac.second->internalStyle);
|
||||
}
|
||||
|
||||
ret += "beziers:\n";
|
||||
|
@ -755,8 +756,8 @@ static std::string animationsRequest(eHyprCtlOutputFormat format, std::string re
|
|||
"speed": {:.2f},
|
||||
"style": "{}"
|
||||
}},)#",
|
||||
ac.first, ac.second.overridden ? "true" : "false", escapeJSONStrings(ac.second.internalBezier), ac.second.internalEnabled ? "true" : "false",
|
||||
ac.second.internalSpeed, escapeJSONStrings(ac.second.internalStyle));
|
||||
ac.first, ac.second->overridden ? "true" : "false", escapeJSONStrings(ac.second->internalBezier), ac.second->internalEnabled ? "true" : "false",
|
||||
ac.second->internalSpeed, escapeJSONStrings(ac.second->internalStyle));
|
||||
}
|
||||
|
||||
ret[ret.length() - 1] = ']';
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "../protocols/LayerShell.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
#include "../managers/AnimationManager.hpp"
|
||||
|
||||
PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
||||
PHLLS pLS = SP<CLayerSurface>(new CLayerSurface(resource));
|
||||
|
@ -31,16 +32,13 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
|||
|
||||
pLS->forceBlur = g_pConfigManager->shouldBlurLS(pLS->szNamespace);
|
||||
|
||||
pLS->alpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn"), pLS, AVARDAMAGE_ENTIRE);
|
||||
pLS->realPosition.create(g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE);
|
||||
pLS->realSize.create(g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE);
|
||||
pLS->alpha.registerVar();
|
||||
pLS->realPosition.registerVar();
|
||||
pLS->realSize.registerVar();
|
||||
g_pAnimationManager->createAnimation(0.f, pLS->alpha, g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn"), pLS, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(Vector2D(0, 0), pLS->realPosition, g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(Vector2D(0, 0), pLS->realSize, g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE);
|
||||
|
||||
pLS->registerCallbacks();
|
||||
|
||||
pLS->alpha.setValueAndWarp(0.f);
|
||||
pLS->alpha->setValueAndWarp(0.f);
|
||||
|
||||
Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)resource.get(), resource->layerNamespace, (int)pLS->layer, pMonitor->szName);
|
||||
|
||||
|
@ -48,7 +46,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
|||
}
|
||||
|
||||
void CLayerSurface::registerCallbacks() {
|
||||
alpha.setUpdateCallback([this](void*) {
|
||||
alpha->setUpdateCallback([this](auto) {
|
||||
if (dimAround)
|
||||
g_pHyprRenderer->damageMonitor(monitor.lock());
|
||||
});
|
||||
|
@ -93,7 +91,7 @@ void CLayerSurface::onDestroy() {
|
|||
onUnmap();
|
||||
} else {
|
||||
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
|
||||
alpha.setValueAndWarp(0.f);
|
||||
alpha->setValueAndWarp(0.f);
|
||||
fadingOut = true;
|
||||
g_pCompositor->addToFadingOutSafe(self.lock());
|
||||
}
|
||||
|
@ -307,17 +305,17 @@ void CLayerSurface::onCommit() {
|
|||
}
|
||||
}
|
||||
|
||||
if (realPosition.goal() != geometry.pos()) {
|
||||
if (realPosition.isBeingAnimated())
|
||||
realPosition = geometry.pos();
|
||||
if (realPosition->goal() != geometry.pos()) {
|
||||
if (realPosition->isBeingAnimated())
|
||||
*realPosition = geometry.pos();
|
||||
else
|
||||
realPosition.setValueAndWarp(geometry.pos());
|
||||
realPosition->setValueAndWarp(geometry.pos());
|
||||
}
|
||||
if (realSize.goal() != geometry.size()) {
|
||||
if (realSize.isBeingAnimated())
|
||||
realSize = geometry.size();
|
||||
if (realSize->goal() != geometry.size()) {
|
||||
if (realSize->isBeingAnimated())
|
||||
*realSize = geometry.size();
|
||||
else
|
||||
realSize.setValueAndWarp(geometry.size());
|
||||
realSize->setValueAndWarp(geometry.size());
|
||||
}
|
||||
|
||||
if (mapped && (layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_INTERACTIVITY)) {
|
||||
|
@ -434,17 +432,17 @@ void CLayerSurface::applyRules() {
|
|||
}
|
||||
|
||||
void CLayerSurface::startAnimation(bool in, bool instant) {
|
||||
const auto ANIMSTYLE = animationStyle.value_or(realPosition.m_pConfig->pValues->internalStyle);
|
||||
if (in) {
|
||||
realPosition.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("layersIn");
|
||||
realSize.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("layersIn");
|
||||
alpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn");
|
||||
realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn"));
|
||||
realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn"));
|
||||
alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn"));
|
||||
} else {
|
||||
realPosition.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("layersOut");
|
||||
realSize.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("layersOut");
|
||||
alpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("fadeLayersOut");
|
||||
realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut"));
|
||||
realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut"));
|
||||
alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeLayersOut"));
|
||||
}
|
||||
|
||||
const auto ANIMSTYLE = animationStyle.value_or(realPosition->getStyle());
|
||||
if (ANIMSTYLE.starts_with("slide")) {
|
||||
// get closest edge
|
||||
const auto MIDDLE = geometry.middle();
|
||||
|
@ -485,9 +483,9 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
|
|||
}
|
||||
}
|
||||
|
||||
realSize.setValueAndWarp(geometry.size());
|
||||
alpha.setValueAndWarp(in ? 0.f : 1.f);
|
||||
alpha = in ? 1.f : 0.f;
|
||||
realSize->setValueAndWarp(geometry.size());
|
||||
alpha->setValueAndWarp(in ? 0.f : 1.f);
|
||||
*alpha = in ? 1.f : 0.f;
|
||||
|
||||
Vector2D prePos;
|
||||
|
||||
|
@ -512,11 +510,11 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
|
|||
}
|
||||
|
||||
if (in) {
|
||||
realPosition.setValueAndWarp(prePos);
|
||||
realPosition = geometry.pos();
|
||||
realPosition->setValueAndWarp(prePos);
|
||||
*realPosition = geometry.pos();
|
||||
} else {
|
||||
realPosition.setValueAndWarp(geometry.pos());
|
||||
realPosition = prePos;
|
||||
realPosition->setValueAndWarp(geometry.pos());
|
||||
*realPosition = prePos;
|
||||
}
|
||||
|
||||
} else if (ANIMSTYLE.starts_with("popin")) {
|
||||
|
@ -535,25 +533,25 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
|
|||
const auto GOALSIZE = (geometry.size() * minPerc).clamp({5, 5});
|
||||
const auto GOALPOS = geometry.pos() + (geometry.size() - GOALSIZE) / 2.f;
|
||||
|
||||
alpha.setValueAndWarp(in ? 0.f : 1.f);
|
||||
alpha = in ? 1.f : 0.f;
|
||||
alpha->setValueAndWarp(in ? 0.f : 1.f);
|
||||
*alpha = in ? 1.f : 0.f;
|
||||
|
||||
if (in) {
|
||||
realSize.setValueAndWarp(GOALSIZE);
|
||||
realPosition.setValueAndWarp(GOALPOS);
|
||||
realSize = geometry.size();
|
||||
realPosition = geometry.pos();
|
||||
realSize->setValueAndWarp(GOALSIZE);
|
||||
realPosition->setValueAndWarp(GOALPOS);
|
||||
*realSize = geometry.size();
|
||||
*realPosition = geometry.pos();
|
||||
} else {
|
||||
realSize.setValueAndWarp(geometry.size());
|
||||
realPosition.setValueAndWarp(geometry.pos());
|
||||
realSize = GOALSIZE;
|
||||
realPosition = GOALPOS;
|
||||
realSize->setValueAndWarp(geometry.size());
|
||||
realPosition->setValueAndWarp(geometry.pos());
|
||||
*realSize = GOALSIZE;
|
||||
*realPosition = GOALPOS;
|
||||
}
|
||||
} else {
|
||||
// fade
|
||||
realPosition.setValueAndWarp(geometry.pos());
|
||||
realSize.setValueAndWarp(geometry.size());
|
||||
alpha = in ? 1.f : 0.f;
|
||||
realPosition->setValueAndWarp(geometry.pos());
|
||||
realSize->setValueAndWarp(geometry.size());
|
||||
*alpha = in ? 1.f : 0.f;
|
||||
}
|
||||
|
||||
if (!in)
|
||||
|
@ -564,7 +562,7 @@ bool CLayerSurface::isFadedOut() {
|
|||
if (!fadingOut)
|
||||
return false;
|
||||
|
||||
return !realPosition.isBeingAnimated() && !realSize.isBeingAnimated() && !alpha.isBeingAnimated();
|
||||
return !realPosition->isBeingAnimated() && !realSize->isBeingAnimated() && !alpha->isBeingAnimated();
|
||||
}
|
||||
|
||||
int CLayerSurface::popupsCount() {
|
||||
|
|
|
@ -18,17 +18,17 @@ class CLayerSurface {
|
|||
public:
|
||||
~CLayerSurface();
|
||||
|
||||
void applyRules();
|
||||
void startAnimation(bool in, bool instant = false);
|
||||
bool isFadedOut();
|
||||
int popupsCount();
|
||||
void applyRules();
|
||||
void startAnimation(bool in, bool instant = false);
|
||||
bool isFadedOut();
|
||||
int popupsCount();
|
||||
|
||||
CAnimatedVariable<Vector2D> realPosition;
|
||||
CAnimatedVariable<Vector2D> realSize;
|
||||
CAnimatedVariable<float> alpha;
|
||||
PHLANIMVAR<Vector2D> realPosition;
|
||||
PHLANIMVAR<Vector2D> realSize;
|
||||
PHLANIMVAR<float> alpha;
|
||||
|
||||
WP<CLayerShellResource> layerSurface;
|
||||
wl_list link;
|
||||
WP<CLayerShellResource> layerSurface;
|
||||
wl_list link;
|
||||
|
||||
// the header providing the enum type cannot be imported here
|
||||
int interactivity = 0;
|
||||
|
|
|
@ -243,9 +243,9 @@ Vector2D CPopup::localToGlobal(const Vector2D& rel) {
|
|||
|
||||
Vector2D CPopup::t1ParentCoords() {
|
||||
if (!m_pWindowOwner.expired())
|
||||
return m_pWindowOwner->m_vRealPosition.value();
|
||||
return m_pWindowOwner->m_vRealPosition->value();
|
||||
if (!m_pLayerOwner.expired())
|
||||
return m_pLayerOwner->realPosition.value();
|
||||
return m_pLayerOwner->realPosition->value();
|
||||
|
||||
ASSERT(false);
|
||||
return {};
|
||||
|
|
|
@ -169,7 +169,7 @@ Vector2D CSubsurface::coordsGlobal() {
|
|||
Vector2D coords = coordsRelativeToParent();
|
||||
|
||||
if (!m_pWindowParent.expired())
|
||||
coords += m_pWindowParent->m_vRealPosition.value();
|
||||
coords += m_pWindowParent->m_vRealPosition->value();
|
||||
else if (m_pPopupParent)
|
||||
coords += m_pPopupParent->coordsGlobal();
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ Vector2D CWLSurface::correctSmallVec() const {
|
|||
const auto SIZE = getViewporterCorrectedSize();
|
||||
const auto O = m_pWindowOwner.lock();
|
||||
|
||||
return Vector2D{(O->m_vReportedSize.x - SIZE.x) / 2, (O->m_vReportedSize.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_vRealSize.value() / O->m_vReportedSize);
|
||||
return Vector2D{(O->m_vReportedSize.x - SIZE.x) / 2, (O->m_vReportedSize.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_vRealSize->value() / O->m_vReportedSize);
|
||||
}
|
||||
|
||||
Vector2D CWLSurface::correctSmallVecBuf() const {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <hyprutils/animation/AnimatedVariable.hpp>
|
||||
#include <re2/re2.h>
|
||||
|
||||
#include <any>
|
||||
|
@ -11,12 +12,16 @@
|
|||
#include "../render/decorations/CHyprBorderDecoration.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../managers/TokenManager.hpp"
|
||||
#include "../managers/AnimationManager.hpp"
|
||||
#include "../protocols/XDGShell.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../xwayland/XWayland.hpp"
|
||||
#include "../helpers/Color.hpp"
|
||||
|
||||
#include <hyprutils/string/String.hpp>
|
||||
|
||||
using namespace Hyprutils::String;
|
||||
using namespace Hyprutils::Animation;
|
||||
|
||||
PHLWINDOW CWindow::create(SP<CXWaylandSurface> surface) {
|
||||
PHLWINDOW pWindow = SP<CWindow>(new CWindow(surface));
|
||||
|
@ -24,16 +29,16 @@ PHLWINDOW CWindow::create(SP<CXWaylandSurface> surface) {
|
|||
pWindow->m_pSelf = pWindow;
|
||||
pWindow->m_bIsX11 = true;
|
||||
|
||||
pWindow->m_vRealPosition.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_vRealSize.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_fBorderFadeAnimationProgress.create(g_pConfigManager->getAnimationPropertyConfig("border"), pWindow, AVARDAMAGE_BORDER);
|
||||
pWindow->m_fBorderAngleAnimationProgress.create(g_pConfigManager->getAnimationPropertyConfig("borderangle"), pWindow, AVARDAMAGE_BORDER);
|
||||
pWindow->m_fAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_fActiveInactiveAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
|
||||
pWindow->m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_fMovingToWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_fMovingFromWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_vRealPosition, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_vRealSize, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fBorderFadeAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("border"), pWindow, AVARDAMAGE_BORDER);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fBorderAngleAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("borderangle"), pWindow, AVARDAMAGE_BORDER);
|
||||
g_pAnimationManager->createAnimation(1.f, pWindow->m_fAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(1.f, pWindow->m_fActiveInactiveAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_cRealShadowColor, g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fDimPercent, g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fMovingToWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fMovingFromWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
|
||||
pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow));
|
||||
pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow));
|
||||
|
@ -47,16 +52,16 @@ PHLWINDOW CWindow::create(SP<CXDGSurfaceResource> resource) {
|
|||
pWindow->m_pSelf = pWindow;
|
||||
resource->toplevel->window = pWindow;
|
||||
|
||||
pWindow->m_vRealPosition.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_vRealSize.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_fBorderFadeAnimationProgress.create(g_pConfigManager->getAnimationPropertyConfig("border"), pWindow, AVARDAMAGE_BORDER);
|
||||
pWindow->m_fBorderAngleAnimationProgress.create(g_pConfigManager->getAnimationPropertyConfig("borderangle"), pWindow, AVARDAMAGE_BORDER);
|
||||
pWindow->m_fAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_fActiveInactiveAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
|
||||
pWindow->m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_fMovingToWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
pWindow->m_fMovingFromWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_vRealPosition, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_vRealSize, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fBorderFadeAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("border"), pWindow, AVARDAMAGE_BORDER);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fBorderAngleAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("borderangle"), pWindow, AVARDAMAGE_BORDER);
|
||||
g_pAnimationManager->createAnimation(1.f, pWindow->m_fAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(1.f, pWindow->m_fActiveInactiveAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_cRealShadowColor, g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fDimPercent, g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fMovingToWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(0.f, pWindow->m_fMovingFromWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||
|
||||
pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow));
|
||||
pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow));
|
||||
|
@ -118,8 +123,8 @@ SBoxExtents CWindow::getFullWindowExtents() {
|
|||
|
||||
if (m_sWindowData.dimAround.valueOrDefault()) {
|
||||
if (const auto PMONITOR = m_pMonitor.lock(); PMONITOR)
|
||||
return {{m_vRealPosition.value().x - PMONITOR->vecPosition.x, m_vRealPosition.value().y - PMONITOR->vecPosition.y},
|
||||
{PMONITOR->vecSize.x - (m_vRealPosition.value().x - PMONITOR->vecPosition.x), PMONITOR->vecSize.y - (m_vRealPosition.value().y - PMONITOR->vecPosition.y)}};
|
||||
return {{m_vRealPosition->value().x - PMONITOR->vecPosition.x, m_vRealPosition->value().y - PMONITOR->vecPosition.y},
|
||||
{PMONITOR->vecSize.x - (m_vRealPosition->value().x - PMONITOR->vecPosition.x), PMONITOR->vecSize.y - (m_vRealPosition->value().y - PMONITOR->vecPosition.y)}};
|
||||
}
|
||||
|
||||
SBoxExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}};
|
||||
|
@ -183,8 +188,8 @@ CBox CWindow::getFullWindowBoundingBox() {
|
|||
|
||||
auto maxExtents = getFullWindowExtents();
|
||||
|
||||
CBox finalBox = {m_vRealPosition.value().x - maxExtents.topLeft.x, m_vRealPosition.value().y - maxExtents.topLeft.y,
|
||||
m_vRealSize.value().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.value().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
|
||||
CBox finalBox = {m_vRealPosition->value().x - maxExtents.topLeft.x, m_vRealPosition->value().y - maxExtents.topLeft.y,
|
||||
m_vRealSize->value().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize->value().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
|
||||
|
||||
return finalBox;
|
||||
}
|
||||
|
@ -238,7 +243,7 @@ CBox CWindow::getWindowBoxUnified(uint64_t properties) {
|
|||
if (properties & FULL_EXTENTS)
|
||||
EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_pSelf.lock(), false));
|
||||
|
||||
CBox box = {m_vRealPosition.value().x, m_vRealPosition.value().y, m_vRealSize.value().x, m_vRealSize.value().y};
|
||||
CBox box = {m_vRealPosition->value().x, m_vRealPosition->value().y, m_vRealSize->value().x, m_vRealSize->value().y};
|
||||
box.addExtents(EXTENTS);
|
||||
|
||||
return box;
|
||||
|
@ -409,9 +414,9 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) {
|
|||
const auto OLDWORKSPACE = m_pWorkspace;
|
||||
|
||||
m_iMonitorMovedFrom = OLDWORKSPACE ? OLDWORKSPACE->monitorID() : -1;
|
||||
m_fMovingToWorkspaceAlpha.setValueAndWarp(1.F);
|
||||
m_fMovingToWorkspaceAlpha = 0.F;
|
||||
m_fMovingToWorkspaceAlpha.setCallbackOnEnd([this](void* thisptr) { m_iMonitorMovedFrom = -1; });
|
||||
m_fMovingToWorkspaceAlpha->setCallbackOnEnd([this](auto) { m_iMonitorMovedFrom = -1; });
|
||||
m_fMovingToWorkspaceAlpha->setValueAndWarp(1.F);
|
||||
*m_fMovingToWorkspaceAlpha = 0.F;
|
||||
|
||||
m_pWorkspace = pWorkspace;
|
||||
|
||||
|
@ -439,7 +444,7 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) {
|
|||
}
|
||||
|
||||
// update xwayland coords
|
||||
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), m_vRealSize.value());
|
||||
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), m_vRealSize->value());
|
||||
|
||||
if (OLDWORKSPACE && g_pCompositor->isWorkspaceSpecial(OLDWORKSPACE->m_iID) && OLDWORKSPACE->getWindows() == 0 && *PCLOSEONLASTSPECIAL) {
|
||||
if (const auto PMONITOR = OLDWORKSPACE->m_pMonitor.lock(); PMONITOR)
|
||||
|
@ -475,10 +480,6 @@ PHLWINDOW CWindow::x11TransientFor() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static void unregisterVar(void* ptr) {
|
||||
((CBaseAnimatedVariable*)ptr)->unregister();
|
||||
}
|
||||
|
||||
void CWindow::onUnmap() {
|
||||
static auto PCLOSEONLASTSPECIAL = CConfigValue<Hyprlang::INT>("misc:close_special_on_empty");
|
||||
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
|
||||
|
@ -497,19 +498,6 @@ void CWindow::onUnmap() {
|
|||
|
||||
m_iLastWorkspace = m_pWorkspace->m_iID;
|
||||
|
||||
m_vRealPosition.setCallbackOnEnd(unregisterVar);
|
||||
m_vRealSize.setCallbackOnEnd(unregisterVar);
|
||||
m_fBorderFadeAnimationProgress.setCallbackOnEnd(unregisterVar);
|
||||
m_fBorderAngleAnimationProgress.setCallbackOnEnd(unregisterVar);
|
||||
m_fActiveInactiveAlpha.setCallbackOnEnd(unregisterVar);
|
||||
m_fAlpha.setCallbackOnEnd(unregisterVar);
|
||||
m_cRealShadowColor.setCallbackOnEnd(unregisterVar);
|
||||
m_fDimPercent.setCallbackOnEnd(unregisterVar);
|
||||
m_fMovingToWorkspaceAlpha.setCallbackOnEnd(unregisterVar);
|
||||
m_fMovingFromWorkspaceAlpha.setCallbackOnEnd(unregisterVar);
|
||||
|
||||
m_vRealSize.setCallbackOnBegin(nullptr);
|
||||
|
||||
std::erase_if(g_pCompositor->m_vWindowFocusHistory, [&](const auto& other) { return other.expired() || other.lock().get() == this; });
|
||||
|
||||
if (*PCLOSEONLASTSPECIAL && m_pWorkspace && m_pWorkspace->getWindows() == 0 && onSpecialWorkspace()) {
|
||||
|
@ -541,34 +529,24 @@ void CWindow::onUnmap() {
|
|||
|
||||
void CWindow::onMap() {
|
||||
// JIC, reset the callbacks. If any are set, we'll make sure they are cleared so we don't accidentally unset them. (In case a window got remapped)
|
||||
m_vRealPosition.resetAllCallbacks();
|
||||
m_vRealSize.resetAllCallbacks();
|
||||
m_fBorderFadeAnimationProgress.resetAllCallbacks();
|
||||
m_fBorderAngleAnimationProgress.resetAllCallbacks();
|
||||
m_fActiveInactiveAlpha.resetAllCallbacks();
|
||||
m_fAlpha.resetAllCallbacks();
|
||||
m_cRealShadowColor.resetAllCallbacks();
|
||||
m_fDimPercent.resetAllCallbacks();
|
||||
m_fMovingToWorkspaceAlpha.resetAllCallbacks();
|
||||
m_fMovingFromWorkspaceAlpha.resetAllCallbacks();
|
||||
m_vRealPosition->resetAllCallbacks();
|
||||
m_vRealSize->resetAllCallbacks();
|
||||
m_fBorderFadeAnimationProgress->resetAllCallbacks();
|
||||
m_fBorderAngleAnimationProgress->resetAllCallbacks();
|
||||
m_fActiveInactiveAlpha->resetAllCallbacks();
|
||||
m_fAlpha->resetAllCallbacks();
|
||||
m_cRealShadowColor->resetAllCallbacks();
|
||||
m_fDimPercent->resetAllCallbacks();
|
||||
m_fMovingToWorkspaceAlpha->resetAllCallbacks();
|
||||
m_fMovingFromWorkspaceAlpha->resetAllCallbacks();
|
||||
|
||||
m_vRealPosition.registerVar();
|
||||
m_vRealSize.registerVar();
|
||||
m_fBorderFadeAnimationProgress.registerVar();
|
||||
m_fBorderAngleAnimationProgress.registerVar();
|
||||
m_fActiveInactiveAlpha.registerVar();
|
||||
m_fAlpha.registerVar();
|
||||
m_cRealShadowColor.registerVar();
|
||||
m_fDimPercent.registerVar();
|
||||
m_fMovingToWorkspaceAlpha.registerVar();
|
||||
m_fMovingFromWorkspaceAlpha.registerVar();
|
||||
m_fMovingFromWorkspaceAlpha->setValueAndWarp(1.F);
|
||||
m_fBorderAngleAnimationProgress->setCallbackOnEnd([&](WP<CBaseAnimatedVariable> p) { onBorderAngleAnimEnd(p); }, false);
|
||||
|
||||
m_fBorderAngleAnimationProgress.setCallbackOnEnd([&](void* ptr) { onBorderAngleAnimEnd(ptr); }, false);
|
||||
m_fBorderAngleAnimationProgress->setValueAndWarp(0.f);
|
||||
*m_fBorderAngleAnimationProgress = 1.f;
|
||||
|
||||
m_fBorderAngleAnimationProgress.setValueAndWarp(0.f);
|
||||
m_fBorderAngleAnimationProgress = 1.f;
|
||||
|
||||
m_fMovingFromWorkspaceAlpha.setValueAndWarp(1.F);
|
||||
m_fMovingFromWorkspaceAlpha->setValueAndWarp(1.F);
|
||||
|
||||
g_pCompositor->m_vWindowFocusHistory.push_back(m_pSelf);
|
||||
|
||||
|
@ -584,20 +562,22 @@ void CWindow::onMap() {
|
|||
m_pPopupHead = std::make_unique<CPopup>(m_pSelf.lock());
|
||||
}
|
||||
|
||||
void CWindow::onBorderAngleAnimEnd(void* ptr) {
|
||||
const auto PANIMVAR = (CAnimatedVariable<float>*)ptr;
|
||||
|
||||
const std::string STYLE = PANIMVAR->getConfig()->pValues->internalStyle;
|
||||
|
||||
if (STYLE != "loop" || !PANIMVAR->getConfig()->pValues->internalEnabled)
|
||||
void CWindow::onBorderAngleAnimEnd(WP<CBaseAnimatedVariable> pav) {
|
||||
const auto PAV = pav.lock();
|
||||
if (!PAV)
|
||||
return;
|
||||
|
||||
if (PAV->getStyle() != "loop" || !PAV->enabled())
|
||||
return;
|
||||
|
||||
const auto PANIMVAR = dynamic_cast<CAnimatedVariable<float>*>(PAV.get());
|
||||
|
||||
PANIMVAR->setCallbackOnEnd(nullptr); // we remove the callback here because otherwise setvalueandwarp will recurse this
|
||||
|
||||
PANIMVAR->setValueAndWarp(0);
|
||||
*PANIMVAR = 1.f;
|
||||
|
||||
PANIMVAR->setCallbackOnEnd([&](void* ptr) { onBorderAngleAnimEnd(ptr); }, false);
|
||||
PANIMVAR->setCallbackOnEnd([&](WP<CBaseAnimatedVariable> pav) { onBorderAngleAnimEnd(pav); }, false);
|
||||
}
|
||||
|
||||
void CWindow::setHidden(bool hidden) {
|
||||
|
@ -830,10 +810,10 @@ bool CWindow::isInCurvedCorner(double x, double y) {
|
|||
return false;
|
||||
|
||||
// (x0, y0), (x0, y1), ... are the center point of rounding at each corner
|
||||
double x0 = m_vRealPosition.value().x + ROUNDING;
|
||||
double y0 = m_vRealPosition.value().y + ROUNDING;
|
||||
double x1 = m_vRealPosition.value().x + m_vRealSize.value().x - ROUNDING;
|
||||
double y1 = m_vRealPosition.value().y + m_vRealSize.value().y - ROUNDING;
|
||||
double x0 = m_vRealPosition->value().x + ROUNDING;
|
||||
double y0 = m_vRealPosition->value().y + ROUNDING;
|
||||
double x1 = m_vRealPosition->value().x + m_vRealSize->value().x - ROUNDING;
|
||||
double y1 = m_vRealPosition->value().y + m_vRealSize->value().y - ROUNDING;
|
||||
|
||||
if (x < x0 && y < y0) {
|
||||
return std::pow(x0 - x, ROUNDINGPOWER) + std::pow(y0 - y, ROUNDINGPOWER) > std::pow((double)ROUNDING, ROUNDINGPOWER);
|
||||
|
@ -1032,8 +1012,8 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
|
|||
if (FULLSCREEN)
|
||||
g_pCompositor->setWindowFullscreenInternal(PCURRENT, FSMODE_NONE);
|
||||
|
||||
const auto PWINDOWSIZE = PCURRENT->m_vRealSize.goal();
|
||||
const auto PWINDOWPOS = PCURRENT->m_vRealPosition.goal();
|
||||
const auto PWINDOWSIZE = PCURRENT->m_vRealSize->goal();
|
||||
const auto PWINDOWPOS = PCURRENT->m_vRealPosition->goal();
|
||||
|
||||
PCURRENT->setHidden(true);
|
||||
pWindow->setHidden(false); // can remove m_pLastWindow
|
||||
|
@ -1041,8 +1021,8 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
|
|||
g_pLayoutManager->getCurrentLayout()->replaceWindowDataWith(PCURRENT, pWindow);
|
||||
|
||||
if (PCURRENT->m_bIsFloating) {
|
||||
pWindow->m_vRealPosition.setValueAndWarp(PWINDOWPOS);
|
||||
pWindow->m_vRealSize.setValueAndWarp(PWINDOWSIZE);
|
||||
pWindow->m_vRealPosition->setValueAndWarp(PWINDOWPOS);
|
||||
pWindow->m_vRealSize->setValueAndWarp(PWINDOWSIZE);
|
||||
}
|
||||
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
|
@ -1124,22 +1104,22 @@ void CWindow::updateGroupOutputs() {
|
|||
curr->m_pMonitor = m_pMonitor;
|
||||
curr->moveToWorkspace(WS);
|
||||
|
||||
curr->m_vRealPosition = m_vRealPosition.goal();
|
||||
curr->m_vRealSize = m_vRealSize.goal();
|
||||
*curr->m_vRealPosition = m_vRealPosition->goal();
|
||||
*curr->m_vRealSize = m_vRealSize->goal();
|
||||
|
||||
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||
}
|
||||
}
|
||||
|
||||
Vector2D CWindow::middle() {
|
||||
return m_vRealPosition.goal() + m_vRealSize.goal() / 2.f;
|
||||
return m_vRealPosition->goal() + m_vRealSize->goal() / 2.f;
|
||||
}
|
||||
|
||||
bool CWindow::opaque() {
|
||||
if (m_fAlpha.value() != 1.f || m_fActiveInactiveAlpha.value() != 1.f)
|
||||
if (m_fAlpha->value() != 1.f || m_fActiveInactiveAlpha->value() != 1.f)
|
||||
return false;
|
||||
|
||||
if (m_vRealSize.goal().floor() != m_vReportedSize)
|
||||
if (m_vRealSize->goal().floor() != m_vReportedSize)
|
||||
return false;
|
||||
|
||||
const auto PWORKSPACE = m_pWorkspace;
|
||||
|
@ -1147,7 +1127,7 @@ bool CWindow::opaque() {
|
|||
if (m_pWLSurface->small() && !m_pWLSurface->m_bFillIgnoreSmall)
|
||||
return false;
|
||||
|
||||
if (PWORKSPACE->m_fAlpha.value() != 1.f)
|
||||
if (PWORKSPACE->m_fAlpha->value() != 1.f)
|
||||
return false;
|
||||
|
||||
if (m_bIsX11 && m_pXWaylandSurface && m_pXWaylandSurface->surface && m_pXWaylandSurface->surface->current.texture)
|
||||
|
@ -1237,15 +1217,13 @@ void CWindow::setSuspended(bool suspend) {
|
|||
}
|
||||
|
||||
bool CWindow::visibleOnMonitor(PHLMONITOR pMonitor) {
|
||||
CBox wbox = {m_vRealPosition.value(), m_vRealSize.value()};
|
||||
CBox wbox = {m_vRealPosition->value(), m_vRealSize->value()};
|
||||
|
||||
return !wbox.intersection({pMonitor->vecPosition, pMonitor->vecSize}).empty();
|
||||
}
|
||||
|
||||
void CWindow::setAnimationsToMove() {
|
||||
auto* const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove");
|
||||
m_vRealPosition.setConfig(PANIMCFG);
|
||||
m_vRealSize.setConfig(PANIMCFG);
|
||||
m_vRealPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
|
||||
m_bAnimatingIn = false;
|
||||
}
|
||||
|
||||
|
@ -1266,16 +1244,16 @@ void CWindow::onWorkspaceAnimUpdate() {
|
|||
return;
|
||||
|
||||
const auto WINBB = getFullWindowBoundingBox();
|
||||
if (PWORKSPACE->m_vRenderOffset.value().x != 0) {
|
||||
const auto PROGRESS = PWORKSPACE->m_vRenderOffset.value().x / PWSMON->vecSize.x;
|
||||
if (PWORKSPACE->m_vRenderOffset->value().x != 0) {
|
||||
const auto PROGRESS = PWORKSPACE->m_vRenderOffset->value().x / PWSMON->vecSize.x;
|
||||
|
||||
if (WINBB.x < PWSMON->vecPosition.x)
|
||||
offset.x += (PWSMON->vecPosition.x - WINBB.x) * PROGRESS;
|
||||
|
||||
if (WINBB.x + WINBB.width > PWSMON->vecPosition.x + PWSMON->vecSize.x)
|
||||
offset.x += (WINBB.x + WINBB.width - PWSMON->vecPosition.x - PWSMON->vecSize.x) * PROGRESS;
|
||||
} else if (PWORKSPACE->m_vRenderOffset.value().y != 0) {
|
||||
const auto PROGRESS = PWORKSPACE->m_vRenderOffset.value().y / PWSMON->vecSize.y;
|
||||
} else if (PWORKSPACE->m_vRenderOffset->value().y != 0) {
|
||||
const auto PROGRESS = PWORKSPACE->m_vRenderOffset->value().y / PWSMON->vecSize.y;
|
||||
|
||||
if (WINBB.y < PWSMON->vecPosition.y)
|
||||
offset.y += (PWSMON->vecPosition.y - WINBB.y) * PROGRESS;
|
||||
|
@ -1306,12 +1284,12 @@ int CWindow::surfacesCount() {
|
|||
}
|
||||
|
||||
void CWindow::clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize) {
|
||||
const Vector2D REALSIZE = m_vRealSize.goal();
|
||||
const Vector2D REALSIZE = m_vRealSize->goal();
|
||||
const Vector2D NEWSIZE = REALSIZE.clamp(minSize.value_or(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), maxSize.value_or(Vector2D{INFINITY, INFINITY}));
|
||||
const Vector2D DELTA = REALSIZE - NEWSIZE;
|
||||
|
||||
m_vRealPosition = m_vRealPosition.goal() + DELTA / 2.0;
|
||||
m_vRealSize = NEWSIZE;
|
||||
*m_vRealPosition = m_vRealPosition->goal() + DELTA / 2.0;
|
||||
*m_vRealSize = NEWSIZE;
|
||||
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), NEWSIZE);
|
||||
}
|
||||
|
||||
|
@ -1525,7 +1503,7 @@ void CWindow::onX11Configure(CBox box) {
|
|||
g_pHyprRenderer->damageWindow(m_pSelf.lock());
|
||||
|
||||
if (!m_bIsFloating || isFullscreen() || g_pInputManager->currentlyDraggedWindow == m_pSelf) {
|
||||
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), m_vRealSize.goal(), true);
|
||||
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), m_vRealSize->goal(), true);
|
||||
g_pInputManager->refocus();
|
||||
g_pHyprRenderer->damageWindow(m_pSelf.lock());
|
||||
return;
|
||||
|
@ -1538,19 +1516,19 @@ void CWindow::onX11Configure(CBox box) {
|
|||
|
||||
const auto LOGICALPOS = g_pXWaylandManager->xwaylandToWaylandCoords(box.pos());
|
||||
|
||||
m_vRealPosition.setValueAndWarp(LOGICALPOS);
|
||||
m_vRealSize.setValueAndWarp(box.size());
|
||||
m_vRealPosition->setValueAndWarp(LOGICALPOS);
|
||||
m_vRealSize->setValueAndWarp(box.size());
|
||||
|
||||
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");
|
||||
if (*PXWLFORCESCALEZERO) {
|
||||
if (const auto PMONITOR = m_pMonitor.lock(); PMONITOR) {
|
||||
m_vRealSize.setValueAndWarp(m_vRealSize.goal() / PMONITOR->scale);
|
||||
m_vRealSize->setValueAndWarp(m_vRealSize->goal() / PMONITOR->scale);
|
||||
m_fX11SurfaceScaledBy = PMONITOR->scale;
|
||||
}
|
||||
}
|
||||
|
||||
m_vPosition = m_vRealPosition.value();
|
||||
m_vSize = m_vRealSize.value();
|
||||
m_vPosition = m_vRealPosition->value();
|
||||
m_vSize = m_vRealSize->value();
|
||||
|
||||
m_pXWaylandSurface->configure(box);
|
||||
|
||||
|
@ -1562,7 +1540,7 @@ void CWindow::onX11Configure(CBox box) {
|
|||
if (!m_pWorkspace || !m_pWorkspace->isVisible())
|
||||
return; // further things are only for visible windows
|
||||
|
||||
m_pWorkspace = g_pCompositor->getMonitorFromVector(m_vRealPosition.value() + m_vRealSize.value() / 2.f)->activeWorkspace;
|
||||
m_pWorkspace = g_pCompositor->getMonitorFromVector(m_vRealPosition->value() + m_vRealSize->value() / 2.f)->activeWorkspace;
|
||||
|
||||
g_pCompositor->changeWindowZOrder(m_pSelf.lock(), true);
|
||||
|
||||
|
|
|
@ -233,8 +233,8 @@ class CWindow {
|
|||
Vector2D m_vSize = Vector2D(0, 0);
|
||||
|
||||
// this is the real position and size used to draw the thing
|
||||
CAnimatedVariable<Vector2D> m_vRealPosition;
|
||||
CAnimatedVariable<Vector2D> m_vRealSize;
|
||||
PHLANIMVAR<Vector2D> m_vRealPosition;
|
||||
PHLANIMVAR<Vector2D> m_vRealSize;
|
||||
|
||||
// for not spamming the protocols
|
||||
Vector2D m_vReportedPosition;
|
||||
|
@ -298,19 +298,19 @@ class CWindow {
|
|||
std::unique_ptr<CPopup> m_pPopupHead;
|
||||
|
||||
// Animated border
|
||||
CGradientValueData m_cRealBorderColor = {0};
|
||||
CGradientValueData m_cRealBorderColorPrevious = {0};
|
||||
CAnimatedVariable<float> m_fBorderFadeAnimationProgress;
|
||||
CAnimatedVariable<float> m_fBorderAngleAnimationProgress;
|
||||
CGradientValueData m_cRealBorderColor = {0};
|
||||
CGradientValueData m_cRealBorderColorPrevious = {0};
|
||||
PHLANIMVAR<float> m_fBorderFadeAnimationProgress;
|
||||
PHLANIMVAR<float> m_fBorderAngleAnimationProgress;
|
||||
|
||||
// Fade in-out
|
||||
CAnimatedVariable<float> m_fAlpha;
|
||||
bool m_bFadingOut = false;
|
||||
bool m_bReadyToDelete = false;
|
||||
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
|
||||
Vector2D m_vOriginalClosedSize; // drawing the closing animations
|
||||
SBoxExtents m_eOriginalClosedExtents;
|
||||
bool m_bAnimatingIn = false;
|
||||
PHLANIMVAR<float> m_fAlpha;
|
||||
bool m_bFadingOut = false;
|
||||
bool m_bReadyToDelete = false;
|
||||
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
|
||||
Vector2D m_vOriginalClosedSize; // drawing the closing animations
|
||||
SBoxExtents m_eOriginalClosedExtents;
|
||||
bool m_bAnimatingIn = false;
|
||||
|
||||
// For pinned (sticky) windows
|
||||
bool m_bPinned = false;
|
||||
|
@ -336,18 +336,18 @@ class CWindow {
|
|||
std::vector<std::unique_ptr<IWindowTransformer>> m_vTransformers;
|
||||
|
||||
// for alpha
|
||||
CAnimatedVariable<float> m_fActiveInactiveAlpha;
|
||||
CAnimatedVariable<float> m_fMovingFromWorkspaceAlpha;
|
||||
PHLANIMVAR<float> m_fActiveInactiveAlpha;
|
||||
PHLANIMVAR<float> m_fMovingFromWorkspaceAlpha;
|
||||
|
||||
// animated shadow color
|
||||
CAnimatedVariable<CHyprColor> m_cRealShadowColor;
|
||||
PHLANIMVAR<CHyprColor> m_cRealShadowColor;
|
||||
|
||||
// animated tint
|
||||
CAnimatedVariable<float> m_fDimPercent;
|
||||
PHLANIMVAR<float> m_fDimPercent;
|
||||
|
||||
// animate moving to an invisible workspace
|
||||
int m_iMonitorMovedFrom = -1; // -1 means not moving
|
||||
CAnimatedVariable<float> m_fMovingToWorkspaceAlpha;
|
||||
int m_iMonitorMovedFrom = -1; // -1 means not moving
|
||||
PHLANIMVAR<float> m_fMovingToWorkspaceAlpha;
|
||||
|
||||
// swallowing
|
||||
PHLWINDOWREF m_pSwallowed;
|
||||
|
@ -432,7 +432,7 @@ class CWindow {
|
|||
float getScrollTouchpad();
|
||||
void updateWindowData();
|
||||
void updateWindowData(const struct SWorkspaceRule&);
|
||||
void onBorderAngleAnimEnd(void* ptr);
|
||||
void onBorderAngleAnimEnd(WP<Hyprutils::Animation::CBaseAnimatedVariable> pav);
|
||||
bool isInCurvedCorner(double x, double y);
|
||||
bool hasPopupAt(const Vector2D& pos);
|
||||
int popupsCount();
|
||||
|
@ -467,7 +467,7 @@ class CWindow {
|
|||
Vector2D requestedMaxSize();
|
||||
|
||||
CBox getWindowMainSurfaceBox() const {
|
||||
return {m_vRealPosition.value().x, m_vRealPosition.value().y, m_vRealSize.value().x, m_vRealSize.value().y};
|
||||
return {m_vRealPosition->value().x, m_vRealPosition->value().y, m_vRealSize->value().x, m_vRealSize->value().y};
|
||||
}
|
||||
|
||||
// listeners
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#include "Workspace.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "config/ConfigManager.hpp"
|
||||
#include "managers/AnimationManager.hpp"
|
||||
|
||||
#include <hyprutils/animation/AnimatedVariable.hpp>
|
||||
#include <hyprutils/string/String.hpp>
|
||||
using namespace Hyprutils::String;
|
||||
|
||||
|
@ -19,16 +22,10 @@ CWorkspace::CWorkspace(WORKSPACEID id, PHLMONITOR monitor, std::string name, boo
|
|||
void CWorkspace::init(PHLWORKSPACE self) {
|
||||
m_pSelf = self;
|
||||
|
||||
m_vRenderOffset.create(m_bIsSpecialWorkspace ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspaceIn") :
|
||||
g_pConfigManager->getAnimationPropertyConfig("workspacesIn"),
|
||||
self, AVARDAMAGE_ENTIRE);
|
||||
m_fAlpha.create(AVARTYPE_FLOAT,
|
||||
m_bIsSpecialWorkspace ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspaceIn") : g_pConfigManager->getAnimationPropertyConfig("workspacesIn"), self,
|
||||
AVARDAMAGE_ENTIRE);
|
||||
m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
m_vRenderOffset.registerVar();
|
||||
m_fAlpha.registerVar();
|
||||
g_pAnimationManager->createAnimation(Vector2D(0, 0), m_vRenderOffset,
|
||||
g_pConfigManager->getAnimationPropertyConfig(m_bIsSpecialWorkspace ? "specialWorkspaceIn" : "workspacesIn"), self, AVARDAMAGE_ENTIRE);
|
||||
g_pAnimationManager->createAnimation(1.f, m_fAlpha, g_pConfigManager->getAnimationPropertyConfig(m_bIsSpecialWorkspace ? "specialWorkspaceIn" : "workspacesIn"), self,
|
||||
AVARDAMAGE_ENTIRE);
|
||||
|
||||
const auto RULEFORTHIS = g_pConfigManager->getWorkspaceRuleFor(self);
|
||||
if (RULEFORTHIS.defaultName.has_value())
|
||||
|
@ -63,8 +60,6 @@ SWorkspaceIDName CWorkspace::getPrevWorkspaceIDName(bool perMonitor) const {
|
|||
}
|
||||
|
||||
CWorkspace::~CWorkspace() {
|
||||
m_vRenderOffset.unregister();
|
||||
|
||||
Debug::log(LOG, "Destroying workspace ID {}", m_iID);
|
||||
|
||||
// check if g_pHookSystem and g_pEventManager exist, they might be destroyed as in when the compositor is closing.
|
||||
|
@ -82,15 +77,15 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||
if (!instant) {
|
||||
const std::string ANIMNAME = std::format("{}{}", m_bIsSpecialWorkspace ? "specialWorkspace" : "workspaces", in ? "In" : "Out");
|
||||
|
||||
m_fAlpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig(ANIMNAME);
|
||||
m_vRenderOffset.m_pConfig = g_pConfigManager->getAnimationPropertyConfig(ANIMNAME);
|
||||
m_fAlpha->setConfig(g_pConfigManager->getAnimationPropertyConfig(ANIMNAME));
|
||||
m_vRenderOffset->setConfig(g_pConfigManager->getAnimationPropertyConfig(ANIMNAME));
|
||||
}
|
||||
|
||||
const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
|
||||
const auto ANIMSTYLE = m_fAlpha->getStyle();
|
||||
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
|
||||
|
||||
// set floating windows offset callbacks
|
||||
m_vRenderOffset.setUpdateCallback([&](void*) {
|
||||
m_vRenderOffset->setUpdateCallback([&](auto) {
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (!validMapped(w) || w->workspaceID() != m_iID)
|
||||
continue;
|
||||
|
@ -110,84 +105,84 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||
} catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
|
||||
}
|
||||
|
||||
m_fAlpha.setValueAndWarp(1.f);
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||
m_fAlpha->setValueAndWarp(1.f);
|
||||
m_vRenderOffset->setValueAndWarp(Vector2D(0, 0));
|
||||
|
||||
if (ANIMSTYLE.starts_with("slidefadevert")) {
|
||||
if (in) {
|
||||
m_fAlpha.setValueAndWarp(0.f);
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
|
||||
m_fAlpha = 1.f;
|
||||
m_vRenderOffset = Vector2D(0, 0);
|
||||
m_fAlpha->setValueAndWarp(0.f);
|
||||
m_vRenderOffset->setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
|
||||
*m_fAlpha = 1.f;
|
||||
*m_vRenderOffset = Vector2D(0, 0);
|
||||
} else {
|
||||
m_fAlpha.setValueAndWarp(1.f);
|
||||
m_fAlpha = 0.f;
|
||||
m_vRenderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
|
||||
m_fAlpha->setValueAndWarp(1.f);
|
||||
*m_fAlpha = 0.f;
|
||||
*m_vRenderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
|
||||
}
|
||||
} else {
|
||||
if (in) {
|
||||
m_fAlpha.setValueAndWarp(0.f);
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
|
||||
m_fAlpha = 1.f;
|
||||
m_vRenderOffset = Vector2D(0, 0);
|
||||
m_fAlpha->setValueAndWarp(0.f);
|
||||
m_vRenderOffset->setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
|
||||
*m_fAlpha = 1.f;
|
||||
*m_vRenderOffset = Vector2D(0, 0);
|
||||
} else {
|
||||
m_fAlpha.setValueAndWarp(1.f);
|
||||
m_fAlpha = 0.f;
|
||||
m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
|
||||
m_fAlpha->setValueAndWarp(1.f);
|
||||
*m_fAlpha = 0.f;
|
||||
*m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
|
||||
}
|
||||
}
|
||||
} else if (ANIMSTYLE == "fade") {
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0)); // fix a bug, if switching from slide -> fade.
|
||||
m_vRenderOffset->setValueAndWarp(Vector2D(0, 0)); // fix a bug, if switching from slide -> fade.
|
||||
|
||||
if (in) {
|
||||
m_fAlpha.setValueAndWarp(0.f);
|
||||
m_fAlpha = 1.f;
|
||||
m_fAlpha->setValueAndWarp(0.f);
|
||||
*m_fAlpha = 1.f;
|
||||
} else {
|
||||
m_fAlpha.setValueAndWarp(1.f);
|
||||
m_fAlpha = 0.f;
|
||||
m_fAlpha->setValueAndWarp(1.f);
|
||||
*m_fAlpha = 0.f;
|
||||
}
|
||||
} else if (ANIMSTYLE == "slidevert") {
|
||||
// fallback is slide
|
||||
const auto PMONITOR = m_pMonitor.lock();
|
||||
const auto YDISTANCE = PMONITOR->vecSize.y + *PWORKSPACEGAP;
|
||||
|
||||
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
||||
m_fAlpha->setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
||||
|
||||
if (in) {
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(0.0, left ? YDISTANCE : -YDISTANCE));
|
||||
m_vRenderOffset = Vector2D(0, 0);
|
||||
m_vRenderOffset->setValueAndWarp(Vector2D(0.0, left ? YDISTANCE : -YDISTANCE));
|
||||
*m_vRenderOffset = Vector2D(0, 0);
|
||||
} else {
|
||||
m_vRenderOffset = Vector2D(0.0, left ? -YDISTANCE : YDISTANCE);
|
||||
*m_vRenderOffset = Vector2D(0.0, left ? -YDISTANCE : YDISTANCE);
|
||||
}
|
||||
} else {
|
||||
// fallback is slide
|
||||
const auto PMONITOR = m_pMonitor.lock();
|
||||
const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
|
||||
|
||||
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
||||
m_fAlpha->setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
||||
|
||||
if (in) {
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0.0));
|
||||
m_vRenderOffset = Vector2D(0, 0);
|
||||
m_vRenderOffset->setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0.0));
|
||||
*m_vRenderOffset = Vector2D(0, 0);
|
||||
} else {
|
||||
m_vRenderOffset = Vector2D(left ? -XDISTANCE : XDISTANCE, 0.0);
|
||||
*m_vRenderOffset = Vector2D(left ? -XDISTANCE : XDISTANCE, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bIsSpecialWorkspace) {
|
||||
// required for open/close animations
|
||||
if (in) {
|
||||
m_fAlpha.setValueAndWarp(0.f);
|
||||
m_fAlpha = 1.f;
|
||||
m_fAlpha->setValueAndWarp(0.f);
|
||||
*m_fAlpha = 1.f;
|
||||
} else {
|
||||
m_fAlpha.setValueAndWarp(1.f);
|
||||
m_fAlpha = 0.f;
|
||||
m_fAlpha->setValueAndWarp(1.f);
|
||||
*m_fAlpha = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
if (instant) {
|
||||
m_vRenderOffset.warp();
|
||||
m_fAlpha.warp();
|
||||
m_vRenderOffset->warp();
|
||||
m_fAlpha->warp();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,7 +628,7 @@ void CWorkspace::forceReportSizesToWindows() {
|
|||
if (w->m_pWorkspace != m_pSelf || !w->m_bIsMapped || w->isHidden())
|
||||
continue;
|
||||
|
||||
g_pXWaylandManager->setWindowSize(w, w->m_vRealSize.value(), true);
|
||||
g_pXWaylandManager->setWindowSize(w, w->m_vRealSize->value(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ class CWorkspace {
|
|||
wl_array m_wlrCoordinateArr;
|
||||
|
||||
// for animations
|
||||
CAnimatedVariable<Vector2D> m_vRenderOffset;
|
||||
CAnimatedVariable<float> m_fAlpha;
|
||||
bool m_bForceRendering = false;
|
||||
PHLANIMVAR<Vector2D> m_vRenderOffset;
|
||||
PHLANIMVAR<float> m_fAlpha;
|
||||
bool m_bForceRendering = false;
|
||||
|
||||
// allows damage to propagate.
|
||||
bool m_bVisible = false;
|
||||
|
|
|
@ -12,10 +12,12 @@
|
|||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../protocols/ToplevelExport.hpp"
|
||||
#include "../xwayland/XSurface.hpp"
|
||||
#include "managers/AnimationManager.hpp"
|
||||
#include "managers/PointerManager.hpp"
|
||||
|
||||
#include <hyprutils/string/String.hpp>
|
||||
using namespace Hyprutils::String;
|
||||
using namespace Hyprutils::Animation;
|
||||
|
||||
// ------------------------------------------------------------ //
|
||||
// __ _______ _ _ _____ ______ _______ //
|
||||
|
@ -27,15 +29,17 @@ using namespace Hyprutils::String;
|
|||
// //
|
||||
// ------------------------------------------------------------ //
|
||||
|
||||
static void setAnimToMove(void* data) {
|
||||
auto* const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove");
|
||||
static void setVector2DAnimToMove(WP<CBaseAnimatedVariable> pav) {
|
||||
const auto PAV = pav.lock();
|
||||
if (!PAV)
|
||||
return;
|
||||
|
||||
CBaseAnimatedVariable* animvar = (CBaseAnimatedVariable*)data;
|
||||
CAnimatedVariable<Vector2D>* animvar = dynamic_cast<CAnimatedVariable<Vector2D>*>(PAV.get());
|
||||
animvar->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
|
||||
|
||||
animvar->setConfig(PANIMCFG);
|
||||
|
||||
if (animvar->getWindow() && !animvar->getWindow()->m_vRealPosition.isBeingAnimated() && !animvar->getWindow()->m_vRealSize.isBeingAnimated())
|
||||
animvar->getWindow()->m_bAnimatingIn = false;
|
||||
const auto PHLWINDOW = animvar->m_Context.pWindow.lock();
|
||||
if (PHLWINDOW && PHLWINDOW->m_vRealPosition->isBeingAnimated() && PHLWINDOW->m_vRealSize->isBeingAnimated())
|
||||
PHLWINDOW->m_bAnimatingIn = false;
|
||||
}
|
||||
|
||||
void Events::listener_mapWindow(void* owner, void* data) {
|
||||
|
@ -378,10 +382,10 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
const auto MAXSIZE = PWINDOW->requestedMaxSize();
|
||||
|
||||
const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, PMONITOR->vecSize.x) :
|
||||
stringToFloatClamp(SIZEXSTR, PWINDOW->m_vRealSize.goal().x, PMONITOR->vecSize.x);
|
||||
stringToFloatClamp(SIZEXSTR, PWINDOW->m_vRealSize->goal().x, PMONITOR->vecSize.x);
|
||||
|
||||
const float SIZEY = SIZEYSTR == "max" ? std::clamp(MAXSIZE.y, MIN_WINDOW_SIZE, PMONITOR->vecSize.y) :
|
||||
stringToFloatClamp(SIZEYSTR, PWINDOW->m_vRealSize.goal().y, PMONITOR->vecSize.y);
|
||||
stringToFloatClamp(SIZEYSTR, PWINDOW->m_vRealSize->goal().y, PMONITOR->vecSize.y);
|
||||
|
||||
Debug::log(LOG, "Rule size, applying to {}", PWINDOW);
|
||||
|
||||
|
@ -418,7 +422,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
(!POSXRAW.contains('%') ? std::stoi(POSXRAW) : std::stof(POSXRAW.substr(0, POSXRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
|
||||
|
||||
if (subtractWindow)
|
||||
posX -= PWINDOW->m_vRealSize.goal().x;
|
||||
posX -= PWINDOW->m_vRealSize->goal().x;
|
||||
|
||||
if (CURSOR)
|
||||
Debug::log(ERR, "Cursor is not compatible with 100%-, ignoring cursor!");
|
||||
|
@ -430,7 +434,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
posX = g_pInputManager->getMouseCoordsInternal().x - PMONITOR->vecPosition.x;
|
||||
} else {
|
||||
posX = g_pInputManager->getMouseCoordsInternal().x - PMONITOR->vecPosition.x +
|
||||
(!POSXSTR.contains('%') ? std::stoi(POSXSTR) : std::stof(POSXSTR.substr(0, POSXSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize.goal().x);
|
||||
(!POSXSTR.contains('%') ? std::stoi(POSXSTR) : std::stof(POSXSTR.substr(0, POSXSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize->goal().x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -441,7 +445,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
(!POSYRAW.contains('%') ? std::stoi(POSYRAW) : std::stof(POSYRAW.substr(0, POSYRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
|
||||
|
||||
if (subtractWindow)
|
||||
posY -= PWINDOW->m_vRealSize.goal().y;
|
||||
posY -= PWINDOW->m_vRealSize->goal().y;
|
||||
|
||||
if (CURSOR)
|
||||
Debug::log(ERR, "Cursor is not compatible with 100%-, ignoring cursor!");
|
||||
|
@ -453,7 +457,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
posY = g_pInputManager->getMouseCoordsInternal().y - PMONITOR->vecPosition.y;
|
||||
} else {
|
||||
posY = g_pInputManager->getMouseCoordsInternal().y - PMONITOR->vecPosition.y +
|
||||
(!POSYSTR.contains('%') ? std::stoi(POSYSTR) : std::stof(POSYSTR.substr(0, POSYSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize.goal().y);
|
||||
(!POSYSTR.contains('%') ? std::stoi(POSYSTR) : std::stof(POSYSTR.substr(0, POSYSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize->goal().y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,15 +465,15 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
int borderSize = PWINDOW->getRealBorderSize();
|
||||
|
||||
posX = std::clamp(posX, (int)(PMONITOR->vecReservedTopLeft.x + borderSize),
|
||||
(int)(PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PWINDOW->m_vRealSize.goal().x - borderSize));
|
||||
(int)(PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PWINDOW->m_vRealSize->goal().x - borderSize));
|
||||
|
||||
posY = std::clamp(posY, (int)(PMONITOR->vecReservedTopLeft.y + borderSize),
|
||||
(int)(PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PWINDOW->m_vRealSize.goal().y - borderSize));
|
||||
(int)(PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PWINDOW->m_vRealSize->goal().y - borderSize));
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Rule move, applying to {}", PWINDOW);
|
||||
|
||||
PWINDOW->m_vRealPosition = Vector2D(posX, posY) + PMONITOR->vecPosition;
|
||||
*PWINDOW->m_vRealPosition = Vector2D(posX, posY) + PMONITOR->vecPosition;
|
||||
|
||||
PWINDOW->setHidden(false);
|
||||
} catch (...) { Debug::log(LOG, "Rule move failed, rule: {} -> {}", r->szRule, r->szValue); }
|
||||
|
@ -481,7 +485,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
if (ARGS[1] == "1")
|
||||
RESERVEDOFFSET = (PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight) / 2.f;
|
||||
|
||||
PWINDOW->m_vRealPosition = PMONITOR->middle() - PWINDOW->m_vRealSize.goal() / 2.f + RESERVEDOFFSET;
|
||||
*PWINDOW->m_vRealPosition = PMONITOR->middle() - PWINDOW->m_vRealSize->goal() / 2.f + RESERVEDOFFSET;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -491,7 +495,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
|
||||
// set the pseudo size to the GOAL of our current size
|
||||
// because the windows are animated on RealSize
|
||||
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal();
|
||||
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize->goal();
|
||||
|
||||
g_pCompositor->changeWindowZOrder(PWINDOW, true);
|
||||
} else {
|
||||
|
@ -524,7 +528,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
}
|
||||
|
||||
if (!setPseudo)
|
||||
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal() - Vector2D(10, 10);
|
||||
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize->goal() - Vector2D(10, 10);
|
||||
}
|
||||
|
||||
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow.lock();
|
||||
|
@ -554,11 +558,11 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
(!PWINDOW->isX11OverrideRedirect() || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->wantsFocus())) && !workspaceSilent && (!PFORCEFOCUS || PFORCEFOCUS == PWINDOW) &&
|
||||
!g_pInputManager->isConstrained()) {
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PACTIVEALPHA);
|
||||
PWINDOW->m_fDimPercent.setValueAndWarp(PWINDOW->m_sWindowData.noDim.valueOrDefault() ? 0.f : *PDIMSTRENGTH);
|
||||
PWINDOW->m_fActiveInactiveAlpha->setValueAndWarp(*PACTIVEALPHA);
|
||||
PWINDOW->m_fDimPercent->setValueAndWarp(PWINDOW->m_sWindowData.noDim.valueOrDefault() ? 0.f : *PDIMSTRENGTH);
|
||||
} else {
|
||||
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PINACTIVEALPHA);
|
||||
PWINDOW->m_fDimPercent.setValueAndWarp(0);
|
||||
PWINDOW->m_fActiveInactiveAlpha->setValueAndWarp(*PINACTIVEALPHA);
|
||||
PWINDOW->m_fDimPercent->setValueAndWarp(0);
|
||||
}
|
||||
|
||||
if (requestedClientFSMode.has_value() && (PWINDOW->m_eSuppressedEvents & SUPPRESS_FULLSCREEN))
|
||||
|
@ -571,8 +575,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
if (PWINDOW->m_pWorkspace->m_bHasFullscreenWindow)
|
||||
g_pCompositor->setWindowFullscreenInternal(PWINDOW->m_pWorkspace->getFullscreenWindow(), FSMODE_NONE);
|
||||
|
||||
PWINDOW->m_vRealPosition.warp();
|
||||
PWINDOW->m_vRealSize.warp();
|
||||
PWINDOW->m_vRealPosition->warp();
|
||||
PWINDOW->m_vRealSize->warp();
|
||||
if (requestedFSState.has_value()) {
|
||||
PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_WINDOW_RULE);
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, requestedFSState.value());
|
||||
|
@ -607,7 +611,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
|
||||
PWINDOW->m_bFirstMap = false;
|
||||
|
||||
Debug::log(LOG, "Map request dispatched, monitor {}, window pos: {:5j}, window size: {:5j}", PMONITOR->szName, PWINDOW->m_vRealPosition.goal(), PWINDOW->m_vRealSize.goal());
|
||||
Debug::log(LOG, "Map request dispatched, monitor {}, window pos: {:5j}, window size: {:5j}", PMONITOR->szName, PWINDOW->m_vRealPosition->goal(), PWINDOW->m_vRealSize->goal());
|
||||
|
||||
auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName;
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", std::format("{:x},{},{},{}", PWINDOW, workspaceID, PWINDOW->m_szClass, PWINDOW->m_szTitle)});
|
||||
|
@ -620,17 +624,17 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
|
||||
// do animations
|
||||
g_pAnimationManager->onWindowPostCreateClose(PWINDOW, false);
|
||||
PWINDOW->m_fAlpha.setValueAndWarp(0.f);
|
||||
PWINDOW->m_fAlpha = 1.f;
|
||||
PWINDOW->m_fAlpha->setValueAndWarp(0.f);
|
||||
*PWINDOW->m_fAlpha = 1.f;
|
||||
|
||||
PWINDOW->m_vRealPosition.setCallbackOnEnd(setAnimToMove);
|
||||
PWINDOW->m_vRealSize.setCallbackOnEnd(setAnimToMove);
|
||||
PWINDOW->m_vRealPosition->setCallbackOnEnd(setVector2DAnimToMove);
|
||||
PWINDOW->m_vRealSize->setCallbackOnEnd(setVector2DAnimToMove);
|
||||
|
||||
// recalc the values for this window
|
||||
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
|
||||
// avoid this window being visible
|
||||
if (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->isFullscreen() && !PWINDOW->m_bIsFloating)
|
||||
PWINDOW->m_fAlpha.setValueAndWarp(0.f);
|
||||
PWINDOW->m_fAlpha->setValueAndWarp(0.f);
|
||||
|
||||
g_pCompositor->setPreferredScaleForSurface(PWINDOW->m_pWLSurface->resource(), PMONITOR->scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(PWINDOW->m_pWLSurface->resource(), PMONITOR->transform);
|
||||
|
@ -666,8 +670,8 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
|||
|
||||
const auto PMONITOR = PWINDOW->m_pMonitor.lock();
|
||||
if (PMONITOR) {
|
||||
PWINDOW->m_vOriginalClosedPos = PWINDOW->m_vRealPosition.value() - PMONITOR->vecPosition;
|
||||
PWINDOW->m_vOriginalClosedSize = PWINDOW->m_vRealSize.value();
|
||||
PWINDOW->m_vOriginalClosedPos = PWINDOW->m_vRealPosition->value() - PMONITOR->vecPosition;
|
||||
PWINDOW->m_vOriginalClosedSize = PWINDOW->m_vRealSize->value();
|
||||
PWINDOW->m_eOriginalClosedExtents = PWINDOW->getFullWindowExtents();
|
||||
}
|
||||
|
||||
|
@ -757,12 +761,12 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
|||
|
||||
g_pCompositor->addToFadingOutSafe(PWINDOW);
|
||||
|
||||
if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in.
|
||||
PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.value() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it
|
||||
if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in.
|
||||
*PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition->value() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it
|
||||
|
||||
// anims
|
||||
g_pAnimationManager->onWindowPostCreateClose(PWINDOW, true);
|
||||
PWINDOW->m_fAlpha = 0.f;
|
||||
*PWINDOW->m_fAlpha = 0.f;
|
||||
|
||||
// recheck idle inhibitors
|
||||
g_pInputManager->recheckIdleInhibitorStatus();
|
||||
|
@ -812,7 +816,7 @@ void Events::listener_commitWindow(void* owner, void* data) {
|
|||
g_pSeatManager->isPointerFrameSkipped = false;
|
||||
g_pSeatManager->isPointerFrameCommit = false;
|
||||
} else
|
||||
g_pHyprRenderer->damageSurface(PWINDOW->m_pWLSurface->resource(), PWINDOW->m_vRealPosition.goal().x, PWINDOW->m_vRealPosition.goal().y,
|
||||
g_pHyprRenderer->damageSurface(PWINDOW->m_pWLSurface->resource(), PWINDOW->m_vRealPosition->goal().x, PWINDOW->m_vRealPosition->goal().y,
|
||||
PWINDOW->m_bIsX11 ? 1.0 / PWINDOW->m_fX11SurfaceScaledBy : 1.0);
|
||||
|
||||
if (g_pSeatManager->isPointerFrameSkipped) {
|
||||
|
@ -903,8 +907,8 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
|
|||
if (!PWINDOW->m_bIsMapped || !PWINDOW->m_pXWaylandSurface || !PWINDOW->m_pXWaylandSurface->overrideRedirect)
|
||||
return;
|
||||
|
||||
const auto POS = PWINDOW->m_vRealPosition.goal();
|
||||
const auto SIZ = PWINDOW->m_vRealSize.goal();
|
||||
const auto POS = PWINDOW->m_vRealPosition->goal();
|
||||
const auto SIZ = PWINDOW->m_vRealSize->goal();
|
||||
|
||||
if (PWINDOW->m_pXWaylandSurface->geometry.size() > Vector2D{1, 1})
|
||||
PWINDOW->setHidden(false);
|
||||
|
@ -912,7 +916,7 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
|
|||
PWINDOW->setHidden(true);
|
||||
|
||||
if (PWINDOW->isFullscreen() || !PWINDOW->m_bIsFloating) {
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal(), true);
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize->goal(), true);
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
return;
|
||||
}
|
||||
|
@ -926,27 +930,27 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
|
|||
Debug::log(LOG, "Unmanaged window {} requests geometry update to {:j} {:j}", PWINDOW, LOGICALPOS, PWINDOW->m_pXWaylandSurface->geometry.size());
|
||||
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(LOGICALPOS.x, LOGICALPOS.y));
|
||||
PWINDOW->m_vRealPosition->setValueAndWarp(Vector2D(LOGICALPOS.x, LOGICALPOS.y));
|
||||
|
||||
if (abs(std::floor(SIZ.x) - PWINDOW->m_pXWaylandSurface->geometry.w) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_pXWaylandSurface->geometry.h) > 2)
|
||||
PWINDOW->m_vRealSize.setValueAndWarp(PWINDOW->m_pXWaylandSurface->geometry.size());
|
||||
PWINDOW->m_vRealSize->setValueAndWarp(PWINDOW->m_pXWaylandSurface->geometry.size());
|
||||
|
||||
if (*PXWLFORCESCALEZERO) {
|
||||
if (const auto PMONITOR = PWINDOW->m_pMonitor.lock(); PMONITOR) {
|
||||
PWINDOW->m_vRealSize.setValueAndWarp(PWINDOW->m_vRealSize.goal() / PMONITOR->scale);
|
||||
PWINDOW->m_vRealSize->setValueAndWarp(PWINDOW->m_vRealSize->goal() / PMONITOR->scale);
|
||||
}
|
||||
}
|
||||
|
||||
PWINDOW->m_vPosition = PWINDOW->m_vRealPosition.goal();
|
||||
PWINDOW->m_vSize = PWINDOW->m_vRealSize.goal();
|
||||
PWINDOW->m_vPosition = PWINDOW->m_vRealPosition->goal();
|
||||
PWINDOW->m_vSize = PWINDOW->m_vRealSize->goal();
|
||||
|
||||
PWINDOW->m_pWorkspace = g_pCompositor->getMonitorFromVector(PWINDOW->m_vRealPosition.value() + PWINDOW->m_vRealSize.value() / 2.f)->activeWorkspace;
|
||||
PWINDOW->m_pWorkspace = g_pCompositor->getMonitorFromVector(PWINDOW->m_vRealPosition->value() + PWINDOW->m_vRealSize->value() / 2.f)->activeWorkspace;
|
||||
|
||||
g_pCompositor->changeWindowZOrder(PWINDOW, true);
|
||||
PWINDOW->updateWindowDecos();
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
|
||||
PWINDOW->m_vReportedPosition = PWINDOW->m_vRealPosition.goal();
|
||||
PWINDOW->m_vPendingReportedSize = PWINDOW->m_vRealSize.goal();
|
||||
PWINDOW->m_vReportedPosition = PWINDOW->m_vRealPosition->goal();
|
||||
PWINDOW->m_vPendingReportedSize = PWINDOW->m_vRealSize->goal();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
#include "AnimatedVariable.hpp"
|
||||
#include "../managers/AnimationManager.hpp"
|
||||
#include "../config/ConfigManager.hpp"
|
||||
|
||||
CBaseAnimatedVariable::CBaseAnimatedVariable(eAnimatedVarType type) : m_Type(type) {
|
||||
; // dummy var
|
||||
}
|
||||
|
||||
void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, eAVarDamagePolicy policy) {
|
||||
m_eDamagePolicy = policy;
|
||||
m_pConfig = pAnimConfig;
|
||||
m_pWindow = pWindow;
|
||||
|
||||
m_bDummy = false;
|
||||
}
|
||||
|
||||
void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, eAVarDamagePolicy policy) {
|
||||
m_eDamagePolicy = policy;
|
||||
m_pConfig = pAnimConfig;
|
||||
m_pLayer = pLayer;
|
||||
|
||||
m_bDummy = false;
|
||||
}
|
||||
|
||||
void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, eAVarDamagePolicy policy) {
|
||||
m_eDamagePolicy = policy;
|
||||
m_pConfig = pAnimConfig;
|
||||
m_pWorkspace = pWorkspace;
|
||||
|
||||
m_bDummy = false;
|
||||
}
|
||||
|
||||
void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, eAVarDamagePolicy policy) {
|
||||
m_eDamagePolicy = policy;
|
||||
m_pConfig = pAnimConfig;
|
||||
|
||||
m_bDummy = false;
|
||||
}
|
||||
|
||||
CBaseAnimatedVariable::~CBaseAnimatedVariable() {
|
||||
unregister();
|
||||
}
|
||||
|
||||
void CBaseAnimatedVariable::unregister() {
|
||||
if (!g_pAnimationManager)
|
||||
return;
|
||||
std::erase_if(g_pAnimationManager->m_vAnimatedVariables, [&](const auto& other) { return other == this; });
|
||||
m_bIsRegistered = false;
|
||||
disconnectFromActive();
|
||||
}
|
||||
|
||||
void CBaseAnimatedVariable::registerVar() {
|
||||
if (!m_bIsRegistered)
|
||||
g_pAnimationManager->m_vAnimatedVariables.push_back(this);
|
||||
m_bIsRegistered = true;
|
||||
}
|
||||
|
||||
float CBaseAnimatedVariable::getPercent() {
|
||||
const auto DURATIONPASSED = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - animationBegin).count();
|
||||
return std::clamp((DURATIONPASSED / 100.f) / m_pConfig->pValues->internalSpeed, 0.f, 1.f);
|
||||
}
|
||||
|
||||
float CBaseAnimatedVariable::getCurveValue() {
|
||||
if (!m_bIsBeingAnimated)
|
||||
return 1.f;
|
||||
|
||||
const auto SPENT = getPercent();
|
||||
|
||||
if (SPENT >= 1.f)
|
||||
return 1.f;
|
||||
|
||||
return g_pAnimationManager->getBezier(m_pConfig->pValues->internalBezier)->getYForPoint(SPENT);
|
||||
}
|
||||
|
||||
void CBaseAnimatedVariable::connectToActive() {
|
||||
g_pAnimationManager->scheduleTick(); // otherwise the animation manager will never pick this up
|
||||
|
||||
if (!m_bIsConnectedToActive)
|
||||
g_pAnimationManager->m_vActiveAnimatedVariables.push_back(this);
|
||||
|
||||
m_bIsConnectedToActive = true;
|
||||
}
|
||||
|
||||
void CBaseAnimatedVariable::disconnectFromActive() {
|
||||
std::erase_if(g_pAnimationManager->m_vActiveAnimatedVariables, [&](const auto& other) { return other == this; });
|
||||
m_bIsConnectedToActive = false;
|
||||
}
|
|
@ -1,15 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <any>
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
#include "math/Math.hpp"
|
||||
#include <hyprutils/animation/AnimatedVariable.hpp>
|
||||
|
||||
#include "Color.hpp"
|
||||
#include "../defines.hpp"
|
||||
#include "../debug/Log.hpp"
|
||||
#include "../desktop/DesktopTypes.hpp"
|
||||
|
||||
enum eAVarDamagePolicy : int8_t {
|
||||
AVARDAMAGE_NONE = -1,
|
||||
AVARDAMAGE_ENTIRE = 0,
|
||||
AVARDAMAGE_BORDER,
|
||||
AVARDAMAGE_SHADOW
|
||||
};
|
||||
|
||||
enum eAnimatedVarType : int8_t {
|
||||
AVARTYPE_INVALID = -1,
|
||||
AVARTYPE_FLOAT,
|
||||
|
@ -42,20 +45,6 @@ struct STypeToAnimatedVarType_t<CHyprColor> {
|
|||
template <class T>
|
||||
inline constexpr eAnimatedVarType typeToeAnimatedVarType = STypeToAnimatedVarType_t<T>::value;
|
||||
|
||||
enum eAVarDamagePolicy : int8_t {
|
||||
AVARDAMAGE_NONE = -1,
|
||||
AVARDAMAGE_ENTIRE = 0,
|
||||
AVARDAMAGE_BORDER,
|
||||
AVARDAMAGE_SHADOW
|
||||
};
|
||||
|
||||
class CAnimationManager;
|
||||
struct SAnimationPropertyConfig;
|
||||
class CHyprRenderer;
|
||||
class CWindow;
|
||||
class CWorkspace;
|
||||
class CLayerSurface;
|
||||
|
||||
// Utility to define a concept as a list of possible type
|
||||
template <class T, class... U>
|
||||
concept OneOf = (... or std::same_as<T, U>);
|
||||
|
@ -66,245 +55,19 @@ concept OneOf = (... or std::same_as<T, U>);
|
|||
template <class T>
|
||||
concept Animable = OneOf<T, Vector2D, float, CHyprColor>;
|
||||
|
||||
class CBaseAnimatedVariable {
|
||||
public:
|
||||
CBaseAnimatedVariable(eAnimatedVarType type);
|
||||
void create(SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, eAVarDamagePolicy policy);
|
||||
void create(SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, eAVarDamagePolicy policy);
|
||||
void create(SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, eAVarDamagePolicy policy);
|
||||
void create(SAnimationPropertyConfig* pAnimConfig, eAVarDamagePolicy policy);
|
||||
struct SAnimationContext {
|
||||
PHLWINDOWREF pWindow;
|
||||
PHLWORKSPACEREF pWorkspace;
|
||||
PHLLSREF pLayer;
|
||||
|
||||
CBaseAnimatedVariable(const CBaseAnimatedVariable&) = delete;
|
||||
CBaseAnimatedVariable(CBaseAnimatedVariable&&) = delete;
|
||||
CBaseAnimatedVariable& operator=(const CBaseAnimatedVariable&) = delete;
|
||||
CBaseAnimatedVariable& operator=(CBaseAnimatedVariable&&) = delete;
|
||||
|
||||
virtual ~CBaseAnimatedVariable();
|
||||
|
||||
void unregister();
|
||||
void registerVar();
|
||||
|
||||
virtual void warp(bool endCallback = true) = 0;
|
||||
|
||||
//
|
||||
void setConfig(SAnimationPropertyConfig* pConfig) {
|
||||
m_pConfig = pConfig;
|
||||
}
|
||||
|
||||
SAnimationPropertyConfig* getConfig() {
|
||||
return m_pConfig;
|
||||
}
|
||||
|
||||
/* returns the spent (completion) % */
|
||||
float getPercent();
|
||||
|
||||
/* returns the current curve value */
|
||||
float getCurveValue();
|
||||
|
||||
// checks if an animation is in progress
|
||||
bool isBeingAnimated() const {
|
||||
return m_bIsBeingAnimated;
|
||||
}
|
||||
|
||||
/* sets a function to be ran when the animation finishes.
|
||||
if an animation is not running, runs instantly.
|
||||
if "remove" is set to true, will remove the callback when ran. */
|
||||
void setCallbackOnEnd(std::function<void(void* thisptr)> func, bool remove = true) {
|
||||
m_fEndCallback = std::move(func);
|
||||
m_bRemoveEndAfterRan = remove;
|
||||
|
||||
if (!isBeingAnimated())
|
||||
onAnimationEnd();
|
||||
}
|
||||
|
||||
/* sets a function to be ran when an animation is started.
|
||||
if "remove" is set to true, will remove the callback when ran. */
|
||||
void setCallbackOnBegin(std::function<void(void* thisptr)> func, bool remove = true) {
|
||||
m_fBeginCallback = std::move(func);
|
||||
m_bRemoveBeginAfterRan = remove;
|
||||
}
|
||||
|
||||
/* Sets the update callback, called every time the value is animated and a step is done
|
||||
Warning: calling unregisterVar/registerVar in this handler will cause UB */
|
||||
void setUpdateCallback(std::function<void(void* thisptr)> func) {
|
||||
m_fUpdateCallback = std::move(func);
|
||||
}
|
||||
|
||||
/* resets all callbacks. Does not call any. */
|
||||
void resetAllCallbacks() {
|
||||
m_fBeginCallback = nullptr;
|
||||
m_fEndCallback = nullptr;
|
||||
m_fUpdateCallback = nullptr;
|
||||
m_bRemoveBeginAfterRan = false;
|
||||
m_bRemoveEndAfterRan = false;
|
||||
}
|
||||
|
||||
PHLWINDOW getWindow() {
|
||||
return m_pWindow.lock();
|
||||
}
|
||||
|
||||
protected:
|
||||
PHLWINDOWREF m_pWindow;
|
||||
PHLWORKSPACEREF m_pWorkspace;
|
||||
PHLLSREF m_pLayer;
|
||||
|
||||
SAnimationPropertyConfig* m_pConfig = nullptr;
|
||||
|
||||
bool m_bDummy = true;
|
||||
bool m_bIsRegistered = false;
|
||||
bool m_bIsBeingAnimated = false;
|
||||
|
||||
std::chrono::steady_clock::time_point animationBegin;
|
||||
|
||||
eAVarDamagePolicy m_eDamagePolicy = AVARDAMAGE_NONE;
|
||||
eAnimatedVarType m_Type;
|
||||
|
||||
bool m_bRemoveEndAfterRan = true;
|
||||
bool m_bRemoveBeginAfterRan = true;
|
||||
std::function<void(void* thisptr)> m_fEndCallback;
|
||||
std::function<void(void* thisptr)> m_fBeginCallback;
|
||||
std::function<void(void* thisptr)> m_fUpdateCallback;
|
||||
|
||||
bool m_bIsConnectedToActive = false;
|
||||
|
||||
void connectToActive();
|
||||
|
||||
void disconnectFromActive();
|
||||
|
||||
// methods
|
||||
void onAnimationEnd() {
|
||||
m_bIsBeingAnimated = false;
|
||||
disconnectFromActive();
|
||||
|
||||
if (m_fEndCallback) {
|
||||
// loading m_bRemoveEndAfterRan before calling the callback allows the callback to delete this animation safely if it is false.
|
||||
auto removeEndCallback = m_bRemoveEndAfterRan;
|
||||
m_fEndCallback(this);
|
||||
if (removeEndCallback)
|
||||
m_fEndCallback = nullptr; // reset
|
||||
}
|
||||
}
|
||||
|
||||
void onAnimationBegin() {
|
||||
m_bIsBeingAnimated = true;
|
||||
connectToActive();
|
||||
|
||||
if (m_fBeginCallback) {
|
||||
m_fBeginCallback(this);
|
||||
if (m_bRemoveBeginAfterRan)
|
||||
m_fBeginCallback = nullptr; // reset
|
||||
}
|
||||
}
|
||||
|
||||
friend class CAnimationManager;
|
||||
friend class CWorkspace;
|
||||
friend class CLayerSurface;
|
||||
friend class CHyprRenderer;
|
||||
eAVarDamagePolicy eDamagePolicy = AVARDAMAGE_NONE;
|
||||
};
|
||||
|
||||
template <Animable VarType>
|
||||
class CAnimatedVariable : public CBaseAnimatedVariable {
|
||||
public:
|
||||
CAnimatedVariable() : CBaseAnimatedVariable(typeToeAnimatedVarType<VarType>) {
|
||||
;
|
||||
} // dummy var
|
||||
using CAnimatedVariable = Hyprutils::Animation::CGenericAnimatedVariable<VarType, SAnimationContext>;
|
||||
|
||||
void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, eAVarDamagePolicy policy) {
|
||||
create(pAnimConfig, pWindow, policy);
|
||||
m_Value = value;
|
||||
m_Goal = value;
|
||||
}
|
||||
void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, eAVarDamagePolicy policy) {
|
||||
create(pAnimConfig, pLayer, policy);
|
||||
m_Value = value;
|
||||
m_Goal = value;
|
||||
}
|
||||
void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, eAVarDamagePolicy policy) {
|
||||
create(pAnimConfig, pWorkspace, policy);
|
||||
m_Value = value;
|
||||
m_Goal = value;
|
||||
}
|
||||
void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, eAVarDamagePolicy policy) {
|
||||
create(pAnimConfig, policy);
|
||||
m_Value = value;
|
||||
m_Goal = value;
|
||||
}
|
||||
template <Animable VarType>
|
||||
using PHLANIMVAR = SP<CAnimatedVariable<VarType>>;
|
||||
|
||||
using CBaseAnimatedVariable::create;
|
||||
|
||||
CAnimatedVariable(const CAnimatedVariable&) = delete;
|
||||
CAnimatedVariable(CAnimatedVariable&&) = delete;
|
||||
CAnimatedVariable& operator=(const CAnimatedVariable&) = delete;
|
||||
CAnimatedVariable& operator=(CAnimatedVariable&&) = delete;
|
||||
|
||||
~CAnimatedVariable() = default;
|
||||
|
||||
// gets the current vector value (real time)
|
||||
const VarType& value() const {
|
||||
return m_Value;
|
||||
}
|
||||
|
||||
// gets the goal vector value
|
||||
const VarType& goal() const {
|
||||
return m_Goal;
|
||||
}
|
||||
|
||||
CAnimatedVariable& operator=(const VarType& v) {
|
||||
if (v == m_Goal)
|
||||
return *this;
|
||||
|
||||
m_Goal = v;
|
||||
animationBegin = std::chrono::steady_clock::now();
|
||||
m_Begun = m_Value;
|
||||
|
||||
onAnimationBegin();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Sets the actual stored value, without affecting the goal, but resets the timer
|
||||
void setValue(const VarType& v) {
|
||||
if (v == m_Value)
|
||||
return;
|
||||
|
||||
m_Value = v;
|
||||
animationBegin = std::chrono::steady_clock::now();
|
||||
m_Begun = m_Value;
|
||||
|
||||
onAnimationBegin();
|
||||
}
|
||||
|
||||
// Sets the actual value and goal
|
||||
void setValueAndWarp(const VarType& v) {
|
||||
m_Goal = v;
|
||||
m_bIsBeingAnimated = true;
|
||||
warp();
|
||||
}
|
||||
|
||||
void warp(bool endCallback = true) override {
|
||||
if (!m_bIsBeingAnimated)
|
||||
return;
|
||||
|
||||
m_Value = m_Goal;
|
||||
|
||||
m_bIsBeingAnimated = false;
|
||||
|
||||
if (m_fUpdateCallback)
|
||||
m_fUpdateCallback(this);
|
||||
|
||||
if (endCallback)
|
||||
onAnimationEnd();
|
||||
}
|
||||
|
||||
private:
|
||||
VarType m_Value{};
|
||||
VarType m_Goal{};
|
||||
VarType m_Begun{};
|
||||
|
||||
// owners
|
||||
|
||||
friend class CAnimationManager;
|
||||
friend class CWorkspace;
|
||||
friend class CLayerSurface;
|
||||
friend class CHyprRenderer;
|
||||
};
|
||||
template <Animable VarType>
|
||||
using PHLANIMVARREF = WP<CAnimatedVariable<VarType>>;
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
#include "BezierCurve.hpp"
|
||||
#include "../debug/Log.hpp"
|
||||
#include "../macros.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <algorithm>
|
||||
|
||||
void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
|
||||
const auto BEGIN = std::chrono::high_resolution_clock::now();
|
||||
|
||||
// Avoid reallocations by reserving enough memory upfront
|
||||
m_vPoints.resize(pVec->size() + 2);
|
||||
m_vPoints[0] = Vector2D(0, 0); // Start point
|
||||
size_t index = 1; // Start after the first element
|
||||
for (const auto& vec : *pVec) {
|
||||
if (index < m_vPoints.size() - 1) { // Bounds check to ensure safety
|
||||
m_vPoints[index] = vec;
|
||||
++index;
|
||||
}
|
||||
}
|
||||
m_vPoints.back() = Vector2D(1, 1); // End point
|
||||
|
||||
RASSERT(m_vPoints.size() == 4, "CBezierCurve only supports cubic beziers! (points num: {})", m_vPoints.size());
|
||||
|
||||
// bake BAKEDPOINTS points for faster lookups
|
||||
// T -> X ( / BAKEDPOINTS )
|
||||
for (int i = 0; i < BAKEDPOINTS; ++i) {
|
||||
float const t = (i + 1) / (float)BAKEDPOINTS;
|
||||
m_aPointsBaked[i] = Vector2D(getXForT(t), getYForT(t));
|
||||
}
|
||||
|
||||
const auto ELAPSEDUS = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGIN).count() / 1000.f;
|
||||
const auto POINTSSIZE = m_aPointsBaked.size() * sizeof(m_aPointsBaked[0]) / 1000.f;
|
||||
|
||||
const auto BEGINCALC = std::chrono::high_resolution_clock::now();
|
||||
for (int j = 1; j < 10; ++j) {
|
||||
float i = j / 10.0f;
|
||||
getYForPoint(i);
|
||||
}
|
||||
const auto ELAPSEDCALCAVG = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGINCALC).count() / 1000.f / 10.f;
|
||||
|
||||
Debug::log(LOG, "Created a bezier curve, baked {} points, mem usage: {:.2f}kB, time to bake: {:.2f}µs. Estimated average calc time: {:.2f}µs.", BAKEDPOINTS, POINTSSIZE,
|
||||
ELAPSEDUS, ELAPSEDCALCAVG);
|
||||
}
|
||||
|
||||
float CBezierCurve::getXForT(float const& t) const {
|
||||
float t2 = t * t;
|
||||
float t3 = t2 * t;
|
||||
|
||||
return 3 * t * (1 - t) * (1 - t) * m_vPoints[1].x + 3 * t2 * (1 - t) * m_vPoints[2].x + t3 * m_vPoints[3].x;
|
||||
}
|
||||
|
||||
float CBezierCurve::getYForT(float const& t) const {
|
||||
float t2 = t * t;
|
||||
float t3 = t2 * t;
|
||||
|
||||
return 3 * t * (1 - t) * (1 - t) * m_vPoints[1].y + 3 * t2 * (1 - t) * m_vPoints[2].y + t3 * m_vPoints[3].y;
|
||||
}
|
||||
|
||||
// Todo: this probably can be done better and faster
|
||||
float CBezierCurve::getYForPoint(float const& x) const {
|
||||
if (x >= 1.f)
|
||||
return 1.f;
|
||||
if (x <= 0.f)
|
||||
return 0.f;
|
||||
|
||||
int index = 0;
|
||||
bool below = true;
|
||||
for (int step = (BAKEDPOINTS + 1) / 2; step > 0; step /= 2) {
|
||||
if (below)
|
||||
index += step;
|
||||
else
|
||||
index -= step;
|
||||
|
||||
below = m_aPointsBaked[index].x < x;
|
||||
}
|
||||
|
||||
int lowerIndex = index - (!below || index == BAKEDPOINTS - 1);
|
||||
|
||||
// in the name of performance i shall make a hack
|
||||
const auto LOWERPOINT = &m_aPointsBaked[lowerIndex];
|
||||
const auto UPPERPOINT = &m_aPointsBaked[lowerIndex + 1];
|
||||
|
||||
const auto PERCINDELTA = (x - LOWERPOINT->x) / (UPPERPOINT->x - LOWERPOINT->x);
|
||||
|
||||
if (std::isnan(PERCINDELTA) || std::isinf(PERCINDELTA)) // can sometimes happen for VERY small x
|
||||
return 0.f;
|
||||
|
||||
return LOWERPOINT->y + (UPPERPOINT->y - LOWERPOINT->y) * PERCINDELTA;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include "math/Math.hpp"
|
||||
|
||||
constexpr int BAKEDPOINTS = 255;
|
||||
constexpr float INVBAKEDPOINTS = 1.f / BAKEDPOINTS;
|
||||
|
||||
// an implementation of a cubic bezier curve
|
||||
// might do better later
|
||||
class CBezierCurve {
|
||||
public:
|
||||
// sets up the bezier curve.
|
||||
// this EXCLUDES the 0,0 and 1,1 points,
|
||||
void setup(std::vector<Vector2D>* points);
|
||||
|
||||
float getYForT(float const& t) const;
|
||||
float getXForT(float const& t) const;
|
||||
float getYForPoint(float const& x) const;
|
||||
|
||||
private:
|
||||
// this INCLUDES the 0,0 and 1,1 points.
|
||||
std::vector<Vector2D> m_vPoints;
|
||||
|
||||
std::array<Vector2D, BAKEDPOINTS> m_aPointsBaked;
|
||||
};
|
|
@ -1127,16 +1127,16 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
|
|||
if (w->m_bIsFloating && !VECINRECT(MIDDLE, vecPosition.x, vecPosition.y, vecPosition.x + vecSize.x, vecPosition.y + vecSize.y) && !w->isX11OverrideRedirect()) {
|
||||
// if it's floating and the middle isnt on the current mon, move it to the center
|
||||
const auto PMONFROMMIDDLE = g_pCompositor->getMonitorFromVector(MIDDLE);
|
||||
Vector2D pos = w->m_vRealPosition.goal();
|
||||
Vector2D pos = w->m_vRealPosition->goal();
|
||||
if (!VECINRECT(MIDDLE, PMONFROMMIDDLE->vecPosition.x, PMONFROMMIDDLE->vecPosition.y, PMONFROMMIDDLE->vecPosition.x + PMONFROMMIDDLE->vecSize.x,
|
||||
PMONFROMMIDDLE->vecPosition.y + PMONFROMMIDDLE->vecSize.y)) {
|
||||
// not on any monitor, center
|
||||
pos = middle() / 2.f - w->m_vRealSize.goal() / 2.f;
|
||||
pos = middle() / 2.f - w->m_vRealSize->goal() / 2.f;
|
||||
} else
|
||||
pos = pos - PMONFROMMIDDLE->vecPosition + vecPosition;
|
||||
|
||||
w->m_vRealPosition = pos;
|
||||
w->m_vPosition = pos;
|
||||
*w->m_vRealPosition = pos;
|
||||
w->m_vPosition = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/Subsurface.hpp"
|
||||
#include "../desktop/Popup.hpp"
|
||||
#include "AnimatedVariable.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "signal/Signal.hpp"
|
||||
#include "math/Math.hpp"
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
#include "../Compositor.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../render/pass/TexPassElement.hpp"
|
||||
#include "../managers/AnimationManager.hpp"
|
||||
|
||||
#include <hyprutils/utils/ScopeGuard.hpp>
|
||||
using namespace Hyprutils::Utils;
|
||||
using namespace Hyprutils::Animation;
|
||||
|
||||
CHyprError::CHyprError() {
|
||||
m_fFadeOpacity.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), AVARDAMAGE_NONE);
|
||||
m_fFadeOpacity.registerVar();
|
||||
g_pAnimationManager->createAnimation(0.f, m_fFadeOpacity, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), AVARDAMAGE_NONE);
|
||||
|
||||
static auto P = g_pHookSystem->hookDynamic("focusedMon", [&](void* self, SCallbackInfo& info, std::any param) {
|
||||
if (!m_bIsCreated)
|
||||
|
@ -23,16 +23,14 @@ CHyprError::CHyprError() {
|
|||
if (!m_bIsCreated)
|
||||
return;
|
||||
|
||||
if (m_fFadeOpacity.isBeingAnimated() || m_bMonitorChanged)
|
||||
if (m_fFadeOpacity->isBeingAnimated() || m_bMonitorChanged)
|
||||
g_pHyprRenderer->damageBox(&m_bDamageBox);
|
||||
});
|
||||
|
||||
m_pTexture = makeShared<CTexture>();
|
||||
}
|
||||
|
||||
CHyprError::~CHyprError() {
|
||||
m_fFadeOpacity.unregister();
|
||||
}
|
||||
CHyprError::~CHyprError() = default;
|
||||
|
||||
void CHyprError::queueCreate(std::string message, const CHyprColor& color) {
|
||||
m_szQueued = message;
|
||||
|
@ -43,10 +41,10 @@ void CHyprError::createQueued() {
|
|||
if (m_bIsCreated)
|
||||
m_pTexture->destroyTexture();
|
||||
|
||||
m_fFadeOpacity.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
|
||||
m_fFadeOpacity->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
|
||||
|
||||
m_fFadeOpacity.setValueAndWarp(0.f);
|
||||
m_fFadeOpacity = 1.f;
|
||||
m_fFadeOpacity->setValueAndWarp(0.f);
|
||||
*m_fFadeOpacity = 1.f;
|
||||
|
||||
const auto PMONITOR = g_pCompositor->m_vMonitors.front();
|
||||
|
||||
|
@ -176,8 +174,8 @@ void CHyprError::draw() {
|
|||
}
|
||||
|
||||
if (m_bQueuedDestroy) {
|
||||
if (!m_fFadeOpacity.isBeingAnimated()) {
|
||||
if (m_fFadeOpacity.value() == 0.f) {
|
||||
if (!m_fFadeOpacity->isBeingAnimated()) {
|
||||
if (m_fFadeOpacity->value() == 0.f) {
|
||||
m_bQueuedDestroy = false;
|
||||
m_pTexture->destroyTexture();
|
||||
m_bIsCreated = false;
|
||||
|
@ -189,8 +187,8 @@ void CHyprError::draw() {
|
|||
|
||||
return;
|
||||
} else {
|
||||
m_fFadeOpacity.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
|
||||
m_fFadeOpacity = 0.f;
|
||||
m_fFadeOpacity->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
|
||||
*m_fFadeOpacity = 0.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +200,7 @@ void CHyprError::draw() {
|
|||
m_bDamageBox.x = (int)PMONITOR->vecPosition.x;
|
||||
m_bDamageBox.y = (int)PMONITOR->vecPosition.y;
|
||||
|
||||
if (m_fFadeOpacity.isBeingAnimated() || m_bMonitorChanged)
|
||||
if (m_fFadeOpacity->isBeingAnimated() || m_bMonitorChanged)
|
||||
g_pHyprRenderer->damageBox(&m_bDamageBox);
|
||||
|
||||
m_bMonitorChanged = false;
|
||||
|
@ -210,7 +208,7 @@ void CHyprError::draw() {
|
|||
CTexPassElement::SRenderData data;
|
||||
data.tex = m_pTexture;
|
||||
data.box = monbox;
|
||||
data.a = m_fFadeOpacity.value();
|
||||
data.a = m_fFadeOpacity->value();
|
||||
|
||||
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
|
||||
}
|
||||
|
|
|
@ -19,17 +19,17 @@ class CHyprError {
|
|||
float height(); // logical
|
||||
|
||||
private:
|
||||
void createQueued();
|
||||
std::string m_szQueued = "";
|
||||
CHyprColor m_cQueued;
|
||||
bool m_bQueuedDestroy = false;
|
||||
bool m_bIsCreated = false;
|
||||
SP<CTexture> m_pTexture;
|
||||
CAnimatedVariable<float> m_fFadeOpacity;
|
||||
CBox m_bDamageBox = {0, 0, 0, 0};
|
||||
float m_fLastHeight = 0.F;
|
||||
void createQueued();
|
||||
std::string m_szQueued = "";
|
||||
CHyprColor m_cQueued;
|
||||
bool m_bQueuedDestroy = false;
|
||||
bool m_bIsCreated = false;
|
||||
SP<CTexture> m_pTexture;
|
||||
PHLANIMVAR<float> m_fFadeOpacity;
|
||||
CBox m_bDamageBox = {0, 0, 0, 0};
|
||||
float m_fLastHeight = 0.F;
|
||||
|
||||
bool m_bMonitorChanged = false;
|
||||
bool m_bMonitorChanged = false;
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CHyprError> g_pHyprError; // This is a full-screen error. Treat it with respect, and there can only be one at a time.
|
||||
|
|
|
@ -192,16 +192,16 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
|
|||
CBox wb = {calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f, calcSize * *PSCALEFACTOR};
|
||||
wb.round(); // avoid rounding mess
|
||||
|
||||
PWINDOW->m_vRealPosition = wb.pos();
|
||||
PWINDOW->m_vRealSize = wb.size();
|
||||
*PWINDOW->m_vRealPosition = wb.pos();
|
||||
*PWINDOW->m_vRealSize = wb.size();
|
||||
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
|
||||
} else {
|
||||
CBox wb = {calcPos, calcSize};
|
||||
wb.round(); // avoid rounding mess
|
||||
|
||||
PWINDOW->m_vRealSize = wb.size();
|
||||
PWINDOW->m_vRealPosition = wb.pos();
|
||||
*PWINDOW->m_vRealSize = wb.size();
|
||||
*PWINDOW->m_vRealPosition = wb.pos();
|
||||
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
|
||||
}
|
||||
|
@ -209,8 +209,8 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
|
|||
if (force) {
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
|
||||
PWINDOW->m_vRealPosition.warp();
|
||||
PWINDOW->m_vRealSize.warp();
|
||||
PWINDOW->m_vRealPosition->warp();
|
||||
PWINDOW->m_vRealSize->warp();
|
||||
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
}
|
||||
|
@ -508,8 +508,8 @@ void CHyprDwindleLayout::calculateWorkspace(const PHLWORKSPACE& pWorkspace) {
|
|||
const auto PFULLWINDOW = pWorkspace->getFullscreenWindow();
|
||||
|
||||
if (pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN) {
|
||||
PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition;
|
||||
PFULLWINDOW->m_vRealSize = PMONITOR->vecSize;
|
||||
*PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition;
|
||||
*PFULLWINDOW->m_vRealSize = PMONITOR->vecSize;
|
||||
} else if (pWorkspace->m_efFullscreenMode == FSMODE_MAXIMIZED) {
|
||||
SDwindleNodeData fakeNode;
|
||||
fakeNode.pWindow = PFULLWINDOW;
|
||||
|
@ -554,8 +554,8 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
|
|||
const auto PNODE = getNodeFromWindow(PWINDOW);
|
||||
|
||||
if (!PNODE) {
|
||||
PWINDOW->m_vRealSize =
|
||||
(PWINDOW->m_vRealSize.goal() + pixResize)
|
||||
*PWINDOW->m_vRealSize =
|
||||
(PWINDOW->m_vRealSize->goal() + pixResize)
|
||||
.clamp(PWINDOW->m_sWindowData.minSize.valueOr(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), PWINDOW->m_sWindowData.maxSize.valueOr(Vector2D{INFINITY, INFINITY}));
|
||||
PWINDOW->updateWindowDecos();
|
||||
return;
|
||||
|
@ -575,7 +575,7 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
|
|||
if (!m_PseudoDragFlags.started) {
|
||||
m_PseudoDragFlags.started = true;
|
||||
|
||||
const auto pseudoSize = PWINDOW->m_vRealSize.goal();
|
||||
const auto pseudoSize = PWINDOW->m_vRealSize->goal();
|
||||
const auto mouseOffset = g_pInputManager->getMouseCoordsInternal() - (PNODE->box.pos() + ((PNODE->box.size() / 2) - (pseudoSize / 2)));
|
||||
|
||||
if (mouseOffset.x > 0 && mouseOffset.x < pseudoSize.x && mouseOffset.y > 0 && mouseOffset.y < pseudoSize.y) {
|
||||
|
@ -743,10 +743,10 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFu
|
|||
|
||||
// save position and size if floating
|
||||
if (pWindow->m_bIsFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE) {
|
||||
pWindow->m_vLastFloatingSize = pWindow->m_vRealSize.goal();
|
||||
pWindow->m_vLastFloatingPosition = pWindow->m_vRealPosition.goal();
|
||||
pWindow->m_vPosition = pWindow->m_vRealPosition.goal();
|
||||
pWindow->m_vSize = pWindow->m_vRealSize.goal();
|
||||
pWindow->m_vLastFloatingSize = pWindow->m_vRealSize->goal();
|
||||
pWindow->m_vLastFloatingPosition = pWindow->m_vRealPosition->goal();
|
||||
pWindow->m_vPosition = pWindow->m_vRealPosition->goal();
|
||||
pWindow->m_vSize = pWindow->m_vRealSize->goal();
|
||||
}
|
||||
|
||||
if (EFFECTIVE_MODE == FSMODE_NONE) {
|
||||
|
@ -756,8 +756,8 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFu
|
|||
applyNodeDataToWindow(PNODE);
|
||||
else {
|
||||
// get back its' dimensions from position and size
|
||||
pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition;
|
||||
pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
|
||||
*pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition;
|
||||
*pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
|
||||
|
||||
pWindow->unsetWindowData(PRIORITY_LAYOUT);
|
||||
pWindow->updateWindowData();
|
||||
|
@ -765,8 +765,8 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFu
|
|||
} else {
|
||||
// apply new pos and size being monitors' box
|
||||
if (EFFECTIVE_MODE == FSMODE_FULLSCREEN) {
|
||||
pWindow->m_vRealPosition = PMONITOR->vecPosition;
|
||||
pWindow->m_vRealSize = PMONITOR->vecSize;
|
||||
*pWindow->m_vRealPosition = PMONITOR->vecPosition;
|
||||
*pWindow->m_vRealSize = PMONITOR->vecSize;
|
||||
} else {
|
||||
// This is a massive hack.
|
||||
// We make a fake "only" node and apply
|
||||
|
|
|
@ -106,7 +106,7 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
|||
|
||||
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
|
||||
const auto PWINDOWSURFACE = pWindow->m_pWLSurface->resource();
|
||||
pWindow->m_vRealSize = PWINDOWSURFACE->current.size;
|
||||
*pWindow->m_vRealSize = PWINDOWSURFACE->current.size;
|
||||
|
||||
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_bIsX11 &&
|
||||
pWindow->isX11OverrideRedirect()) { // XDG windows should be fine. TODO: check for weird atoms?
|
||||
|
@ -115,23 +115,23 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
|||
}
|
||||
|
||||
// reject any windows with size <= 5x5
|
||||
if (pWindow->m_vRealSize.goal().x <= 5 || pWindow->m_vRealSize.goal().y <= 5)
|
||||
pWindow->m_vRealSize = PMONITOR->vecSize / 2.f;
|
||||
if (pWindow->m_vRealSize->goal().x <= 5 || pWindow->m_vRealSize->goal().y <= 5)
|
||||
*pWindow->m_vRealSize = PMONITOR->vecSize / 2.f;
|
||||
|
||||
if (pWindow->m_bIsX11 && pWindow->isX11OverrideRedirect()) {
|
||||
|
||||
if (pWindow->m_pXWaylandSurface->geometry.x != 0 && pWindow->m_pXWaylandSurface->geometry.y != 0)
|
||||
pWindow->m_vRealPosition = g_pXWaylandManager->xwaylandToWaylandCoords(pWindow->m_pXWaylandSurface->geometry.pos());
|
||||
*pWindow->m_vRealPosition = g_pXWaylandManager->xwaylandToWaylandCoords(pWindow->m_pXWaylandSurface->geometry.pos());
|
||||
else
|
||||
pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.goal().x) / 2.f,
|
||||
PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.goal().y) / 2.f);
|
||||
*pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize->goal().x) / 2.f,
|
||||
PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize->goal().y) / 2.f);
|
||||
} else {
|
||||
pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.goal().x) / 2.f,
|
||||
PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.goal().y) / 2.f);
|
||||
*pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize->goal().x) / 2.f,
|
||||
PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize->goal().y) / 2.f);
|
||||
}
|
||||
} else {
|
||||
// we respect the size.
|
||||
pWindow->m_vRealSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
|
||||
*pWindow->m_vRealSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
|
||||
|
||||
// check if it's on the correct monitor!
|
||||
Vector2D middlePoint = Vector2D(desiredGeometry.x, desiredGeometry.y) + Vector2D(desiredGeometry.width, desiredGeometry.height) / 2.f;
|
||||
|
@ -150,35 +150,35 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
|||
if ((desiredGeometry.x == 0 && desiredGeometry.y == 0) || !visible || !pWindow->m_bIsX11) {
|
||||
// if the pos isn't set, fall back to the center placement if it's not a child, otherwise middle of parent if available
|
||||
if (!pWindow->m_bIsX11 && pWindow->m_pXDGSurface->toplevel->parent && validMapped(pWindow->m_pXDGSurface->toplevel->parent->window))
|
||||
pWindow->m_vRealPosition = pWindow->m_pXDGSurface->toplevel->parent->window->m_vRealPosition.goal() +
|
||||
pWindow->m_pXDGSurface->toplevel->parent->window->m_vRealSize.goal() / 2.F - desiredGeometry.size() / 2.F;
|
||||
*pWindow->m_vRealPosition = pWindow->m_pXDGSurface->toplevel->parent->window->m_vRealPosition->goal() +
|
||||
pWindow->m_pXDGSurface->toplevel->parent->window->m_vRealSize->goal() / 2.F - desiredGeometry.size() / 2.F;
|
||||
else
|
||||
pWindow->m_vRealPosition = PMONITOR->vecPosition + PMONITOR->vecSize / 2.F - desiredGeometry.size() / 2.F;
|
||||
*pWindow->m_vRealPosition = PMONITOR->vecPosition + PMONITOR->vecSize / 2.F - desiredGeometry.size() / 2.F;
|
||||
} else {
|
||||
// if it is, we respect where it wants to put itself, but apply monitor offset if outside
|
||||
// most of these are popups
|
||||
|
||||
if (const auto POPENMON = g_pCompositor->getMonitorFromVector(middlePoint); POPENMON->ID != PMONITOR->ID)
|
||||
pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y) - POPENMON->vecPosition + PMONITOR->vecPosition;
|
||||
*pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y) - POPENMON->vecPosition + PMONITOR->vecPosition;
|
||||
else
|
||||
pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y);
|
||||
*pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y);
|
||||
}
|
||||
}
|
||||
|
||||
if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11)
|
||||
pWindow->m_vRealSize = pWindow->m_vRealSize.goal() / PMONITOR->scale;
|
||||
*pWindow->m_vRealSize = pWindow->m_vRealSize->goal() / PMONITOR->scale;
|
||||
|
||||
if (pWindow->m_bX11DoesntWantBorders || (pWindow->m_bIsX11 && pWindow->isX11OverrideRedirect())) {
|
||||
pWindow->m_vRealPosition.warp();
|
||||
pWindow->m_vRealSize.warp();
|
||||
pWindow->m_vRealPosition->warp();
|
||||
pWindow->m_vRealSize->warp();
|
||||
}
|
||||
|
||||
if (!pWindow->isX11OverrideRedirect()) {
|
||||
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goal());
|
||||
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize->goal());
|
||||
|
||||
g_pCompositor->changeWindowZOrder(pWindow, true);
|
||||
} else {
|
||||
pWindow->m_vPendingReportedSize = pWindow->m_vRealSize.goal();
|
||||
pWindow->m_vPendingReportedSize = pWindow->m_vRealSize->goal();
|
||||
pWindow->m_vReportedSize = pWindow->m_vPendingReportedSize;
|
||||
}
|
||||
}
|
||||
|
@ -250,18 +250,18 @@ void IHyprLayout::onBeginDragWindow() {
|
|||
|
||||
if (!DRAGGINGWINDOW->m_bIsFloating) {
|
||||
if (g_pInputManager->dragMode == MBIND_MOVE) {
|
||||
DRAGGINGWINDOW->m_vLastFloatingSize = (DRAGGINGWINDOW->m_vRealSize.goal() * 0.8489).clamp(Vector2D{5, 5}, Vector2D{}).floor();
|
||||
DRAGGINGWINDOW->m_vLastFloatingSize = (DRAGGINGWINDOW->m_vRealSize->goal() * 0.8489).clamp(Vector2D{5, 5}, Vector2D{}).floor();
|
||||
changeWindowFloatingMode(DRAGGINGWINDOW);
|
||||
DRAGGINGWINDOW->m_bIsFloating = true;
|
||||
DRAGGINGWINDOW->m_bDraggingTiled = true;
|
||||
|
||||
DRAGGINGWINDOW->m_vRealPosition = g_pInputManager->getMouseCoordsInternal() - DRAGGINGWINDOW->m_vRealSize.goal() / 2.f;
|
||||
*DRAGGINGWINDOW->m_vRealPosition = g_pInputManager->getMouseCoordsInternal() - DRAGGINGWINDOW->m_vRealSize->goal() / 2.f;
|
||||
}
|
||||
}
|
||||
|
||||
m_vBeginDragXY = g_pInputManager->getMouseCoordsInternal();
|
||||
m_vBeginDragPositionXY = DRAGGINGWINDOW->m_vRealPosition.goal();
|
||||
m_vBeginDragSizeXY = DRAGGINGWINDOW->m_vRealSize.goal();
|
||||
m_vBeginDragPositionXY = DRAGGINGWINDOW->m_vRealPosition->goal();
|
||||
m_vBeginDragSizeXY = DRAGGINGWINDOW->m_vRealSize->goal();
|
||||
m_vLastDragXY = m_vBeginDragXY;
|
||||
|
||||
// get the grab corner
|
||||
|
@ -348,10 +348,10 @@ void IHyprLayout::onEndDragWindow() {
|
|||
if (DRAGGINGWINDOW->m_sGroupData.pNextWindow) {
|
||||
PHLWINDOW next = DRAGGINGWINDOW->m_sGroupData.pNextWindow.lock();
|
||||
while (next != DRAGGINGWINDOW) {
|
||||
next->m_bIsFloating = pWindow->m_bIsFloating; // match the floating state of group members
|
||||
next->m_vRealSize = pWindow->m_vRealSize.goal(); // match the size of group members
|
||||
next->m_vRealPosition = pWindow->m_vRealPosition.goal(); // match the position of group members
|
||||
next = next->m_sGroupData.pNextWindow.lock();
|
||||
next->m_bIsFloating = pWindow->m_bIsFloating; // match the floating state of group members
|
||||
*next->m_vRealSize = pWindow->m_vRealSize->goal(); // match the size of group members
|
||||
*next->m_vRealPosition = pWindow->m_vRealPosition->goal(); // match the position of group members
|
||||
next = next->m_sGroupData.pNextWindow.lock();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ void IHyprLayout::onEndDragWindow() {
|
|||
DRAGGINGWINDOW->m_bDraggingTiled = false;
|
||||
|
||||
if (pWindow->m_bIsFloating)
|
||||
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, pWindow->m_vRealSize.goal()); // match the size of the window
|
||||
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, pWindow->m_vRealSize->goal()); // match the size of the window
|
||||
|
||||
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
||||
(*USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW);
|
||||
|
@ -593,7 +593,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
|||
if (g_pInputManager->dragMode == MBIND_MOVE) {
|
||||
|
||||
Vector2D newPos = m_vBeginDragPositionXY + DELTA;
|
||||
Vector2D newSize = DRAGGINGWINDOW->m_vRealSize.goal();
|
||||
Vector2D newSize = DRAGGINGWINDOW->m_vRealSize->goal();
|
||||
|
||||
if (*SNAPENABLED && !DRAGGINGWINDOW->m_bDraggingTiled)
|
||||
performSnap(newPos, newSize, DRAGGINGWINDOW, MBIND_MOVE, -1, m_vBeginDragSizeXY);
|
||||
|
@ -602,11 +602,11 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
|||
wb.round();
|
||||
|
||||
if (*PANIMATEMOUSE)
|
||||
DRAGGINGWINDOW->m_vRealPosition = wb.pos();
|
||||
*DRAGGINGWINDOW->m_vRealPosition = wb.pos();
|
||||
else
|
||||
DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(wb.pos());
|
||||
DRAGGINGWINDOW->m_vRealPosition->setValueAndWarp(wb.pos());
|
||||
|
||||
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goal());
|
||||
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize->goal());
|
||||
} else if (g_pInputManager->dragMode == MBIND_RESIZE || g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) {
|
||||
if (DRAGGINGWINDOW->m_bIsFloating) {
|
||||
|
||||
|
@ -671,21 +671,21 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
|||
wb.round();
|
||||
|
||||
if (*PANIMATE) {
|
||||
DRAGGINGWINDOW->m_vRealSize = wb.size();
|
||||
DRAGGINGWINDOW->m_vRealPosition = wb.pos();
|
||||
*DRAGGINGWINDOW->m_vRealSize = wb.size();
|
||||
*DRAGGINGWINDOW->m_vRealPosition = wb.pos();
|
||||
} else {
|
||||
DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(wb.size());
|
||||
DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(wb.pos());
|
||||
DRAGGINGWINDOW->m_vRealSize->setValueAndWarp(wb.size());
|
||||
DRAGGINGWINDOW->m_vRealPosition->setValueAndWarp(wb.pos());
|
||||
}
|
||||
|
||||
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goal());
|
||||
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize->goal());
|
||||
} else {
|
||||
resizeActiveWindow(TICKDELTA, m_eGrabbedCorner, DRAGGINGWINDOW);
|
||||
}
|
||||
}
|
||||
|
||||
// get middle point
|
||||
Vector2D middle = DRAGGINGWINDOW->m_vRealPosition.value() + DRAGGINGWINDOW->m_vRealSize.value() / 2.f;
|
||||
Vector2D middle = DRAGGINGWINDOW->m_vRealPosition->value() + DRAGGINGWINDOW->m_vRealSize->value() / 2.f;
|
||||
|
||||
// and check its monitor
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromVector(middle);
|
||||
|
@ -719,7 +719,7 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
|
|||
EMIT_HOOK_EVENT("changeFloatingMode", pWindow);
|
||||
|
||||
if (!TILED) {
|
||||
const auto PNEWMON = g_pCompositor->getMonitorFromVector(pWindow->m_vRealPosition.value() + pWindow->m_vRealSize.value() / 2.f);
|
||||
const auto PNEWMON = g_pCompositor->getMonitorFromVector(pWindow->m_vRealPosition->value() + pWindow->m_vRealSize->value() / 2.f);
|
||||
pWindow->m_pMonitor = PNEWMON;
|
||||
pWindow->moveToWorkspace(PNEWMON->activeSpecialWorkspace ? PNEWMON->activeSpecialWorkspace : PNEWMON->activeWorkspace);
|
||||
pWindow->updateGroupOutputs();
|
||||
|
@ -730,12 +730,12 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
|
|||
g_pCompositor->setWindowFullscreenInternal(PWORKSPACE->getFullscreenWindow(), FSMODE_NONE);
|
||||
|
||||
// save real pos cuz the func applies the default 5,5 mid
|
||||
const auto PSAVEDPOS = pWindow->m_vRealPosition.goal();
|
||||
const auto PSAVEDSIZE = pWindow->m_vRealSize.goal();
|
||||
const auto PSAVEDPOS = pWindow->m_vRealPosition->goal();
|
||||
const auto PSAVEDSIZE = pWindow->m_vRealSize->goal();
|
||||
|
||||
// if the window is pseudo, update its size
|
||||
if (!pWindow->m_bDraggingTiled)
|
||||
pWindow->m_vPseudoSize = pWindow->m_vRealSize.goal();
|
||||
pWindow->m_vPseudoSize = pWindow->m_vRealSize->goal();
|
||||
|
||||
pWindow->m_vLastFloatingSize = PSAVEDSIZE;
|
||||
|
||||
|
@ -744,8 +744,8 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
|
|||
|
||||
onWindowCreatedTiling(pWindow);
|
||||
|
||||
pWindow->m_vRealPosition.setValue(PSAVEDPOS);
|
||||
pWindow->m_vRealSize.setValue(PSAVEDSIZE);
|
||||
pWindow->m_vRealPosition->setValue(PSAVEDPOS);
|
||||
pWindow->m_vRealSize->setValue(PSAVEDSIZE);
|
||||
|
||||
// fix pseudo leaving artifacts
|
||||
g_pHyprRenderer->damageMonitor(pWindow->m_pMonitor.lock());
|
||||
|
@ -757,16 +757,16 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
|
|||
|
||||
g_pCompositor->changeWindowZOrder(pWindow, true);
|
||||
|
||||
CBox wb = {pWindow->m_vRealPosition.goal() + (pWindow->m_vRealSize.goal() - pWindow->m_vLastFloatingSize) / 2.f, pWindow->m_vLastFloatingSize};
|
||||
CBox wb = {pWindow->m_vRealPosition->goal() + (pWindow->m_vRealSize->goal() - pWindow->m_vLastFloatingSize) / 2.f, pWindow->m_vLastFloatingSize};
|
||||
wb.round();
|
||||
|
||||
if (!(pWindow->m_bIsFloating && pWindow->m_bIsPseudotiled) && DELTALESSTHAN(pWindow->m_vRealSize.value().x, pWindow->m_vLastFloatingSize.x, 10) &&
|
||||
DELTALESSTHAN(pWindow->m_vRealSize.value().y, pWindow->m_vLastFloatingSize.y, 10)) {
|
||||
if (!(pWindow->m_bIsFloating && pWindow->m_bIsPseudotiled) && DELTALESSTHAN(pWindow->m_vRealSize->value().x, pWindow->m_vLastFloatingSize.x, 10) &&
|
||||
DELTALESSTHAN(pWindow->m_vRealSize->value().y, pWindow->m_vLastFloatingSize.y, 10)) {
|
||||
wb = {wb.pos() + Vector2D{10, 10}, wb.size() - Vector2D{20, 20}};
|
||||
}
|
||||
|
||||
pWindow->m_vRealPosition = wb.pos();
|
||||
pWindow->m_vRealSize = wb.size();
|
||||
*pWindow->m_vRealPosition = wb.pos();
|
||||
*pWindow->m_vRealSize = wb.size();
|
||||
|
||||
pWindow->m_vSize = wb.pos();
|
||||
pWindow->m_vPosition = wb.size();
|
||||
|
@ -798,7 +798,7 @@ void IHyprLayout::moveActiveWindow(const Vector2D& delta, PHLWINDOW pWindow) {
|
|||
|
||||
PWINDOW->setAnimationsToMove();
|
||||
|
||||
PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.goal() + delta;
|
||||
*PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition->goal() + delta;
|
||||
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
}
|
||||
|
|
|
@ -301,8 +301,8 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
|
|||
const auto PFULLWINDOW = pWorkspace->getFullscreenWindow();
|
||||
|
||||
if (pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN) {
|
||||
PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition;
|
||||
PFULLWINDOW->m_vRealSize = PMONITOR->vecSize;
|
||||
*PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition;
|
||||
*PFULLWINDOW->m_vRealSize = PMONITOR->vecSize;
|
||||
} else if (pWorkspace->m_efFullscreenMode == FSMODE_MAXIMIZED) {
|
||||
SMasterNodeData fakeNode;
|
||||
fakeNode.pWindow = PFULLWINDOW;
|
||||
|
@ -672,16 +672,16 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
|||
CBox wb = {calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f, calcSize * *PSCALEFACTOR};
|
||||
wb.round(); // avoid rounding mess
|
||||
|
||||
PWINDOW->m_vRealPosition = wb.pos();
|
||||
PWINDOW->m_vRealSize = wb.size();
|
||||
*PWINDOW->m_vRealPosition = wb.pos();
|
||||
*PWINDOW->m_vRealSize = wb.size();
|
||||
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
|
||||
} else {
|
||||
CBox wb = {calcPos, calcSize};
|
||||
wb.round(); // avoid rounding mess
|
||||
|
||||
PWINDOW->m_vRealPosition = wb.pos();
|
||||
PWINDOW->m_vRealSize = wb.size();
|
||||
*PWINDOW->m_vRealPosition = wb.pos();
|
||||
*PWINDOW->m_vRealSize = wb.size();
|
||||
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
|
||||
}
|
||||
|
@ -689,8 +689,8 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
|||
if (m_bForceWarps && !*PANIMATE) {
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
|
||||
PWINDOW->m_vRealPosition.warp();
|
||||
PWINDOW->m_vRealSize.warp();
|
||||
PWINDOW->m_vRealPosition->warp();
|
||||
PWINDOW->m_vRealSize->warp();
|
||||
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
}
|
||||
|
@ -711,8 +711,8 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne
|
|||
const auto PNODE = getNodeFromWindow(PWINDOW);
|
||||
|
||||
if (!PNODE) {
|
||||
PWINDOW->m_vRealSize =
|
||||
(PWINDOW->m_vRealSize.goal() + pixResize)
|
||||
*PWINDOW->m_vRealSize =
|
||||
(PWINDOW->m_vRealSize->goal() + pixResize)
|
||||
.clamp(PWINDOW->m_sWindowData.minSize.valueOr(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), PWINDOW->m_sWindowData.maxSize.valueOr(Vector2D{INFINITY, INFINITY}));
|
||||
PWINDOW->updateWindowDecos();
|
||||
return;
|
||||
|
@ -852,10 +852,10 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFul
|
|||
|
||||
// save position and size if floating
|
||||
if (pWindow->m_bIsFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE) {
|
||||
pWindow->m_vLastFloatingSize = pWindow->m_vRealSize.goal();
|
||||
pWindow->m_vLastFloatingPosition = pWindow->m_vRealPosition.goal();
|
||||
pWindow->m_vPosition = pWindow->m_vRealPosition.goal();
|
||||
pWindow->m_vSize = pWindow->m_vRealSize.goal();
|
||||
pWindow->m_vLastFloatingSize = pWindow->m_vRealSize->goal();
|
||||
pWindow->m_vLastFloatingPosition = pWindow->m_vRealPosition->goal();
|
||||
pWindow->m_vPosition = pWindow->m_vRealPosition->goal();
|
||||
pWindow->m_vSize = pWindow->m_vRealSize->goal();
|
||||
}
|
||||
|
||||
if (EFFECTIVE_MODE == FSMODE_NONE) {
|
||||
|
@ -865,8 +865,8 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFul
|
|||
applyNodeDataToWindow(PNODE);
|
||||
else {
|
||||
// get back its' dimensions from position and size
|
||||
pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition;
|
||||
pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
|
||||
*pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition;
|
||||
*pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
|
||||
|
||||
pWindow->unsetWindowData(PRIORITY_LAYOUT);
|
||||
pWindow->updateWindowData();
|
||||
|
@ -874,8 +874,8 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFul
|
|||
} else {
|
||||
// apply new pos and size being monitors' box
|
||||
if (EFFECTIVE_MODE == FSMODE_FULLSCREEN) {
|
||||
pWindow->m_vRealPosition = PMONITOR->vecPosition;
|
||||
pWindow->m_vRealSize = PMONITOR->vecSize;
|
||||
*pWindow->m_vRealPosition = PMONITOR->vecPosition;
|
||||
*pWindow->m_vRealSize = PMONITOR->vecSize;
|
||||
} else {
|
||||
// This is a massive hack.
|
||||
// We make a fake "only" node and apply
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#include "AnimationManager.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "HookSystemManager.hpp"
|
||||
#include "config/ConfigManager.hpp"
|
||||
#include "desktop/DesktopTypes.hpp"
|
||||
#include "helpers/AnimatedVariable.hpp"
|
||||
#include "macros.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
|
@ -9,6 +12,8 @@
|
|||
#include "../helpers/varlist/VarList.hpp"
|
||||
|
||||
#include <hyprgraphics/color/Color.hpp>
|
||||
#include <hyprutils/animation/AnimatedVariable.hpp>
|
||||
#include <hyprutils/animation/AnimationManager.hpp>
|
||||
|
||||
static int wlTick(SP<CEventLoopTimer> self, void* data) {
|
||||
if (g_pAnimationManager)
|
||||
|
@ -26,324 +31,245 @@ static int wlTick(SP<CEventLoopTimer> self, void* data) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
CAnimationManager::CAnimationManager() {
|
||||
std::vector<Vector2D> points = {Vector2D(0.0, 0.75), Vector2D(0.15, 1.0)};
|
||||
m_mBezierCurves["default"].setup(&points);
|
||||
|
||||
points = {Vector2D(0.0, 0.0), Vector2D(1.0, 1.0)};
|
||||
m_mBezierCurves["linear"].setup(&points);
|
||||
|
||||
CHyprAnimationManager::CHyprAnimationManager() {
|
||||
m_pAnimationTimer = SP<CEventLoopTimer>(new CEventLoopTimer(std::chrono::microseconds(500), wlTick, nullptr));
|
||||
g_pEventLoopManager->addTimer(m_pAnimationTimer);
|
||||
|
||||
addBezierWithName("linear", Vector2D(0.0, 0.0), Vector2D(1.0, 1.0));
|
||||
}
|
||||
|
||||
void CAnimationManager::removeAllBeziers() {
|
||||
m_mBezierCurves.clear();
|
||||
template <Animable VarType>
|
||||
void updateVariable(CAnimatedVariable<VarType>& av, const float POINTY, bool warp = false) {
|
||||
if (POINTY >= 1.f || warp || av.value() == av.goal()) {
|
||||
av.warp();
|
||||
return;
|
||||
}
|
||||
|
||||
// add the default one
|
||||
std::vector<Vector2D> points = {Vector2D(0.0, 0.75), Vector2D(0.15, 1.0)};
|
||||
m_mBezierCurves["default"].setup(&points);
|
||||
|
||||
points = {Vector2D(0.0, 0.0), Vector2D(1.0, 1.0)};
|
||||
m_mBezierCurves["linear"].setup(&points);
|
||||
const auto DELTA = av.goal() - av.begun();
|
||||
av.value() = av.begun() + DELTA * POINTY;
|
||||
}
|
||||
|
||||
void CAnimationManager::addBezierWithName(std::string name, const Vector2D& p1, const Vector2D& p2) {
|
||||
std::vector points = {p1, p2};
|
||||
m_mBezierCurves[name].setup(&points);
|
||||
void updateColorVariable(CAnimatedVariable<CHyprColor>& av, const float POINTY, bool warp) {
|
||||
if (POINTY >= 1.f || warp || av.value() == av.goal()) {
|
||||
av.warp();
|
||||
return;
|
||||
}
|
||||
|
||||
// convert both to OkLab, then lerp that, and convert back.
|
||||
// This is not as fast as just lerping rgb, but it's WAY more precise...
|
||||
// Use the CHyprColor cache for OkLab
|
||||
|
||||
const auto& L1 = av.begun().asOkLab();
|
||||
const auto& L2 = av.goal().asOkLab();
|
||||
|
||||
static const auto lerp = [](const float one, const float two, const float progress) -> float { return one + (two - one) * progress; };
|
||||
|
||||
const Hyprgraphics::CColor lerped = Hyprgraphics::CColor::SOkLab{
|
||||
.l = lerp(L1.l, L2.l, POINTY),
|
||||
.a = lerp(L1.a, L2.a, POINTY),
|
||||
.b = lerp(L1.b, L2.b, POINTY),
|
||||
};
|
||||
|
||||
av.value() = {lerped, lerp(av.begun().a, av.goal().a, POINTY)};
|
||||
}
|
||||
|
||||
void CAnimationManager::onTicked() {
|
||||
m_bTickScheduled = false;
|
||||
template <Animable VarType>
|
||||
static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
|
||||
PHLWINDOW PWINDOW = av.m_Context.pWindow.lock();
|
||||
PHLWORKSPACE PWORKSPACE = av.m_Context.pWorkspace.lock();
|
||||
PHLLS PLAYER = av.m_Context.pLayer.lock();
|
||||
PHLMONITOR PMONITOR = nullptr;
|
||||
bool animationsDisabled = warp;
|
||||
|
||||
if (PWINDOW) {
|
||||
if (av.m_Context.eDamagePolicy == AVARDAMAGE_ENTIRE)
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
else if (av.m_Context.eDamagePolicy == AVARDAMAGE_BORDER) {
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_BORDER);
|
||||
PDECO->damageEntire();
|
||||
} else if (av.m_Context.eDamagePolicy == AVARDAMAGE_SHADOW) {
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW);
|
||||
PDECO->damageEntire();
|
||||
}
|
||||
|
||||
PMONITOR = PWINDOW->m_pMonitor.lock();
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
|
||||
animationsDisabled = PWINDOW->m_sWindowData.noAnim.valueOr(animationsDisabled);
|
||||
} else if (PWORKSPACE) {
|
||||
PMONITOR = PWORKSPACE->m_pMonitor.lock();
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
|
||||
// dont damage the whole monitor on workspace change, unless it's a special workspace, because dim/blur etc
|
||||
if (PWORKSPACE->m_bIsSpecialWorkspace)
|
||||
g_pHyprRenderer->damageMonitor(PMONITOR);
|
||||
|
||||
// TODO: just make this into a damn callback already vax...
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE)
|
||||
continue;
|
||||
|
||||
if (w->m_bIsFloating && !w->m_bPinned) {
|
||||
// still doing the full damage hack for floating because sometimes when the window
|
||||
// goes through multiple monitors the last rendered frame is missing damage somehow??
|
||||
const CBox windowBoxNoOffset = w->getFullWindowBoundingBox();
|
||||
const CBox monitorBox = {PMONITOR->vecPosition, PMONITOR->vecSize};
|
||||
if (windowBoxNoOffset.intersection(monitorBox) != windowBoxNoOffset) // on edges between multiple monitors
|
||||
g_pHyprRenderer->damageWindow(w, true);
|
||||
}
|
||||
|
||||
if (PWORKSPACE->m_bIsSpecialWorkspace)
|
||||
g_pHyprRenderer->damageWindow(w, true); // hack for special too because it can cross multiple monitors
|
||||
}
|
||||
|
||||
// damage any workspace window that is on any monitor
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned)
|
||||
continue;
|
||||
|
||||
g_pHyprRenderer->damageWindow(w);
|
||||
}
|
||||
} else if (PLAYER) {
|
||||
// "some fucking layers miss 1 pixel???" -- vaxry
|
||||
CBox expandBox = CBox{PLAYER->realPosition->value(), PLAYER->realSize->value()};
|
||||
expandBox.expand(5);
|
||||
g_pHyprRenderer->damageBox(&expandBox);
|
||||
|
||||
PMONITOR = g_pCompositor->getMonitorFromVector(PLAYER->realPosition->goal() + PLAYER->realSize->goal() / 2.F);
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
animationsDisabled = animationsDisabled || PLAYER->noAnimations;
|
||||
}
|
||||
|
||||
const auto SPENT = av.getPercent();
|
||||
const auto PBEZIER = g_pAnimationManager->getBezier(av.getBezierName());
|
||||
const auto POINTY = PBEZIER->getYForPoint(SPENT);
|
||||
|
||||
if constexpr (std::same_as<VarType, CHyprColor>) {
|
||||
updateColorVariable(av, POINTY, animationsDisabled);
|
||||
} else {
|
||||
updateVariable<VarType>(av, POINTY, animationsDisabled);
|
||||
}
|
||||
|
||||
av.onUpdate();
|
||||
|
||||
switch (av.m_Context.eDamagePolicy) {
|
||||
case AVARDAMAGE_ENTIRE: {
|
||||
if (PWINDOW) {
|
||||
PWINDOW->updateWindowDecos();
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
} else if (PWORKSPACE) {
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE)
|
||||
continue;
|
||||
|
||||
w->updateWindowDecos();
|
||||
|
||||
// damage any workspace window that is on any monitor
|
||||
if (!w->m_bPinned)
|
||||
g_pHyprRenderer->damageWindow(w);
|
||||
}
|
||||
} else if (PLAYER) {
|
||||
if (PLAYER->layer <= 1)
|
||||
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR);
|
||||
|
||||
// some fucking layers miss 1 pixel???
|
||||
CBox expandBox = CBox{PLAYER->realPosition->value(), PLAYER->realSize->value()};
|
||||
expandBox.expand(5);
|
||||
g_pHyprRenderer->damageBox(&expandBox);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AVARDAMAGE_BORDER: {
|
||||
RASSERT(PWINDOW, "Tried to AVARDAMAGE_BORDER a non-window AVAR!");
|
||||
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_BORDER);
|
||||
PDECO->damageEntire();
|
||||
|
||||
break;
|
||||
}
|
||||
case AVARDAMAGE_SHADOW: {
|
||||
RASSERT(PWINDOW, "Tried to AVARDAMAGE_SHADOW a non-window AVAR!");
|
||||
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW);
|
||||
|
||||
PDECO->damageEntire();
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// manually schedule a frame
|
||||
if (PMONITOR)
|
||||
g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_ANIMATION);
|
||||
}
|
||||
|
||||
void CAnimationManager::tick() {
|
||||
void CHyprAnimationManager::tick() {
|
||||
static std::chrono::time_point lastTick = std::chrono::high_resolution_clock::now();
|
||||
m_fLastTickTime = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - lastTick).count() / 1000.0;
|
||||
lastTick = std::chrono::high_resolution_clock::now();
|
||||
|
||||
if (m_vActiveAnimatedVariables.empty())
|
||||
return;
|
||||
|
||||
bool animGlobalDisabled = false;
|
||||
|
||||
static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled");
|
||||
|
||||
if (!*PANIMENABLED)
|
||||
animGlobalDisabled = true;
|
||||
|
||||
static auto* const PSHADOWSENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:shadow:enabled");
|
||||
|
||||
const auto DEFAULTBEZIER = m_mBezierCurves.find("default");
|
||||
|
||||
std::vector<CBaseAnimatedVariable*> animationEndedVars;
|
||||
|
||||
for (auto const& av : m_vActiveAnimatedVariables) {
|
||||
|
||||
if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) {
|
||||
av->warp(false);
|
||||
animationEndedVars.push_back(av);
|
||||
for (auto const& pav : m_vActiveAnimatedVariables) {
|
||||
const auto PAV = pav.lock();
|
||||
if (!PAV)
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the spent % (0 - 1)
|
||||
const float SPENT = av->getPercent();
|
||||
// for disabled anims just warp
|
||||
bool warp = !*PANIMENABLED || !PAV->enabled();
|
||||
|
||||
// window stuff
|
||||
PHLWINDOW PWINDOW = av->m_pWindow.lock();
|
||||
PHLWORKSPACE PWORKSPACE = av->m_pWorkspace.lock();
|
||||
PHLLS PLAYER = av->m_pLayer.lock();
|
||||
PHLMONITOR PMONITOR = nullptr;
|
||||
bool animationsDisabled = animGlobalDisabled;
|
||||
|
||||
if (PWINDOW) {
|
||||
if (av->m_eDamagePolicy == AVARDAMAGE_ENTIRE) {
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
} else if (av->m_eDamagePolicy == AVARDAMAGE_BORDER) {
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_BORDER);
|
||||
PDECO->damageEntire();
|
||||
} else if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW) {
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW);
|
||||
PDECO->damageEntire();
|
||||
}
|
||||
|
||||
PMONITOR = PWINDOW->m_pMonitor.lock();
|
||||
if (!PMONITOR)
|
||||
continue;
|
||||
animationsDisabled = PWINDOW->m_sWindowData.noAnim.valueOr(animationsDisabled);
|
||||
} else if (PWORKSPACE) {
|
||||
PMONITOR = PWORKSPACE->m_pMonitor.lock();
|
||||
if (!PMONITOR)
|
||||
continue;
|
||||
|
||||
// dont damage the whole monitor on workspace change, unless it's a special workspace, because dim/blur etc
|
||||
if (PWORKSPACE->m_bIsSpecialWorkspace)
|
||||
g_pHyprRenderer->damageMonitor(PMONITOR);
|
||||
|
||||
// TODO: just make this into a damn callback already vax...
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE)
|
||||
continue;
|
||||
|
||||
if (w->m_bIsFloating && !w->m_bPinned) {
|
||||
// still doing the full damage hack for floating because sometimes when the window
|
||||
// goes through multiple monitors the last rendered frame is missing damage somehow??
|
||||
const CBox windowBoxNoOffset = w->getFullWindowBoundingBox();
|
||||
const CBox monitorBox = {PMONITOR->vecPosition, PMONITOR->vecSize};
|
||||
if (windowBoxNoOffset.intersection(monitorBox) != windowBoxNoOffset) // on edges between multiple monitors
|
||||
g_pHyprRenderer->damageWindow(w, true);
|
||||
}
|
||||
|
||||
if (PWORKSPACE->m_bIsSpecialWorkspace)
|
||||
g_pHyprRenderer->damageWindow(w, true); // hack for special too because it can cross multiple monitors
|
||||
}
|
||||
|
||||
// damage any workspace window that is on any monitor
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned)
|
||||
continue;
|
||||
|
||||
g_pHyprRenderer->damageWindow(w);
|
||||
}
|
||||
} else if (PLAYER) {
|
||||
// "some fucking layers miss 1 pixel???" -- vaxry
|
||||
CBox expandBox = CBox{PLAYER->realPosition.value(), PLAYER->realSize.value()};
|
||||
expandBox.expand(5);
|
||||
g_pHyprRenderer->damageBox(&expandBox);
|
||||
|
||||
PMONITOR = g_pCompositor->getMonitorFromVector(PLAYER->realPosition.goal() + PLAYER->realSize.goal() / 2.F);
|
||||
if (!PMONITOR)
|
||||
continue;
|
||||
animationsDisabled = animationsDisabled || PLAYER->noAnimations;
|
||||
}
|
||||
|
||||
const bool VISIBLE = PWINDOW && PWINDOW->m_pWorkspace ? PWINDOW->m_pWorkspace->isVisible() : true;
|
||||
|
||||
// beziers are with a switch unforto
|
||||
// TODO: maybe do something cleaner
|
||||
|
||||
static const auto updateVariable = [this]<Animable T>(CAnimatedVariable<T>& av, const float SPENT, const CBezierCurve& DEFAULTBEZIER, const bool DISABLED) {
|
||||
// for disabled anims just warp
|
||||
if (av.m_pConfig->pValues->internalEnabled == 0 || DISABLED) {
|
||||
av.warp(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SPENT >= 1.f || av.m_Begun == av.m_Goal) {
|
||||
av.warp(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto BEZIER = m_mBezierCurves.find(av.m_pConfig->pValues->internalBezier);
|
||||
const auto POINTY = BEZIER != m_mBezierCurves.end() ? BEZIER->second.getYForPoint(SPENT) : DEFAULTBEZIER.getYForPoint(SPENT);
|
||||
|
||||
const auto DELTA = av.m_Goal - av.m_Begun;
|
||||
|
||||
if (BEZIER != m_mBezierCurves.end())
|
||||
av.m_Value = av.m_Begun + DELTA * POINTY;
|
||||
else
|
||||
av.m_Value = av.m_Begun + DELTA * POINTY;
|
||||
};
|
||||
|
||||
static const auto updateColorVariable = [this](CAnimatedVariable<CHyprColor>& av, const float SPENT, const CBezierCurve& DEFAULTBEZIER, const bool DISABLED) {
|
||||
// for disabled anims just warp
|
||||
if (av.m_pConfig->pValues->internalEnabled == 0 || DISABLED) {
|
||||
av.warp(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SPENT >= 1.f || av.m_Begun == av.m_Goal) {
|
||||
av.warp(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto BEZIER = m_mBezierCurves.find(av.m_pConfig->pValues->internalBezier);
|
||||
const auto POINTY = BEZIER != m_mBezierCurves.end() ? BEZIER->second.getYForPoint(SPENT) : DEFAULTBEZIER.getYForPoint(SPENT);
|
||||
|
||||
// convert both to OkLab, then lerp that, and convert back.
|
||||
// This is not as fast as just lerping rgb, but it's WAY more precise...
|
||||
// Use the CHyprColor cache for OkLab
|
||||
|
||||
const auto& L1 = av.m_Begun.asOkLab();
|
||||
const auto& L2 = av.m_Goal.asOkLab();
|
||||
|
||||
static const auto lerp = [](const float one, const float two, const float progress) -> float { return one + (two - one) * progress; };
|
||||
|
||||
const Hyprgraphics::CColor lerped = Hyprgraphics::CColor::SOkLab{
|
||||
.l = lerp(L1.l, L2.l, POINTY),
|
||||
.a = lerp(L1.a, L2.a, POINTY),
|
||||
.b = lerp(L1.b, L2.b, POINTY),
|
||||
};
|
||||
|
||||
av.m_Value = {lerped, lerp(av.m_Begun.a, av.m_Goal.a, POINTY)};
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
switch (av->m_Type) {
|
||||
switch (PAV->m_Type) {
|
||||
case AVARTYPE_FLOAT: {
|
||||
auto typedAv = dynamic_cast<CAnimatedVariable<float>*>(av);
|
||||
updateVariable(*typedAv, SPENT, DEFAULTBEZIER->second, animationsDisabled);
|
||||
break;
|
||||
}
|
||||
auto pTypedAV = dynamic_cast<CAnimatedVariable<float>*>(PAV.get());
|
||||
RASSERT(pTypedAV, "Failed to upcast animated float");
|
||||
handleUpdate(*pTypedAV, warp);
|
||||
} break;
|
||||
case AVARTYPE_VECTOR: {
|
||||
auto typedAv = dynamic_cast<CAnimatedVariable<Vector2D>*>(av);
|
||||
updateVariable(*typedAv, SPENT, DEFAULTBEZIER->second, animationsDisabled);
|
||||
break;
|
||||
}
|
||||
auto pTypedAV = dynamic_cast<CAnimatedVariable<Vector2D>*>(PAV.get());
|
||||
RASSERT(pTypedAV, "Failed to upcast animated Vector2D");
|
||||
handleUpdate(*pTypedAV, warp);
|
||||
} break;
|
||||
case AVARTYPE_COLOR: {
|
||||
auto typedAv = dynamic_cast<CAnimatedVariable<CHyprColor>*>(av);
|
||||
updateColorVariable(*typedAv, SPENT, DEFAULTBEZIER->second, animationsDisabled);
|
||||
break;
|
||||
}
|
||||
auto pTypedAV = dynamic_cast<CAnimatedVariable<CHyprColor>*>(PAV.get());
|
||||
RASSERT(pTypedAV, "Failed to upcast animated CHyprColor");
|
||||
handleUpdate(*pTypedAV, warp);
|
||||
} break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
// set size and pos if valid, but only if damage policy entire (dont if border for example)
|
||||
if (validMapped(PWINDOW) && av->m_eDamagePolicy == AVARDAMAGE_ENTIRE && !PWINDOW->isX11OverrideRedirect())
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
|
||||
|
||||
// check if we did not finish animating. If so, trigger onAnimationEnd.
|
||||
if (!av->isBeingAnimated())
|
||||
animationEndedVars.push_back(av);
|
||||
|
||||
// lastly, handle damage, but only if whatever we are animating is visible.
|
||||
if (!VISIBLE)
|
||||
continue;
|
||||
|
||||
if (av->m_fUpdateCallback)
|
||||
av->m_fUpdateCallback(av);
|
||||
|
||||
switch (av->m_eDamagePolicy) {
|
||||
case AVARDAMAGE_ENTIRE: {
|
||||
if (PWINDOW) {
|
||||
PWINDOW->updateWindowDecos();
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
} else if (PWORKSPACE) {
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE)
|
||||
continue;
|
||||
|
||||
w->updateWindowDecos();
|
||||
|
||||
// damage any workspace window that is on any monitor
|
||||
if (!w->m_bPinned)
|
||||
g_pHyprRenderer->damageWindow(w);
|
||||
}
|
||||
} else if (PLAYER) {
|
||||
if (PLAYER->layer <= 1)
|
||||
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR);
|
||||
|
||||
// some fucking layers miss 1 pixel???
|
||||
CBox expandBox = CBox{PLAYER->realPosition.value(), PLAYER->realSize.value()};
|
||||
expandBox.expand(5);
|
||||
g_pHyprRenderer->damageBox(&expandBox);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AVARDAMAGE_BORDER: {
|
||||
RASSERT(PWINDOW, "Tried to AVARDAMAGE_BORDER a non-window AVAR!");
|
||||
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_BORDER);
|
||||
PDECO->damageEntire();
|
||||
|
||||
break;
|
||||
}
|
||||
case AVARDAMAGE_SHADOW: {
|
||||
RASSERT(PWINDOW, "Tried to AVARDAMAGE_SHADOW a non-window AVAR!");
|
||||
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW);
|
||||
|
||||
PDECO->damageEntire();
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// manually schedule a frame
|
||||
if (PMONITOR)
|
||||
g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_ANIMATION);
|
||||
}
|
||||
|
||||
// do it here, because if this alters the animation vars vec we would be in trouble above.
|
||||
for (auto const& ave : animationEndedVars) {
|
||||
ave->onAnimationEnd();
|
||||
}
|
||||
tickDone();
|
||||
}
|
||||
|
||||
bool CAnimationManager::deltaSmallToFlip(const Vector2D& a, const Vector2D& b) {
|
||||
return std::abs(a.x - b.x) < 0.5f && std::abs(a.y - b.y) < 0.5f;
|
||||
}
|
||||
void CHyprAnimationManager::scheduleTick() {
|
||||
if (m_bTickScheduled)
|
||||
return;
|
||||
|
||||
bool CAnimationManager::deltaSmallToFlip(const CHyprColor& a, const CHyprColor& b) {
|
||||
return std::abs(a.r - b.r) < 0.5f && std::abs(a.g - b.g) < 0.5f && std::abs(a.b - b.b) < 0.5f && std::abs(a.a - b.a) < 0.5f;
|
||||
}
|
||||
m_bTickScheduled = true;
|
||||
|
||||
bool CAnimationManager::deltaSmallToFlip(const float& a, const float& b) {
|
||||
return std::abs(a - b) < 0.5f;
|
||||
}
|
||||
const auto PMOSTHZ = g_pHyprRenderer->m_pMostHzMonitor;
|
||||
|
||||
bool CAnimationManager::deltazero(const Vector2D& a, const Vector2D& b) {
|
||||
return a.x == b.x && a.y == b.y;
|
||||
}
|
||||
|
||||
bool CAnimationManager::deltazero(const float& a, const float& b) {
|
||||
return a == b;
|
||||
}
|
||||
|
||||
bool CAnimationManager::deltazero(const CHyprColor& a, const CHyprColor& b) {
|
||||
return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
|
||||
}
|
||||
|
||||
bool CAnimationManager::bezierExists(const std::string& bezier) {
|
||||
for (auto const& [bc, bz] : m_mBezierCurves) {
|
||||
if (bc == bezier)
|
||||
return true;
|
||||
if (!PMOSTHZ) {
|
||||
m_pAnimationTimer->updateTimeout(std::chrono::milliseconds(16));
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
float refreshDelayMs = std::floor(1000.f / PMOSTHZ->refreshRate);
|
||||
|
||||
const float SINCEPRES = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - PMOSTHZ->lastPresentationTimer.chrono()).count() / 1000.f;
|
||||
|
||||
const auto TOPRES = std::clamp(refreshDelayMs - SINCEPRES, 1.1f, 1000.f); // we can't send 0, that will disarm it
|
||||
|
||||
m_pAnimationTimer->updateTimeout(std::chrono::milliseconds((int)std::floor(TOPRES)));
|
||||
}
|
||||
|
||||
void CHyprAnimationManager::onTicked() {
|
||||
m_bTickScheduled = false;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -351,24 +277,24 @@ bool CAnimationManager::bezierExists(const std::string& bezier) {
|
|||
//
|
||||
//
|
||||
|
||||
void CAnimationManager::animationPopin(PHLWINDOW pWindow, bool close, float minPerc) {
|
||||
const auto GOALPOS = pWindow->m_vRealPosition.goal();
|
||||
const auto GOALSIZE = pWindow->m_vRealSize.goal();
|
||||
void CHyprAnimationManager::animationPopin(PHLWINDOW pWindow, bool close, float minPerc) {
|
||||
const auto GOALPOS = pWindow->m_vRealPosition->goal();
|
||||
const auto GOALSIZE = pWindow->m_vRealSize->goal();
|
||||
|
||||
if (!close) {
|
||||
pWindow->m_vRealSize.setValue((GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y}));
|
||||
pWindow->m_vRealPosition.setValue(GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize.m_Value / 2.f);
|
||||
pWindow->m_vRealSize->setValue((GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y}));
|
||||
pWindow->m_vRealPosition->setValue(GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize->value() / 2.f);
|
||||
} else {
|
||||
pWindow->m_vRealSize = (GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y});
|
||||
pWindow->m_vRealPosition = GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize.m_Goal / 2.f;
|
||||
*pWindow->m_vRealSize = (GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y});
|
||||
*pWindow->m_vRealPosition = GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize->goal() / 2.f;
|
||||
}
|
||||
}
|
||||
|
||||
void CAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, bool close) {
|
||||
pWindow->m_vRealSize.warp(false); // size we preserve in slide
|
||||
void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, bool close) {
|
||||
pWindow->m_vRealSize->warp(false); // size we preserve in slide
|
||||
|
||||
const auto GOALPOS = pWindow->m_vRealPosition.goal();
|
||||
const auto GOALSIZE = pWindow->m_vRealSize.goal();
|
||||
const auto GOALPOS = pWindow->m_vRealPosition->goal();
|
||||
const auto GOALSIZE = pWindow->m_vRealSize->goal();
|
||||
|
||||
const auto PMONITOR = pWindow->m_pMonitor.lock();
|
||||
|
||||
|
@ -388,9 +314,9 @@ void CAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, boo
|
|||
posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y - GOALSIZE.y);
|
||||
|
||||
if (!close)
|
||||
pWindow->m_vRealPosition.setValue(posOffset);
|
||||
pWindow->m_vRealPosition->setValue(posOffset);
|
||||
else
|
||||
pWindow->m_vRealPosition = posOffset;
|
||||
*pWindow->m_vRealPosition = posOffset;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -423,33 +349,33 @@ void CAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, boo
|
|||
}
|
||||
|
||||
if (!close)
|
||||
pWindow->m_vRealPosition.setValue(posOffset);
|
||||
pWindow->m_vRealPosition->setValue(posOffset);
|
||||
else
|
||||
pWindow->m_vRealPosition = posOffset;
|
||||
*pWindow->m_vRealPosition = posOffset;
|
||||
}
|
||||
|
||||
void CAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool close) {
|
||||
void CHyprAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool close) {
|
||||
if (!close) {
|
||||
pWindow->m_vRealPosition.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsIn");
|
||||
pWindow->m_vRealSize.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsIn");
|
||||
pWindow->m_fAlpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("fadeIn");
|
||||
pWindow->m_vRealPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn"));
|
||||
pWindow->m_vRealSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn"));
|
||||
pWindow->m_fAlpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
|
||||
} else {
|
||||
pWindow->m_vRealPosition.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsOut");
|
||||
pWindow->m_vRealSize.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsOut");
|
||||
pWindow->m_fAlpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("fadeOut");
|
||||
pWindow->m_vRealPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut"));
|
||||
pWindow->m_vRealSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut"));
|
||||
pWindow->m_fAlpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
|
||||
}
|
||||
|
||||
auto ANIMSTYLE = pWindow->m_vRealPosition.m_pConfig->pValues->internalStyle;
|
||||
std::string ANIMSTYLE = pWindow->m_vRealPosition->getStyle();
|
||||
transform(ANIMSTYLE.begin(), ANIMSTYLE.end(), ANIMSTYLE.begin(), ::tolower);
|
||||
|
||||
CVarList animList(ANIMSTYLE, 0, 's');
|
||||
|
||||
// if the window is not being animated, that means the layout set a fixed size for it, don't animate.
|
||||
if (!pWindow->m_vRealPosition.isBeingAnimated() && !pWindow->m_vRealSize.isBeingAnimated())
|
||||
if (!pWindow->m_vRealPosition->isBeingAnimated() && !pWindow->m_vRealSize->isBeingAnimated())
|
||||
return;
|
||||
|
||||
// if the animation is disabled and we are leaving, ignore the anim to prevent the snapshot being fucked
|
||||
if (!pWindow->m_vRealPosition.m_pConfig->pValues->internalEnabled)
|
||||
if (!pWindow->m_vRealPosition->enabled())
|
||||
return;
|
||||
|
||||
if (pWindow->m_sWindowData.animationStyle.hasValue()) {
|
||||
|
@ -494,7 +420,7 @@ void CAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool close) {
|
|||
}
|
||||
}
|
||||
|
||||
std::string CAnimationManager::styleValidInConfigVar(const std::string& config, const std::string& style) {
|
||||
std::string CHyprAnimationManager::styleValidInConfigVar(const std::string& config, const std::string& style) {
|
||||
if (config.starts_with("window")) {
|
||||
if (style.starts_with("slide"))
|
||||
return "";
|
||||
|
@ -568,39 +494,3 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
|
|||
|
||||
return "";
|
||||
}
|
||||
|
||||
CBezierCurve* CAnimationManager::getBezier(const std::string& name) {
|
||||
const auto BEZIER = std::find_if(m_mBezierCurves.begin(), m_mBezierCurves.end(), [&](const auto& other) { return other.first == name; });
|
||||
|
||||
return BEZIER == m_mBezierCurves.end() ? &m_mBezierCurves["default"] : &BEZIER->second;
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, CBezierCurve> CAnimationManager::getAllBeziers() {
|
||||
return m_mBezierCurves;
|
||||
}
|
||||
|
||||
bool CAnimationManager::shouldTickForNext() {
|
||||
return !m_vActiveAnimatedVariables.empty();
|
||||
}
|
||||
|
||||
void CAnimationManager::scheduleTick() {
|
||||
if (m_bTickScheduled)
|
||||
return;
|
||||
|
||||
m_bTickScheduled = true;
|
||||
|
||||
const auto PMOSTHZ = g_pHyprRenderer->m_pMostHzMonitor;
|
||||
|
||||
if (!PMOSTHZ) {
|
||||
m_pAnimationTimer->updateTimeout(std::chrono::milliseconds(16));
|
||||
return;
|
||||
}
|
||||
|
||||
float refreshDelayMs = std::floor(1000.f / PMOSTHZ->refreshRate);
|
||||
|
||||
const float SINCEPRES = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - PMOSTHZ->lastPresentationTimer.chrono()).count() / 1000.f;
|
||||
|
||||
const auto TOPRES = std::clamp(refreshDelayMs - SINCEPRES, 1.1f, 1000.f); // we can't send 0, that will disarm it
|
||||
|
||||
m_pAnimationTimer->updateTimeout(std::chrono::milliseconds((int)std::floor(TOPRES)));
|
||||
}
|
||||
|
|
|
@ -1,57 +1,64 @@
|
|||
#pragma once
|
||||
|
||||
#include <hyprutils/animation/AnimationManager.hpp>
|
||||
#include <hyprutils/animation/AnimatedVariable.hpp>
|
||||
|
||||
#include "../defines.hpp"
|
||||
#include <list>
|
||||
#include <unordered_map>
|
||||
#include "../helpers/AnimatedVariable.hpp"
|
||||
#include "../helpers/BezierCurve.hpp"
|
||||
#include "../helpers/Timer.hpp"
|
||||
#include "desktop/DesktopTypes.hpp"
|
||||
#include "eventLoop/EventLoopTimer.hpp"
|
||||
|
||||
class CWindow;
|
||||
|
||||
class CAnimationManager {
|
||||
class CHyprAnimationManager : public Hyprutils::Animation::CAnimationManager {
|
||||
public:
|
||||
CAnimationManager();
|
||||
CHyprAnimationManager();
|
||||
|
||||
void tick();
|
||||
bool shouldTickForNext();
|
||||
void onTicked();
|
||||
void scheduleTick();
|
||||
void addBezierWithName(std::string, const Vector2D&, const Vector2D&);
|
||||
void removeAllBeziers();
|
||||
void tick();
|
||||
virtual void scheduleTick();
|
||||
virtual void onTicked();
|
||||
|
||||
void onWindowPostCreateClose(PHLWINDOW, bool close = false);
|
||||
using SAnimationPropertyConfig = Hyprutils::Animation::SAnimationPropertyConfig;
|
||||
template <Animable VarType>
|
||||
void createAnimation(const VarType& v, PHLANIMVAR<VarType>& pav, SP<SAnimationPropertyConfig> pConfig, eAVarDamagePolicy policy) {
|
||||
constexpr const eAnimatedVarType EAVTYPE = typeToeAnimatedVarType<VarType>;
|
||||
const auto PAV = makeShared<CAnimatedVariable<VarType>>();
|
||||
|
||||
bool bezierExists(const std::string&);
|
||||
CBezierCurve* getBezier(const std::string&);
|
||||
PAV->create(EAVTYPE, static_cast<Hyprutils::Animation::CAnimationManager*>(this), PAV, v);
|
||||
PAV->setConfig(pConfig);
|
||||
PAV->m_Context.eDamagePolicy = policy;
|
||||
|
||||
std::string styleValidInConfigVar(const std::string&, const std::string&);
|
||||
pav = std::move(PAV);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, CBezierCurve> getAllBeziers();
|
||||
template <Animable VarType>
|
||||
void createAnimation(const VarType& v, PHLANIMVAR<VarType>& pav, SP<SAnimationPropertyConfig> pConfig, PHLWINDOW pWindow, eAVarDamagePolicy policy) {
|
||||
createAnimation(v, pav, pConfig, policy);
|
||||
pav->m_Context.pWindow = pWindow;
|
||||
}
|
||||
template <Animable VarType>
|
||||
void createAnimation(const VarType& v, PHLANIMVAR<VarType>& pav, SP<SAnimationPropertyConfig> pConfig, PHLWORKSPACE pWorkspace, eAVarDamagePolicy policy) {
|
||||
createAnimation(v, pav, pConfig, policy);
|
||||
pav->m_Context.pWorkspace = pWorkspace;
|
||||
}
|
||||
template <Animable VarType>
|
||||
void createAnimation(const VarType& v, PHLANIMVAR<VarType>& pav, SP<SAnimationPropertyConfig> pConfig, PHLLS pLayer, eAVarDamagePolicy policy) {
|
||||
createAnimation(v, pav, pConfig, policy);
|
||||
pav->m_Context.pLayer = pLayer;
|
||||
}
|
||||
|
||||
std::vector<CBaseAnimatedVariable*> m_vAnimatedVariables;
|
||||
std::vector<CBaseAnimatedVariable*> m_vActiveAnimatedVariables;
|
||||
void onWindowPostCreateClose(PHLWINDOW, bool close = false);
|
||||
|
||||
SP<CEventLoopTimer> m_pAnimationTimer;
|
||||
std::string styleValidInConfigVar(const std::string&, const std::string&);
|
||||
|
||||
float m_fLastTickTime; // in ms
|
||||
SP<CEventLoopTimer> m_pAnimationTimer;
|
||||
|
||||
float m_fLastTickTime; // in ms
|
||||
|
||||
private:
|
||||
bool deltaSmallToFlip(const Vector2D& a, const Vector2D& b);
|
||||
bool deltaSmallToFlip(const CHyprColor& a, const CHyprColor& b);
|
||||
bool deltaSmallToFlip(const float& a, const float& b);
|
||||
bool deltazero(const Vector2D& a, const Vector2D& b);
|
||||
bool deltazero(const CHyprColor& a, const CHyprColor& b);
|
||||
bool deltazero(const float& a, const float& b);
|
||||
|
||||
std::unordered_map<std::string, CBezierCurve> m_mBezierCurves;
|
||||
|
||||
bool m_bTickScheduled = false;
|
||||
bool m_bTickScheduled = false;
|
||||
|
||||
// Anim stuff
|
||||
void animationPopin(PHLWINDOW, bool close = false, float minPerc = 0.f);
|
||||
void animationSlide(PHLWINDOW, std::string force = "", bool close = false);
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CAnimationManager> g_pAnimationManager;
|
||||
inline std::unique_ptr<CHyprAnimationManager> g_pAnimationManager;
|
||||
|
|
|
@ -377,8 +377,8 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO) {
|
|||
g_pCompositor->setWindowFullscreenInternal(PWINDOWTOCHANGETO, MODE);
|
||||
|
||||
// warp the position + size animation, otherwise it looks weird.
|
||||
PWINDOWTOCHANGETO->m_vRealPosition.warp();
|
||||
PWINDOWTOCHANGETO->m_vRealSize.warp();
|
||||
PWINDOWTOCHANGETO->m_vRealPosition->warp();
|
||||
PWINDOWTOCHANGETO->m_vRealSize->warp();
|
||||
} else {
|
||||
updateRelativeCursorCoords();
|
||||
g_pCompositor->focusWindow(PWINDOWTOCHANGETO);
|
||||
|
@ -1070,8 +1070,8 @@ SDispatchResult CKeybindManager::centerWindow(std::string args) {
|
|||
if (args == "1")
|
||||
RESERVEDOFFSET = (PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight) / 2.f;
|
||||
|
||||
PWINDOW->m_vRealPosition = PMONITOR->middle() - PWINDOW->m_vRealSize.goal() / 2.f + RESERVEDOFFSET;
|
||||
PWINDOW->m_vPosition = PWINDOW->m_vRealPosition.goal();
|
||||
*PWINDOW->m_vRealPosition = PMONITOR->middle() - PWINDOW->m_vRealSize->goal() / 2.f + RESERVEDOFFSET;
|
||||
PWINDOW->m_vPosition = PWINDOW->m_vRealPosition->goal();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -1557,14 +1557,14 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) {
|
|||
|
||||
switch (arg) {
|
||||
case 'l': vPosx = PMONITOR->vecReservedTopLeft.x + BORDERSIZE + PMONITOR->vecPosition.x; break;
|
||||
case 'r': vPosx = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_vRealSize.goal().x - BORDERSIZE + PMONITOR->vecPosition.x; break;
|
||||
case 'r': vPosx = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_vRealSize->goal().x - BORDERSIZE + PMONITOR->vecPosition.x; break;
|
||||
case 't':
|
||||
case 'u': vPosy = PMONITOR->vecReservedTopLeft.y + BORDERSIZE + PMONITOR->vecPosition.y; break;
|
||||
case 'b':
|
||||
case 'd': vPosy = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_vRealSize.goal().y - BORDERSIZE + PMONITOR->vecPosition.y; break;
|
||||
case 'd': vPosy = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_vRealSize->goal().y - BORDERSIZE + PMONITOR->vecPosition.y; break;
|
||||
}
|
||||
|
||||
PLASTWINDOW->m_vRealPosition = Vector2D(vPosx.value_or(PLASTWINDOW->m_vRealPosition.goal().x), vPosy.value_or(PLASTWINDOW->m_vRealPosition.goal().y));
|
||||
*PLASTWINDOW->m_vRealPosition = Vector2D(vPosx.value_or(PLASTWINDOW->m_vRealPosition->goal().x), vPosy.value_or(PLASTWINDOW->m_vRealPosition->goal().y));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -1735,20 +1735,20 @@ SDispatchResult CKeybindManager::moveCursorToCorner(std::string arg) {
|
|||
switch (CORNER) {
|
||||
case 0:
|
||||
// bottom left
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition.value().x, PWINDOW->m_vRealPosition.value().y + PWINDOW->m_vRealSize.value().y}, true);
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition->value().x, PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vRealSize->value().y}, true);
|
||||
break;
|
||||
case 1:
|
||||
// bottom right
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition.value().x + PWINDOW->m_vRealSize.value().x, PWINDOW->m_vRealPosition.value().y + PWINDOW->m_vRealSize.value().y},
|
||||
true);
|
||||
g_pCompositor->warpCursorTo(
|
||||
{PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vRealSize->value().y}, true);
|
||||
break;
|
||||
case 2:
|
||||
// top right
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition.value().x + PWINDOW->m_vRealSize.value().x, PWINDOW->m_vRealPosition.value().y}, true);
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealPosition->value().y}, true);
|
||||
break;
|
||||
case 3:
|
||||
// top left
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition.value().x, PWINDOW->m_vRealPosition.value().y}, true);
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition->value().x, PWINDOW->m_vRealPosition->value().y}, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1817,18 +1817,18 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
|
|||
continue;
|
||||
|
||||
if (!w->m_bRequestsFloat && w->m_bIsFloating != PWORKSPACE->m_bDefaultFloating) {
|
||||
const auto SAVEDPOS = w->m_vRealPosition.value();
|
||||
const auto SAVEDSIZE = w->m_vRealSize.value();
|
||||
const auto SAVEDPOS = w->m_vRealPosition->value();
|
||||
const auto SAVEDSIZE = w->m_vRealSize->value();
|
||||
|
||||
w->m_bIsFloating = PWORKSPACE->m_bDefaultFloating;
|
||||
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(w);
|
||||
|
||||
if (PWORKSPACE->m_bDefaultFloating) {
|
||||
w->m_vRealPosition.setValueAndWarp(SAVEDPOS);
|
||||
w->m_vRealSize.setValueAndWarp(SAVEDSIZE);
|
||||
w->m_vRealPosition->setValueAndWarp(SAVEDPOS);
|
||||
w->m_vRealSize->setValueAndWarp(SAVEDSIZE);
|
||||
g_pXWaylandManager->setWindowSize(w, SAVEDSIZE);
|
||||
w->m_vRealSize = w->m_vRealSize.value() + Vector2D(4, 4);
|
||||
w->m_vRealPosition = w->m_vRealPosition.value() - Vector2D(2, 2);
|
||||
*w->m_vRealSize = w->m_vRealSize->value() + Vector2D(4, 4);
|
||||
*w->m_vRealPosition = w->m_vRealPosition->value() - Vector2D(2, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2043,14 +2043,14 @@ SDispatchResult CKeybindManager::resizeActive(std::string args) {
|
|||
if (!PLASTWINDOW || PLASTWINDOW->isFullscreen())
|
||||
return {};
|
||||
|
||||
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealSize.goal());
|
||||
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealSize->goal());
|
||||
|
||||
if (SIZ.x < 1 || SIZ.y < 1)
|
||||
return {};
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PLASTWINDOW->m_vRealSize.goal());
|
||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PLASTWINDOW->m_vRealSize->goal());
|
||||
|
||||
if (PLASTWINDOW->m_vRealSize.goal().x > 1 && PLASTWINDOW->m_vRealSize.goal().y > 1)
|
||||
if (PLASTWINDOW->m_vRealSize->goal().x > 1 && PLASTWINDOW->m_vRealSize->goal().y > 1)
|
||||
PLASTWINDOW->setHidden(false);
|
||||
|
||||
return {};
|
||||
|
@ -2062,9 +2062,9 @@ SDispatchResult CKeybindManager::moveActive(std::string args) {
|
|||
if (!PLASTWINDOW || PLASTWINDOW->isFullscreen())
|
||||
return {};
|
||||
|
||||
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealPosition.goal());
|
||||
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealPosition->goal());
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PLASTWINDOW->m_vRealPosition.goal());
|
||||
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PLASTWINDOW->m_vRealPosition->goal());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -2084,9 +2084,9 @@ SDispatchResult CKeybindManager::moveWindow(std::string args) {
|
|||
if (PWINDOW->isFullscreen())
|
||||
return {};
|
||||
|
||||
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_vRealPosition.goal());
|
||||
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_vRealPosition->goal());
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PWINDOW->m_vRealPosition.goal(), PWINDOW);
|
||||
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PWINDOW->m_vRealPosition->goal(), PWINDOW);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -2106,14 +2106,14 @@ SDispatchResult CKeybindManager::resizeWindow(std::string args) {
|
|||
if (PWINDOW->isFullscreen())
|
||||
return {};
|
||||
|
||||
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_vRealSize.goal());
|
||||
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_vRealSize->goal());
|
||||
|
||||
if (SIZ.x < 1 || SIZ.y < 1)
|
||||
return {};
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PWINDOW->m_vRealSize.goal(), CORNER_NONE, PWINDOW);
|
||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PWINDOW->m_vRealSize->goal(), CORNER_NONE, PWINDOW);
|
||||
|
||||
if (PWINDOW->m_vRealSize.goal().x > 1 && PWINDOW->m_vRealSize.goal().y > 1)
|
||||
if (PWINDOW->m_vRealSize->goal().x > 1 && PWINDOW->m_vRealSize->goal().y > 1)
|
||||
PWINDOW->setHidden(false);
|
||||
|
||||
return {};
|
||||
|
@ -2192,8 +2192,8 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) {
|
|||
g_pCompositor->setWindowFullscreenClient(PWINDOW, FSMODE);
|
||||
|
||||
// warp the position + size animation, otherwise it looks weird.
|
||||
PWINDOW->m_vRealPosition.warp();
|
||||
PWINDOW->m_vRealSize.warp();
|
||||
PWINDOW->m_vRealPosition->warp();
|
||||
PWINDOW->m_vRealSize->warp();
|
||||
}
|
||||
} else
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
|
@ -2311,7 +2311,7 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
|
|||
}
|
||||
}
|
||||
|
||||
const auto SL = PWINDOW->m_vRealPosition.goal() - g_pInputManager->getMouseCoordsInternal();
|
||||
const auto SL = PWINDOW->m_vRealPosition->goal() - g_pInputManager->getMouseCoordsInternal();
|
||||
|
||||
if (g_pKeybindManager->m_uLastCode != 0)
|
||||
g_pSeatManager->setKeyboardFocus(LASTKBSURF);
|
||||
|
@ -2466,7 +2466,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
}
|
||||
}
|
||||
|
||||
const auto SL = PWINDOW->m_vRealPosition.goal() - g_pInputManager->getMouseCoordsInternal();
|
||||
const auto SL = PWINDOW->m_vRealPosition->goal() - g_pInputManager->getMouseCoordsInternal();
|
||||
|
||||
if (!isMouse)
|
||||
g_pSeatManager->setKeyboardFocus(LASTSURFACE);
|
||||
|
|
|
@ -55,7 +55,7 @@ void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
|
|||
if (pWindow->m_bIsX11) {
|
||||
|
||||
if (activate) {
|
||||
setWindowSize(pWindow, pWindow->m_vRealSize.value()); // update xwayland output pos
|
||||
setWindowSize(pWindow, pWindow->m_vRealSize->value()); // update xwayland output pos
|
||||
pWindow->m_pXWaylandSurface->setMinimized(false);
|
||||
|
||||
if (!pWindow->isX11OverrideRedirect())
|
||||
|
@ -123,7 +123,7 @@ void CHyprXWaylandManager::setWindowSize(PHLWINDOW pWindow, Vector2D size, bool
|
|||
|
||||
// calculate pos
|
||||
// TODO: this should be decoupled from setWindowSize IMO
|
||||
Vector2D windowPos = pWindow->m_vRealPosition.value();
|
||||
Vector2D windowPos = pWindow->m_vRealPosition->value();
|
||||
|
||||
if (pWindow->m_bIsX11 && PMONITOR) {
|
||||
windowPos -= PMONITOR->vecPosition; // normalize to monitor
|
||||
|
@ -273,4 +273,4 @@ Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) {
|
|||
result += pMonitor->vecPosition;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ void CInputManager::sendMotionEventsToFocused() {
|
|||
timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_vRealPosition.goal() : (PLS ? Vector2D{PLS->geometry.x, PLS->geometry.y} : Vector2D{}));
|
||||
const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_vRealPosition->goal() : (PLS ? Vector2D{PLS->geometry.x, PLS->geometry.y} : Vector2D{}));
|
||||
|
||||
m_bEmptyFocusCursorSet = false;
|
||||
|
||||
|
@ -243,7 +243,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
|
||||
if (forcedFocus) {
|
||||
pFoundWindow = forcedFocus;
|
||||
surfacePos = pFoundWindow->m_vRealPosition.value();
|
||||
surfacePos = pFoundWindow->m_vRealPosition->value();
|
||||
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
surfacePos = Vector2D(-1337, -1337);
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
||||
surfacePos = pFoundWindow->m_vRealPosition.value();
|
||||
surfacePos = pFoundWindow->m_vRealPosition->value();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,11 +362,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||
if (!foundSurface) {
|
||||
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
||||
surfacePos = pFoundWindow->m_vRealPosition.value();
|
||||
surfacePos = pFoundWindow->m_vRealPosition->value();
|
||||
}
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
||||
surfacePos = pFoundWindow->m_vRealPosition.value();
|
||||
surfacePos = pFoundWindow->m_vRealPosition->value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
// TODO detect click on LS properly
|
||||
if (*PRESIZEONBORDER && !m_bLastFocusOnLS && e.state == WL_POINTER_BUTTON_STATE_PRESSED && (!w || !w->isX11OverrideRedirect())) {
|
||||
if (w && !w->isFullscreen()) {
|
||||
const CBox real = {w->m_vRealPosition.value().x, w->m_vRealPosition.value().y, w->m_vRealSize.value().x, w->m_vRealSize.value().y};
|
||||
const CBox real = {w->m_vRealPosition->value().x, w->m_vRealPosition->value().y, w->m_vRealSize->value().x, w->m_vRealSize->value().y};
|
||||
const CBox grab = {real.x - BORDER_GRAB_AREA, real.y - BORDER_GRAB_AREA, real.width + 2 * BORDER_GRAB_AREA, real.height + 2 * BORDER_GRAB_AREA};
|
||||
|
||||
if ((grab.containsPoint(mouseCoords) && (!real.containsPoint(mouseCoords) || w->isInCurvedCorner(mouseCoords.x, mouseCoords.y))) && !w->hasPopupAt(mouseCoords)) {
|
||||
|
|
|
@ -38,7 +38,7 @@ void CInputManager::beginWorkspaceSwipe() {
|
|||
|
||||
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
||||
for (auto const& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
|
||||
ls->alpha = 1.f;
|
||||
*ls->alpha = 1.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ void CInputManager::endWorkspaceSwipe() {
|
|||
static auto PSWIPENEW = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_create_new");
|
||||
static auto PSWIPEUSER = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_use_r");
|
||||
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
|
||||
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
|
||||
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->getStyle();
|
||||
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
|
||||
|
||||
// commit
|
||||
auto workspaceIDLeft = getWorkspaceIDNameFromString((*PSWIPEUSER ? "r-1" : "m-1")).id;
|
||||
|
@ -86,7 +86,7 @@ void CInputManager::endWorkspaceSwipe() {
|
|||
auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight); // not guaranteed if PSWIPENEW || PSWIPENUMBER
|
||||
auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER
|
||||
|
||||
const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.value();
|
||||
const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->value();
|
||||
const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP;
|
||||
const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP;
|
||||
|
||||
|
@ -97,35 +97,35 @@ void CInputManager::endWorkspaceSwipe() {
|
|||
// revert
|
||||
if (abs(m_sActiveSwipe.delta) < 2) {
|
||||
if (PWORKSPACEL)
|
||||
PWORKSPACEL->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||
PWORKSPACEL->m_vRenderOffset->setValueAndWarp(Vector2D(0, 0));
|
||||
if (PWORKSPACER)
|
||||
PWORKSPACER->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||
PWORKSPACER->m_vRenderOffset->setValueAndWarp(Vector2D(0, 0));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0, 0));
|
||||
} else {
|
||||
if (m_sActiveSwipe.delta < 0) {
|
||||
// to left
|
||||
|
||||
if (PWORKSPACEL) {
|
||||
if (VERTANIMS)
|
||||
PWORKSPACEL->m_vRenderOffset = Vector2D{0.0, -YDISTANCE};
|
||||
*PWORKSPACEL->m_vRenderOffset = Vector2D{0.0, -YDISTANCE};
|
||||
else
|
||||
PWORKSPACEL->m_vRenderOffset = Vector2D{-XDISTANCE, 0.0};
|
||||
*PWORKSPACEL->m_vRenderOffset = Vector2D{-XDISTANCE, 0.0};
|
||||
}
|
||||
} else if (PWORKSPACER) {
|
||||
// to right
|
||||
if (VERTANIMS)
|
||||
PWORKSPACER->m_vRenderOffset = Vector2D{0.0, YDISTANCE};
|
||||
*PWORKSPACER->m_vRenderOffset = Vector2D{0.0, YDISTANCE};
|
||||
else
|
||||
PWORKSPACER->m_vRenderOffset = Vector2D{XDISTANCE, 0.0};
|
||||
*PWORKSPACER->m_vRenderOffset = Vector2D{XDISTANCE, 0.0};
|
||||
}
|
||||
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D();
|
||||
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D();
|
||||
}
|
||||
|
||||
pSwitchedTo = m_sActiveSwipe.pWorkspaceBegin;
|
||||
} else if (m_sActiveSwipe.delta < 0) {
|
||||
// switch to left
|
||||
const auto RENDEROFFSET = PWORKSPACEL ? PWORKSPACEL->m_vRenderOffset.value() : Vector2D();
|
||||
const auto RENDEROFFSET = PWORKSPACEL ? PWORKSPACEL->m_vRenderOffset->value() : Vector2D();
|
||||
|
||||
if (PWORKSPACEL)
|
||||
m_sActiveSwipe.pMonitor->changeWorkspace(workspaceIDLeft);
|
||||
|
@ -134,15 +134,15 @@ void CInputManager::endWorkspaceSwipe() {
|
|||
PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft);
|
||||
}
|
||||
|
||||
PWORKSPACEL->m_vRenderOffset.setValue(RENDEROFFSET);
|
||||
PWORKSPACEL->m_fAlpha.setValueAndWarp(1.f);
|
||||
PWORKSPACEL->m_vRenderOffset->setValue(RENDEROFFSET);
|
||||
PWORKSPACEL->m_fAlpha->setValueAndWarp(1.f);
|
||||
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValue(RENDEROFFSETMIDDLE);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValue(RENDEROFFSETMIDDLE);
|
||||
if (VERTANIMS)
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0.0, YDISTANCE);
|
||||
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0.0, YDISTANCE);
|
||||
else
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(XDISTANCE, 0.0);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(1.f);
|
||||
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(XDISTANCE, 0.0);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha->setValueAndWarp(1.f);
|
||||
|
||||
g_pInputManager->unconstrainMouse();
|
||||
|
||||
|
@ -151,7 +151,7 @@ void CInputManager::endWorkspaceSwipe() {
|
|||
pSwitchedTo = PWORKSPACEL;
|
||||
} else {
|
||||
// switch to right
|
||||
const auto RENDEROFFSET = PWORKSPACER ? PWORKSPACER->m_vRenderOffset.value() : Vector2D();
|
||||
const auto RENDEROFFSET = PWORKSPACER ? PWORKSPACER->m_vRenderOffset->value() : Vector2D();
|
||||
|
||||
if (PWORKSPACER)
|
||||
m_sActiveSwipe.pMonitor->changeWorkspace(workspaceIDRight);
|
||||
|
@ -160,15 +160,15 @@ void CInputManager::endWorkspaceSwipe() {
|
|||
PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight);
|
||||
}
|
||||
|
||||
PWORKSPACER->m_vRenderOffset.setValue(RENDEROFFSET);
|
||||
PWORKSPACER->m_fAlpha.setValueAndWarp(1.f);
|
||||
PWORKSPACER->m_vRenderOffset->setValue(RENDEROFFSET);
|
||||
PWORKSPACER->m_fAlpha->setValueAndWarp(1.f);
|
||||
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValue(RENDEROFFSETMIDDLE);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValue(RENDEROFFSETMIDDLE);
|
||||
if (VERTANIMS)
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0.0, -YDISTANCE);
|
||||
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0.0, -YDISTANCE);
|
||||
else
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(-XDISTANCE, 0.0);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(1.f);
|
||||
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(-XDISTANCE, 0.0);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha->setValueAndWarp(1.f);
|
||||
|
||||
g_pInputManager->unconstrainMouse();
|
||||
|
||||
|
@ -193,7 +193,7 @@ void CInputManager::endWorkspaceSwipe() {
|
|||
|
||||
// apply alpha
|
||||
for (auto const& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
|
||||
ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
|
||||
*ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,30 +202,30 @@ void CInputManager::onSwipeUpdate(IPointer::SSwipeUpdateEvent e) {
|
|||
|
||||
if (!m_sActiveSwipe.pWorkspaceBegin)
|
||||
return;
|
||||
static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_invert");
|
||||
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
|
||||
static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_invert");
|
||||
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->getStyle();
|
||||
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
|
||||
|
||||
const double delta = m_sActiveSwipe.delta + (VERTANIMS ? (*PSWIPEINVR ? -e.delta.y : e.delta.y) : (*PSWIPEINVR ? -e.delta.x : e.delta.x));
|
||||
updateWorkspaceSwipe(delta);
|
||||
}
|
||||
|
||||
void CInputManager::updateWorkspaceSwipe(double delta) {
|
||||
static auto PSWIPEDIST = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_distance");
|
||||
static auto PSWIPENEW = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_create_new");
|
||||
static auto PSWIPEDIRLOCK = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_direction_lock");
|
||||
static auto PSWIPEDIRLOCKTHRESHOLD = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_direction_lock_threshold");
|
||||
static auto PSWIPEFOREVER = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_forever");
|
||||
static auto PSWIPEUSER = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_use_r");
|
||||
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
|
||||
static auto PSWIPEDIST = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_distance");
|
||||
static auto PSWIPENEW = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_create_new");
|
||||
static auto PSWIPEDIRLOCK = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_direction_lock");
|
||||
static auto PSWIPEDIRLOCKTHRESHOLD = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_direction_lock_threshold");
|
||||
static auto PSWIPEFOREVER = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_forever");
|
||||
static auto PSWIPEUSER = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_use_r");
|
||||
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
|
||||
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
|
||||
const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP;
|
||||
const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP;
|
||||
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
|
||||
const double d = m_sActiveSwipe.delta - delta;
|
||||
m_sActiveSwipe.delta = delta;
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
|
||||
const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP;
|
||||
const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP;
|
||||
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->getStyle();
|
||||
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
|
||||
const double d = m_sActiveSwipe.delta - delta;
|
||||
m_sActiveSwipe.delta = delta;
|
||||
|
||||
m_sActiveSwipe.avgSpeed = (m_sActiveSwipe.avgSpeed * m_sActiveSwipe.speedPoints + abs(d)) / (m_sActiveSwipe.speedPoints + 1);
|
||||
m_sActiveSwipe.speedPoints++;
|
||||
|
@ -265,9 +265,9 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
|
|||
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor.lock());
|
||||
|
||||
if (VERTANIMS)
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
|
||||
else
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
|
||||
|
||||
m_sActiveSwipe.pWorkspaceBegin->updateWindowDecos();
|
||||
return;
|
||||
|
@ -277,23 +277,23 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
|
|||
}
|
||||
|
||||
PWORKSPACE->m_bForceRendering = true;
|
||||
PWORKSPACE->m_fAlpha.setValueAndWarp(1.f);
|
||||
PWORKSPACE->m_fAlpha->setValueAndWarp(1.f);
|
||||
|
||||
if (workspaceIDLeft != workspaceIDRight && workspaceIDRight != m_sActiveSwipe.pWorkspaceBegin->m_iID) {
|
||||
const auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight);
|
||||
|
||||
if (PWORKSPACER) {
|
||||
PWORKSPACER->m_bForceRendering = false;
|
||||
PWORKSPACER->m_fAlpha.setValueAndWarp(0.f);
|
||||
PWORKSPACER->m_fAlpha->setValueAndWarp(0.f);
|
||||
}
|
||||
}
|
||||
|
||||
if (VERTANIMS) {
|
||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE - YDISTANCE));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
|
||||
PWORKSPACE->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE - YDISTANCE));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
|
||||
} else {
|
||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE - XDISTANCE, 0.0));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
|
||||
PWORKSPACE->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE - XDISTANCE, 0.0));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
|
||||
}
|
||||
|
||||
PWORKSPACE->updateWindowDecos();
|
||||
|
@ -305,9 +305,9 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
|
|||
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor.lock());
|
||||
|
||||
if (VERTANIMS)
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
|
||||
else
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
|
||||
|
||||
m_sActiveSwipe.pWorkspaceBegin->updateWindowDecos();
|
||||
return;
|
||||
|
@ -317,23 +317,23 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
|
|||
}
|
||||
|
||||
PWORKSPACE->m_bForceRendering = true;
|
||||
PWORKSPACE->m_fAlpha.setValueAndWarp(1.f);
|
||||
PWORKSPACE->m_fAlpha->setValueAndWarp(1.f);
|
||||
|
||||
if (workspaceIDLeft != workspaceIDRight && workspaceIDLeft != m_sActiveSwipe.pWorkspaceBegin->m_iID) {
|
||||
const auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft);
|
||||
|
||||
if (PWORKSPACEL) {
|
||||
PWORKSPACEL->m_bForceRendering = false;
|
||||
PWORKSPACEL->m_fAlpha.setValueAndWarp(0.f);
|
||||
PWORKSPACEL->m_fAlpha->setValueAndWarp(0.f);
|
||||
}
|
||||
}
|
||||
|
||||
if (VERTANIMS) {
|
||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE + YDISTANCE));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
|
||||
PWORKSPACE->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE + YDISTANCE));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
|
||||
} else {
|
||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE + XDISTANCE, 0.0));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
|
||||
PWORKSPACE->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE + XDISTANCE, 0.0));
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
|
||||
}
|
||||
|
||||
PWORKSPACE->updateWindowDecos();
|
||||
|
|
|
@ -69,7 +69,7 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
|
|||
|
||||
// yes, this technically ignores any regions set by the app. Too bad!
|
||||
if (LASTHLSURFACE->getWindow())
|
||||
local = tool->absolutePos * LASTHLSURFACE->getWindow()->m_vRealSize.goal();
|
||||
local = tool->absolutePos * LASTHLSURFACE->getWindow()->m_vRealSize->goal();
|
||||
else
|
||||
local = tool->absolutePos * BOX->size();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../devices/ITouch.hpp"
|
||||
#include "../SeatManager.hpp"
|
||||
#include "managers/AnimationManager.hpp"
|
||||
|
||||
void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
||||
m_bLastInputTouch = true;
|
||||
|
@ -36,9 +37,9 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
|||
return;
|
||||
// TODO: Don't swipe if you touched a floating window.
|
||||
} else if (*PSWIPETOUCH && (m_pFoundLSToFocus.expired() || m_pFoundLSToFocus->layer <= 1)) {
|
||||
const auto PWORKSPACE = PMONITOR->activeWorkspace;
|
||||
const bool VERTANIMS = PWORKSPACE->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
||||
PWORKSPACE->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
|
||||
const auto PWORKSPACE = PMONITOR->activeWorkspace;
|
||||
const auto STYLE = PWORKSPACE->m_vRenderOffset->getStyle();
|
||||
const bool VERTANIMS = STYLE == "slidevert" || STYLE.starts_with("slidefadevert");
|
||||
const double TARGETLEFT = ((VERTANIMS ? gapsOut.top : gapsOut.left) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->vecSize.y : PMONITOR->vecSize.x);
|
||||
const double TARGETRIGHT = 1 - (((VERTANIMS ? gapsOut.bottom : gapsOut.right) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->vecSize.y : PMONITOR->vecSize.x));
|
||||
const double POSITION = (VERTANIMS ? e.pos.y : e.pos.x);
|
||||
|
@ -62,8 +63,8 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
|||
|
||||
if (!m_sTouchData.touchFocusWindow.expired()) {
|
||||
if (m_sTouchData.touchFocusWindow->m_bIsX11) {
|
||||
local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_vRealPosition.goal()) * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy;
|
||||
m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow->m_vRealPosition.goal();
|
||||
local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_vRealPosition->goal()) * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy;
|
||||
m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow->m_vRealPosition->goal();
|
||||
} else {
|
||||
g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow.lock(), local);
|
||||
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
|
||||
|
@ -101,8 +102,9 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
|
|||
// Do nothing if this is using a different finger.
|
||||
if (e.touchID != m_sActiveSwipe.touch_id)
|
||||
return;
|
||||
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
|
||||
|
||||
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->getStyle();
|
||||
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
|
||||
static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch_invert");
|
||||
static auto PSWIPEDIST = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_distance");
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../render/Renderer.hpp"
|
||||
#include "core/Output.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "managers/AnimationManager.hpp"
|
||||
|
||||
CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_) : resource(resource_) {
|
||||
if (!good())
|
||||
|
@ -92,8 +93,7 @@ bool CHyprlandCTMControlProtocol::isCTMAnimationEnabled() {
|
|||
}
|
||||
|
||||
CHyprlandCTMControlProtocol::SCTMData::SCTMData() {
|
||||
progress.create(g_pConfigManager->getAnimationPropertyConfig("__internal_fadeCTM"), AVARDAMAGE_NONE);
|
||||
progress.setValueAndWarp(0.F);
|
||||
g_pAnimationManager->createAnimation(0.f, progress, g_pConfigManager->getAnimationPropertyConfig("__internal_fadeCTM"), AVARDAMAGE_NONE);
|
||||
}
|
||||
|
||||
void CHyprlandCTMControlProtocol::setCTM(PHLMONITOR monitor, const Mat3x3& ctm) {
|
||||
|
@ -112,18 +112,18 @@ void CHyprlandCTMControlProtocol::setCTM(PHLMONITOR monitor, const Mat3x3& ctm)
|
|||
data->ctmFrom = data->ctmTo;
|
||||
data->ctmTo = ctm;
|
||||
|
||||
data->progress.setValueAndWarp(0.F);
|
||||
data->progress = 1.F;
|
||||
data->progress->setValueAndWarp(0.F);
|
||||
*data->progress = 1.F;
|
||||
|
||||
monitor->setCTM(data->ctmFrom);
|
||||
|
||||
data->progress.setUpdateCallback([monitor = PHLMONITORREF{monitor}, this](void* self) {
|
||||
data->progress->setUpdateCallback([monitor = PHLMONITORREF{monitor}, this](auto) {
|
||||
if (!monitor || !m_mCTMDatas.contains(monitor))
|
||||
return;
|
||||
auto& data = m_mCTMDatas.at(monitor);
|
||||
const auto from = data->ctmFrom.getMatrix();
|
||||
const auto to = data->ctmTo.getMatrix();
|
||||
const auto PROGRESS = data->progress.getPercent();
|
||||
const auto PROGRESS = data->progress->getPercent();
|
||||
|
||||
static const auto lerp = [](const float one, const float two, const float progress) -> float { return one + (two - one) * progress; };
|
||||
|
||||
|
@ -135,7 +135,7 @@ void CHyprlandCTMControlProtocol::setCTM(PHLMONITOR monitor, const Mat3x3& ctm)
|
|||
monitor->setCTM(mtx);
|
||||
});
|
||||
|
||||
data->progress.setCallbackOnEnd([monitor = PHLMONITORREF{monitor}, this](void* self) {
|
||||
data->progress->setCallbackOnEnd([monitor = PHLMONITORREF{monitor}, this](auto) {
|
||||
if (!monitor || !m_mCTMDatas.contains(monitor)) {
|
||||
monitor->setCTM(Mat3x3::identity());
|
||||
return;
|
||||
|
|
|
@ -42,8 +42,8 @@ class CHyprlandCTMControlProtocol : public IWaylandProtocol {
|
|||
//
|
||||
struct SCTMData {
|
||||
SCTMData();
|
||||
Mat3x3 ctmFrom = Mat3x3::identity(), ctmTo = Mat3x3::identity();
|
||||
CAnimatedVariable<float> progress;
|
||||
Mat3x3 ctmFrom = Mat3x3::identity(), ctmTo = Mat3x3::identity();
|
||||
PHLANIMVAR<float> progress;
|
||||
};
|
||||
std::map<PHLMONITORREF, std::unique_ptr<SCTMData>> m_mCTMDatas;
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
|
|||
|
||||
dmabufFormat = PMONITOR->output->state->state().drmFormat;
|
||||
|
||||
box = {0, 0, (int)(pWindow->m_vRealSize.value().x * PMONITOR->scale), (int)(pWindow->m_vRealSize.value().y * PMONITOR->scale)};
|
||||
box = {0, 0, (int)(pWindow->m_vRealSize->value().x * PMONITOR->scale), (int)(pWindow->m_vRealSize->value().y * PMONITOR->scale)};
|
||||
|
||||
box.transform(wlTransformToHyprutils(PMONITOR->transform), PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y).round();
|
||||
|
||||
|
@ -263,7 +263,7 @@ bool CToplevelExportFrame::copyShm(timespec* now) {
|
|||
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
||||
|
||||
if (overlayCursor)
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition.value());
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition->value());
|
||||
|
||||
const auto PFORMAT = NFormatUtils::getPixelFormatFromDRM(shm.format);
|
||||
if (!PFORMAT) {
|
||||
|
@ -315,7 +315,7 @@ bool CToplevelExportFrame::copyDmabuf(timespec* now) {
|
|||
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
||||
|
||||
if (overlayCursor)
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition.value());
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition->value());
|
||||
|
||||
g_pHyprOpenGL->m_RenderData.blockScreenShader = true;
|
||||
g_pHyprRenderer->endRender();
|
||||
|
@ -386,7 +386,7 @@ void CToplevelExportProtocol::onOutputCommit(PHLMONITOR pMonitor) {
|
|||
if (pMonitor != PWINDOW->m_pMonitor.lock())
|
||||
continue;
|
||||
|
||||
CBox geometry = {PWINDOW->m_vRealPosition.value().x, PWINDOW->m_vRealPosition.value().y, PWINDOW->m_vRealSize.value().x, PWINDOW->m_vRealSize.value().y};
|
||||
CBox geometry = {PWINDOW->m_vRealPosition->value().x, PWINDOW->m_vRealPosition->value().y, PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealSize->value().y};
|
||||
|
||||
if (geometry.intersection({pMonitor->vecPosition, pMonitor->vecSize}).empty())
|
||||
continue;
|
||||
|
|
|
@ -713,7 +713,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(PHLMONITOR pMonitor) {
|
|||
if (!ws->m_bIsSpecialWorkspace || ws->m_pMonitor != pMonitor)
|
||||
continue;
|
||||
|
||||
if (ws->m_fAlpha.value() == 0)
|
||||
if (ws->m_fAlpha->value() == 0)
|
||||
continue;
|
||||
|
||||
return true;
|
||||
|
@ -1517,7 +1517,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, CBox* pB
|
|||
|
||||
if (allowDim && m_RenderData.currentWindow) {
|
||||
glUniform1i(shader->applyTint, 1);
|
||||
const auto DIM = m_RenderData.currentWindow->m_fDimPercent.value();
|
||||
const auto DIM = m_RenderData.currentWindow->m_fDimPercent->value();
|
||||
glUniform3f(shader->tint, 1.f - DIM, 1.f - DIM, 1.f - DIM);
|
||||
} else {
|
||||
glUniform1i(shader->applyTint, 0);
|
||||
|
@ -1931,7 +1931,7 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
|
|||
const auto PSURFACE = pWindow->m_pWLSurface->resource();
|
||||
|
||||
const auto PWORKSPACE = pWindow->m_pWorkspace;
|
||||
const float A = pWindow->m_fAlpha.value() * pWindow->m_fActiveInactiveAlpha.value() * PWORKSPACE->m_fAlpha.value();
|
||||
const float A = pWindow->m_fAlpha->value() * pWindow->m_fActiveInactiveAlpha->value() * PWORKSPACE->m_fAlpha->value();
|
||||
|
||||
if (A >= 1.f) {
|
||||
// if (PSURFACE->opaque)
|
||||
|
@ -1969,7 +1969,7 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
|
|||
if (!ls->layerSurface || ls->xray != 1)
|
||||
continue;
|
||||
|
||||
// if (ls->layerSurface->surface->opaque && ls->alpha.value() >= 1.f)
|
||||
// if (ls->layerSurface->surface->opaque && ls->alpha->value() >= 1.f)
|
||||
// continue;
|
||||
|
||||
hasWindows = true;
|
||||
|
|
|
@ -172,21 +172,21 @@ bool CHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor) {
|
|||
return true;
|
||||
|
||||
// if the window is being moved to a workspace that is not invisible, and the alpha is > 0.F, render it.
|
||||
if (pWindow->m_iMonitorMovedFrom != -1 && pWindow->m_fMovingToWorkspaceAlpha.isBeingAnimated() && pWindow->m_fMovingToWorkspaceAlpha.value() > 0.F && pWindow->m_pWorkspace &&
|
||||
if (pWindow->m_iMonitorMovedFrom != -1 && pWindow->m_fMovingToWorkspaceAlpha->isBeingAnimated() && pWindow->m_fMovingToWorkspaceAlpha->value() > 0.F && pWindow->m_pWorkspace &&
|
||||
!pWindow->m_pWorkspace->isVisible())
|
||||
return true;
|
||||
|
||||
const auto PWINDOWWORKSPACE = pWindow->m_pWorkspace;
|
||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_pMonitor == pMonitor) {
|
||||
if (PWINDOWWORKSPACE->m_vRenderOffset.isBeingAnimated() || PWINDOWWORKSPACE->m_fAlpha.isBeingAnimated() || PWINDOWWORKSPACE->m_bForceRendering)
|
||||
if (PWINDOWWORKSPACE->m_vRenderOffset->isBeingAnimated() || PWINDOWWORKSPACE->m_fAlpha->isBeingAnimated() || PWINDOWWORKSPACE->m_bForceRendering)
|
||||
return true;
|
||||
|
||||
// if hidden behind fullscreen
|
||||
if (PWINDOWWORKSPACE->m_bHasFullscreenWindow && !pWindow->isFullscreen() && (!pWindow->m_bIsFloating || !pWindow->m_bCreatedOverFullscreen) &&
|
||||
pWindow->m_fAlpha.value() == 0)
|
||||
pWindow->m_fAlpha->value() == 0)
|
||||
return false;
|
||||
|
||||
if (!PWINDOWWORKSPACE->m_vRenderOffset.isBeingAnimated() && !PWINDOWWORKSPACE->m_fAlpha.isBeingAnimated() && !PWINDOWWORKSPACE->isVisible())
|
||||
if (!PWINDOWWORKSPACE->m_vRenderOffset->isBeingAnimated() && !PWINDOWWORKSPACE->m_fAlpha->isBeingAnimated() && !PWINDOWWORKSPACE->isVisible())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -204,17 +204,17 @@ bool CHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor) {
|
|||
return true;
|
||||
|
||||
// if window is tiled and it's flying in, don't render on other mons (for slide)
|
||||
if (!pWindow->m_bIsFloating && pWindow->m_vRealPosition.isBeingAnimated() && pWindow->m_bAnimatingIn && pWindow->m_pMonitor != pMonitor)
|
||||
if (!pWindow->m_bIsFloating && pWindow->m_vRealPosition->isBeingAnimated() && pWindow->m_bAnimatingIn && pWindow->m_pMonitor != pMonitor)
|
||||
return false;
|
||||
|
||||
if (pWindow->m_vRealPosition.isBeingAnimated()) {
|
||||
if (PWINDOWWORKSPACE && !PWINDOWWORKSPACE->m_bIsSpecialWorkspace && PWINDOWWORKSPACE->m_vRenderOffset.isBeingAnimated())
|
||||
if (pWindow->m_vRealPosition->isBeingAnimated()) {
|
||||
if (PWINDOWWORKSPACE && !PWINDOWWORKSPACE->m_bIsSpecialWorkspace && PWINDOWWORKSPACE->m_vRenderOffset->isBeingAnimated())
|
||||
return false;
|
||||
// render window if window and monitor intersect
|
||||
// (when moving out of or through a monitor)
|
||||
CBox windowBox = pWindow->getFullWindowBoundingBox();
|
||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_vRenderOffset.isBeingAnimated())
|
||||
windowBox.translate(PWINDOWWORKSPACE->m_vRenderOffset.value());
|
||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_vRenderOffset->isBeingAnimated())
|
||||
windowBox.translate(PWINDOWWORKSPACE->m_vRenderOffset->value());
|
||||
windowBox.translate(pWindow->m_vFloatingOffset);
|
||||
|
||||
const CBox monitorBox = {pMonitor->vecPosition, pMonitor->vecSize};
|
||||
|
@ -242,7 +242,7 @@ bool CHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow) {
|
|||
return true;
|
||||
|
||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
||||
if (PWORKSPACE && PWORKSPACE->m_pMonitor == m && (PWORKSPACE->m_vRenderOffset.isBeingAnimated() || PWORKSPACE->m_fAlpha.isBeingAnimated()))
|
||||
if (PWORKSPACE && PWORKSPACE->m_pMonitor == m && (PWORKSPACE->m_vRenderOffset->isBeingAnimated() || PWORKSPACE->m_fAlpha->isBeingAnimated()))
|
||||
return true;
|
||||
|
||||
if (m->activeSpecialWorkspace && pWindow->onSpecialWorkspace())
|
||||
|
@ -262,7 +262,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR
|
|||
if (!shouldRenderWindow(w, pMonitor))
|
||||
continue;
|
||||
|
||||
if (w->m_fAlpha.value() == 0.f)
|
||||
if (w->m_fAlpha->value() == 0.f)
|
||||
continue;
|
||||
|
||||
if (w->isFullscreen() || w->m_bIsFloating)
|
||||
|
@ -279,7 +279,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR
|
|||
if (!shouldRenderWindow(w, pMonitor))
|
||||
continue;
|
||||
|
||||
if (w->m_fAlpha.value() == 0.f)
|
||||
if (w->m_fAlpha->value() == 0.f)
|
||||
continue;
|
||||
|
||||
if (w->isFullscreen() || !w->m_bIsFloating)
|
||||
|
@ -299,7 +299,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR
|
|||
const auto PWORKSPACE = w->m_pWorkspace;
|
||||
|
||||
if (w->m_pWorkspace != pWorkspace || !w->isFullscreen()) {
|
||||
if (!(PWORKSPACE && (PWORKSPACE->m_vRenderOffset.isBeingAnimated() || PWORKSPACE->m_fAlpha.isBeingAnimated() || PWORKSPACE->m_bForceRendering)))
|
||||
if (!(PWORKSPACE && (PWORKSPACE->m_vRenderOffset->isBeingAnimated() || PWORKSPACE->m_fAlpha->isBeingAnimated() || PWORKSPACE->m_bForceRendering)))
|
||||
continue;
|
||||
|
||||
if (w->m_pMonitor != pMonitor)
|
||||
|
@ -432,12 +432,12 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, timespe
|
|||
TRACY_GPU_ZONE("RenderWindow");
|
||||
|
||||
const auto PWORKSPACE = pWindow->m_pWorkspace;
|
||||
const auto REALPOS = pWindow->m_vRealPosition.value() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.value());
|
||||
const auto REALPOS = pWindow->m_vRealPosition->value() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset->value());
|
||||
static auto PDIMAROUND = CConfigValue<Hyprlang::FLOAT>("decoration:dim_around");
|
||||
static auto PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
|
||||
|
||||
CSurfacePassElement::SRenderData renderdata = {pMonitor, time};
|
||||
CBox textureBox = {REALPOS.x, REALPOS.y, std::max(pWindow->m_vRealSize.value().x, 5.0), std::max(pWindow->m_vRealSize.value().y, 5.0)};
|
||||
CBox textureBox = {REALPOS.x, REALPOS.y, std::max(pWindow->m_vRealSize->value().x, 5.0), std::max(pWindow->m_vRealSize->value().y, 5.0)};
|
||||
|
||||
renderdata.pos.x = textureBox.x;
|
||||
renderdata.pos.y = textureBox.y;
|
||||
|
@ -458,9 +458,9 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, timespe
|
|||
|
||||
renderdata.surface = pWindow->m_pWLSurface->resource();
|
||||
renderdata.dontRound = pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN) || pWindow->m_sWindowData.noRounding.valueOrDefault();
|
||||
renderdata.fadeAlpha = pWindow->m_fAlpha.value() * (pWindow->m_bPinned || USE_WORKSPACE_FADE_ALPHA ? 1.f : PWORKSPACE->m_fAlpha.value()) *
|
||||
(USE_WORKSPACE_FADE_ALPHA ? pWindow->m_fMovingToWorkspaceAlpha.value() : 1.F) * pWindow->m_fMovingFromWorkspaceAlpha.value();
|
||||
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.value();
|
||||
renderdata.fadeAlpha = pWindow->m_fAlpha->value() * (pWindow->m_bPinned || USE_WORKSPACE_FADE_ALPHA ? 1.f : PWORKSPACE->m_fAlpha->value()) *
|
||||
(USE_WORKSPACE_FADE_ALPHA ? pWindow->m_fMovingToWorkspaceAlpha->value() : 1.F) * pWindow->m_fMovingFromWorkspaceAlpha->value();
|
||||
renderdata.alpha = pWindow->m_fActiveInactiveAlpha->value();
|
||||
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && !pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN);
|
||||
renderdata.rounding = ignoreAllGeometry || renderdata.dontRound ? 0 : pWindow->rounding() * pMonitor->scale;
|
||||
renderdata.roundingPower = ignoreAllGeometry || renderdata.dontRound ? 2.0f : pWindow->roundingPower();
|
||||
|
@ -492,9 +492,9 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, timespe
|
|||
renderdata.pos.y += pWindow->m_vFloatingOffset.y;
|
||||
|
||||
// if window is floating and we have a slide animation, clip it to its full bb
|
||||
if (!ignorePosition && pWindow->m_bIsFloating && !pWindow->isFullscreen() && PWORKSPACE->m_vRenderOffset.isBeingAnimated() && !pWindow->m_bPinned) {
|
||||
if (!ignorePosition && pWindow->m_bIsFloating && !pWindow->isFullscreen() && PWORKSPACE->m_vRenderOffset->isBeingAnimated() && !pWindow->m_bPinned) {
|
||||
CRegion rg =
|
||||
pWindow->getFullWindowBoundingBox().translate(-pMonitor->vecPosition + PWORKSPACE->m_vRenderOffset.value() + pWindow->m_vFloatingOffset).scale(pMonitor->scale);
|
||||
pWindow->getFullWindowBoundingBox().translate(-pMonitor->vecPosition + PWORKSPACE->m_vRenderOffset->value() + pWindow->m_vFloatingOffset).scale(pMonitor->scale);
|
||||
renderdata.clipBox = rg.getExtents();
|
||||
}
|
||||
|
||||
|
@ -657,7 +657,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, timespec* tim
|
|||
if (*PDIMAROUND && pLayer->dimAround && !m_bRenderingSnapshot && !popups) {
|
||||
CRectPassElement::SRectData data;
|
||||
data.box = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y};
|
||||
data.color = CHyprColor(0, 0, 0, *PDIMAROUND * pLayer->alpha.value());
|
||||
data.color = CHyprColor(0, 0, 0, *PDIMAROUND * pLayer->alpha->value());
|
||||
m_sRenderPass.add(makeShared<CRectPassElement>(data));
|
||||
}
|
||||
|
||||
|
@ -671,11 +671,11 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, timespec* tim
|
|||
|
||||
TRACY_GPU_ZONE("RenderLayer");
|
||||
|
||||
const auto REALPOS = pLayer->realPosition.value();
|
||||
const auto REALSIZ = pLayer->realSize.value();
|
||||
const auto REALPOS = pLayer->realPosition->value();
|
||||
const auto REALSIZ = pLayer->realSize->value();
|
||||
|
||||
CSurfacePassElement::SRenderData renderdata = {pMonitor, time, REALPOS};
|
||||
renderdata.fadeAlpha = pLayer->alpha.value();
|
||||
renderdata.fadeAlpha = pLayer->alpha->value();
|
||||
renderdata.blur = pLayer->forceBlur && *PBLUR;
|
||||
renderdata.surface = pLayer->surface->resource();
|
||||
renderdata.decorate = false;
|
||||
|
@ -866,8 +866,8 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA
|
|||
|
||||
// and then special
|
||||
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
|
||||
if (ws->m_pMonitor == pMonitor && ws->m_fAlpha.value() > 0.f && ws->m_bIsSpecialWorkspace) {
|
||||
const auto SPECIALANIMPROGRS = ws->m_vRenderOffset.isBeingAnimated() ? ws->m_vRenderOffset.getCurveValue() : ws->m_fAlpha.getCurveValue();
|
||||
if (ws->m_pMonitor == pMonitor && ws->m_fAlpha->value() > 0.f && ws->m_bIsSpecialWorkspace) {
|
||||
const auto SPECIALANIMPROGRS = ws->m_vRenderOffset->isBeingAnimated() ? ws->m_vRenderOffset->getCurveValue() : ws->m_fAlpha->getCurveValue();
|
||||
const bool ANIMOUT = !pMonitor->activeSpecialWorkspace;
|
||||
|
||||
if (*PDIMSPECIAL != 0.f) {
|
||||
|
@ -894,7 +894,7 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA
|
|||
|
||||
// special
|
||||
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
|
||||
if (ws->m_fAlpha.value() > 0.f && ws->m_bIsSpecialWorkspace) {
|
||||
if (ws->m_fAlpha->value() > 0.f && ws->m_bIsSpecialWorkspace) {
|
||||
if (ws->m_bHasFullscreenWindow)
|
||||
renderWorkspaceWindowsFullscreen(pMonitor, ws, time);
|
||||
else
|
||||
|
@ -1617,8 +1617,8 @@ void CHyprRenderer::arrangeLayerArray(PHLMONITOR pMonitor, const std::vector<PHL
|
|||
if (Vector2D{box.width, box.height} != OLDSIZE)
|
||||
ls->layerSurface->configure(box.size());
|
||||
|
||||
ls->realPosition = box.pos();
|
||||
ls->realSize = box.size();
|
||||
*ls->realPosition = box.pos();
|
||||
*ls->realSize = box.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1727,8 +1727,8 @@ void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) {
|
|||
|
||||
CBox windowBox = pWindow->getFullWindowBoundingBox();
|
||||
const auto PWINDOWWORKSPACE = pWindow->m_pWorkspace;
|
||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_vRenderOffset.isBeingAnimated() && !pWindow->m_bPinned)
|
||||
windowBox.translate(PWINDOWWORKSPACE->m_vRenderOffset.value());
|
||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_vRenderOffset->isBeingAnimated() && !pWindow->m_bPinned)
|
||||
windowBox.translate(PWINDOWWORKSPACE->m_vRenderOffset->value());
|
||||
windowBox.translate(pWindow->m_vFloatingOffset);
|
||||
|
||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
||||
|
@ -1977,8 +1977,8 @@ void CHyprRenderer::recheckSolitaryForMonitor(PHLMONITOR pMonitor) {
|
|||
|
||||
const auto PWORKSPACE = pMonitor->activeWorkspace;
|
||||
|
||||
if (!PWORKSPACE || !PWORKSPACE->m_bHasFullscreenWindow || PROTO::data->dndActive() || pMonitor->activeSpecialWorkspace || PWORKSPACE->m_fAlpha.value() != 1.f ||
|
||||
PWORKSPACE->m_vRenderOffset.value() != Vector2D{})
|
||||
if (!PWORKSPACE || !PWORKSPACE->m_bHasFullscreenWindow || PROTO::data->dndActive() || pMonitor->activeSpecialWorkspace || PWORKSPACE->m_fAlpha->value() != 1.f ||
|
||||
PWORKSPACE->m_vRenderOffset->value() != Vector2D{})
|
||||
return;
|
||||
|
||||
const auto PCANDIDATE = PWORKSPACE->getFullscreenWindow();
|
||||
|
@ -1989,15 +1989,15 @@ void CHyprRenderer::recheckSolitaryForMonitor(PHLMONITOR pMonitor) {
|
|||
if (!PCANDIDATE->opaque())
|
||||
return;
|
||||
|
||||
if (PCANDIDATE->m_vRealSize.value() != pMonitor->vecSize || PCANDIDATE->m_vRealPosition.value() != pMonitor->vecPosition || PCANDIDATE->m_vRealPosition.isBeingAnimated() ||
|
||||
PCANDIDATE->m_vRealSize.isBeingAnimated())
|
||||
if (PCANDIDATE->m_vRealSize->value() != pMonitor->vecSize || PCANDIDATE->m_vRealPosition->value() != pMonitor->vecPosition || PCANDIDATE->m_vRealPosition->isBeingAnimated() ||
|
||||
PCANDIDATE->m_vRealSize->isBeingAnimated())
|
||||
return;
|
||||
|
||||
if (!pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].empty())
|
||||
return;
|
||||
|
||||
for (auto const& topls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||
if (topls->alpha.value() != 0.f)
|
||||
if (topls->alpha->value() != 0.f)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2410,13 +2410,13 @@ void CHyprRenderer::renderSnapshot(PHLWINDOW pWindow) {
|
|||
CBox windowBox;
|
||||
// some mafs to figure out the correct box
|
||||
// the originalClosedPos is relative to the monitor's pos
|
||||
Vector2D scaleXY = Vector2D((PMONITOR->scale * pWindow->m_vRealSize.value().x / (pWindow->m_vOriginalClosedSize.x * PMONITOR->scale)),
|
||||
(PMONITOR->scale * pWindow->m_vRealSize.value().y / (pWindow->m_vOriginalClosedSize.y * PMONITOR->scale)));
|
||||
Vector2D scaleXY = Vector2D((PMONITOR->scale * pWindow->m_vRealSize->value().x / (pWindow->m_vOriginalClosedSize.x * PMONITOR->scale)),
|
||||
(PMONITOR->scale * pWindow->m_vRealSize->value().y / (pWindow->m_vOriginalClosedSize.y * PMONITOR->scale)));
|
||||
|
||||
windowBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x;
|
||||
windowBox.height = PMONITOR->vecTransformedSize.y * scaleXY.y;
|
||||
windowBox.x = ((pWindow->m_vRealPosition.value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - ((pWindow->m_vOriginalClosedPos.x * PMONITOR->scale) * scaleXY.x);
|
||||
windowBox.y = ((pWindow->m_vRealPosition.value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - ((pWindow->m_vOriginalClosedPos.y * PMONITOR->scale) * scaleXY.y);
|
||||
windowBox.x = ((pWindow->m_vRealPosition->value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - ((pWindow->m_vOriginalClosedPos.x * PMONITOR->scale) * scaleXY.x);
|
||||
windowBox.y = ((pWindow->m_vRealPosition->value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - ((pWindow->m_vOriginalClosedPos.y * PMONITOR->scale) * scaleXY.y);
|
||||
|
||||
CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
|
||||
|
||||
|
@ -2425,7 +2425,7 @@ void CHyprRenderer::renderSnapshot(PHLWINDOW pWindow) {
|
|||
CRectPassElement::SRectData data;
|
||||
|
||||
data.box = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y};
|
||||
data.color = CHyprColor(0, 0, 0, *PDIMAROUND * pWindow->m_fAlpha.value());
|
||||
data.color = CHyprColor(0, 0, 0, *PDIMAROUND * pWindow->m_fAlpha->value());
|
||||
|
||||
m_sRenderPass.add(makeShared<CRectPassElement>(data));
|
||||
damageMonitor(PMONITOR);
|
||||
|
@ -2435,7 +2435,7 @@ void CHyprRenderer::renderSnapshot(PHLWINDOW pWindow) {
|
|||
data.flipEndFrame = true;
|
||||
data.tex = FBDATA->getTexture();
|
||||
data.box = windowBox;
|
||||
data.a = pWindow->m_fAlpha.value();
|
||||
data.a = pWindow->m_fAlpha->value();
|
||||
data.damage = fakeDamage;
|
||||
|
||||
m_sRenderPass.add(makeShared<CTexPassElement>(data));
|
||||
|
@ -2455,13 +2455,13 @@ void CHyprRenderer::renderSnapshot(PHLLS pLayer) {
|
|||
CBox layerBox;
|
||||
// some mafs to figure out the correct box
|
||||
// the originalClosedPos is relative to the monitor's pos
|
||||
Vector2D scaleXY = Vector2D((PMONITOR->scale * pLayer->realSize.value().x / (pLayer->geometry.w * PMONITOR->scale)),
|
||||
(PMONITOR->scale * pLayer->realSize.value().y / (pLayer->geometry.h * PMONITOR->scale)));
|
||||
Vector2D scaleXY = Vector2D((PMONITOR->scale * pLayer->realSize->value().x / (pLayer->geometry.w * PMONITOR->scale)),
|
||||
(PMONITOR->scale * pLayer->realSize->value().y / (pLayer->geometry.h * PMONITOR->scale)));
|
||||
|
||||
layerBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x;
|
||||
layerBox.height = PMONITOR->vecTransformedSize.y * scaleXY.y;
|
||||
layerBox.x = ((pLayer->realPosition.value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - (((pLayer->geometry.x - PMONITOR->vecPosition.x) * PMONITOR->scale) * scaleXY.x);
|
||||
layerBox.y = ((pLayer->realPosition.value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - (((pLayer->geometry.y - PMONITOR->vecPosition.y) * PMONITOR->scale) * scaleXY.y);
|
||||
layerBox.x = ((pLayer->realPosition->value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - (((pLayer->geometry.x - PMONITOR->vecPosition.x) * PMONITOR->scale) * scaleXY.x);
|
||||
layerBox.y = ((pLayer->realPosition->value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - (((pLayer->geometry.y - PMONITOR->vecPosition.y) * PMONITOR->scale) * scaleXY.y);
|
||||
|
||||
CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
|
||||
|
||||
|
@ -2469,7 +2469,7 @@ void CHyprRenderer::renderSnapshot(PHLLS pLayer) {
|
|||
data.flipEndFrame = true;
|
||||
data.tex = FBDATA->getTexture();
|
||||
data.box = layerBox;
|
||||
data.a = pLayer->alpha.value();
|
||||
data.a = pLayer->alpha->value();
|
||||
data.damage = fakeDamage;
|
||||
|
||||
m_sRenderPass.add(makeShared<CTexPassElement>(data));
|
||||
|
|
|
@ -43,7 +43,7 @@ CBox CHyprBorderDecoration::assignedBoxGlobal() {
|
|||
if (!PWORKSPACE)
|
||||
return box;
|
||||
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset->value() : Vector2D();
|
||||
return box.translate(WORKSPACEOFFSET);
|
||||
}
|
||||
|
||||
|
@ -60,10 +60,10 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
|||
return;
|
||||
|
||||
auto grad = m_pWindow->m_cRealBorderColor;
|
||||
const bool ANIMATED = m_pWindow->m_fBorderFadeAnimationProgress.isBeingAnimated();
|
||||
const bool ANIMATED = m_pWindow->m_fBorderFadeAnimationProgress->isBeingAnimated();
|
||||
|
||||
if (m_pWindow->m_fBorderAngleAnimationProgress.getConfig()->pValues->internalEnabled) {
|
||||
grad.m_fAngle += m_pWindow->m_fBorderAngleAnimationProgress.value() * M_PI * 2;
|
||||
if (m_pWindow->m_fBorderAngleAnimationProgress->enabled()) {
|
||||
grad.m_fAngle += m_pWindow->m_fBorderAngleAnimationProgress->value() * M_PI * 2;
|
||||
grad.m_fAngle = normalizeAngleRad(grad.m_fAngle);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
|||
data.hasGrad2 = true;
|
||||
data.grad1 = m_pWindow->m_cRealBorderColorPrevious;
|
||||
data.grad2 = grad;
|
||||
data.lerp = m_pWindow->m_fBorderFadeAnimationProgress.value();
|
||||
data.lerp = m_pWindow->m_fBorderFadeAnimationProgress->value();
|
||||
}
|
||||
|
||||
g_pHyprRenderer->m_sRenderPass.add(makeShared<CBorderPassElement>(data));
|
||||
|
@ -117,8 +117,8 @@ void CHyprBorderDecoration::damageEntire() {
|
|||
const auto BORDERSIZE = m_pWindow->getRealBorderSize() + 1;
|
||||
|
||||
const auto PWINDOWWORKSPACE = m_pWindow->m_pWorkspace;
|
||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_vRenderOffset.isBeingAnimated() && !m_pWindow->m_bPinned)
|
||||
surfaceBox.translate(PWINDOWWORKSPACE->m_vRenderOffset.value());
|
||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_vRenderOffset->isBeingAnimated() && !m_pWindow->m_bPinned)
|
||||
surfaceBox.translate(PWINDOWWORKSPACE->m_vRenderOffset->value());
|
||||
surfaceBox.translate(m_pWindow->m_vFloatingOffset);
|
||||
|
||||
CBox surfaceBoxExpandedBorder = surfaceBox;
|
||||
|
|
|
@ -44,13 +44,13 @@ void CHyprDropShadowDecoration::damageEntire() {
|
|||
|
||||
const auto PWINDOW = m_pWindow.lock();
|
||||
|
||||
CBox shadowBox = {PWINDOW->m_vRealPosition.value().x - m_seExtents.topLeft.x, PWINDOW->m_vRealPosition.value().y - m_seExtents.topLeft.y,
|
||||
PWINDOW->m_vRealSize.value().x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
|
||||
PWINDOW->m_vRealSize.value().y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y};
|
||||
CBox shadowBox = {PWINDOW->m_vRealPosition->value().x - m_seExtents.topLeft.x, PWINDOW->m_vRealPosition->value().y - m_seExtents.topLeft.y,
|
||||
PWINDOW->m_vRealSize->value().x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
|
||||
PWINDOW->m_vRealSize->value().y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y};
|
||||
|
||||
const auto PWORKSPACE = PWINDOW->m_pWorkspace;
|
||||
if (PWORKSPACE && PWORKSPACE->m_vRenderOffset.isBeingAnimated() && !PWINDOW->m_bPinned)
|
||||
shadowBox.translate(PWORKSPACE->m_vRenderOffset.value());
|
||||
if (PWORKSPACE && PWORKSPACE->m_vRenderOffset->isBeingAnimated() && !PWINDOW->m_bPinned)
|
||||
shadowBox.translate(PWORKSPACE->m_vRenderOffset->value());
|
||||
shadowBox.translate(PWINDOW->m_vFloatingOffset);
|
||||
|
||||
static auto PSHADOWIGNOREWINDOW = CConfigValue<Hyprlang::INT>("decoration:shadow:ignore_window");
|
||||
|
@ -61,8 +61,8 @@ void CHyprDropShadowDecoration::damageEntire() {
|
|||
CRegion shadowRegion(shadowBox);
|
||||
if (*PSHADOWIGNOREWINDOW) {
|
||||
CBox surfaceBox = PWINDOW->getWindowMainSurfaceBox();
|
||||
if (PWORKSPACE && PWORKSPACE->m_vRenderOffset.isBeingAnimated() && !PWINDOW->m_bPinned)
|
||||
surfaceBox.translate(PWORKSPACE->m_vRenderOffset.value());
|
||||
if (PWORKSPACE && PWORKSPACE->m_vRenderOffset->isBeingAnimated() && !PWINDOW->m_bPinned)
|
||||
surfaceBox.translate(PWORKSPACE->m_vRenderOffset->value());
|
||||
surfaceBox.translate(PWINDOW->m_vFloatingOffset);
|
||||
surfaceBox.expand(-ROUNDINGSIZE);
|
||||
shadowRegion.subtract(CRegion(surfaceBox));
|
||||
|
@ -81,8 +81,8 @@ void CHyprDropShadowDecoration::damageEntire() {
|
|||
void CHyprDropShadowDecoration::updateWindow(PHLWINDOW pWindow) {
|
||||
const auto PWINDOW = m_pWindow.lock();
|
||||
|
||||
m_vLastWindowPos = PWINDOW->m_vRealPosition.value();
|
||||
m_vLastWindowSize = PWINDOW->m_vRealSize.value();
|
||||
m_vLastWindowPos = PWINDOW->m_vRealPosition->value();
|
||||
m_vLastWindowSize = PWINDOW->m_vRealSize->value();
|
||||
|
||||
m_bLastWindowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y};
|
||||
m_bLastWindowBoxWithDecos = g_pDecorationPositioner->getBoxWithIncludedDecos(pWindow);
|
||||
|
@ -101,7 +101,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
if (!validMapped(PWINDOW))
|
||||
return;
|
||||
|
||||
if (PWINDOW->m_cRealShadowColor.value() == CHyprColor(0, 0, 0, 0))
|
||||
if (PWINDOW->m_cRealShadowColor->value() == CHyprColor(0, 0, 0, 0))
|
||||
return; // don't draw invisible shadows
|
||||
|
||||
if (!PWINDOW->m_sWindowData.decorate.valueOrDefault())
|
||||
|
@ -123,7 +123,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
const auto ROUNDINGPOWER = PWINDOW->roundingPower();
|
||||
const auto ROUNDING = ROUNDINGBASE > 0 ? ROUNDINGBASE + PWINDOW->getRealBorderSize() : 0;
|
||||
const auto PWORKSPACE = PWINDOW->m_pWorkspace;
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset->value() : Vector2D();
|
||||
|
||||
// draw the shadow
|
||||
CBox fullBox = m_bLastWindowBoxWithDecos;
|
||||
|
@ -194,7 +194,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
g_pHyprOpenGL->renderRect(&fullBox, CHyprColor(0, 0, 0, 1), 0);
|
||||
|
||||
// render white shadow with the alpha of the shadow color (otherwise we clear with alpha later and shit it to 2 bit)
|
||||
drawShadowInternal(&fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, CHyprColor(1, 1, 1, PWINDOW->m_cRealShadowColor.value().a), a);
|
||||
drawShadowInternal(&fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, CHyprColor(1, 1, 1, PWINDOW->m_cRealShadowColor->value().a), a);
|
||||
|
||||
// render black window box ("clip")
|
||||
g_pHyprOpenGL->renderRect(&windowBox, CHyprColor(0, 0, 0, 1.0), (ROUNDING + 1 /* This fixes small pixel gaps. */) * pMonitor->scale, ROUNDINGPOWER);
|
||||
|
@ -202,7 +202,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
alphaSwapFB.bind();
|
||||
|
||||
// alpha swap just has the shadow color. It will be the "texture" to render.
|
||||
g_pHyprOpenGL->renderRect(&fullBox, PWINDOW->m_cRealShadowColor.value().stripA(), 0);
|
||||
g_pHyprOpenGL->renderRect(&fullBox, PWINDOW->m_cRealShadowColor->value().stripA(), 0);
|
||||
|
||||
LASTFB->bind();
|
||||
|
||||
|
@ -216,7 +216,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
|
||||
g_pHyprOpenGL->m_RenderData.damage = saveDamage;
|
||||
} else
|
||||
drawShadowInternal(&fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, PWINDOW->m_cRealShadowColor.value(), a);
|
||||
drawShadowInternal(&fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, PWINDOW->m_cRealShadowColor->value(), a);
|
||||
|
||||
if (m_seExtents != m_seReportedExtents)
|
||||
g_pDecorationPositioner->repositionDeco(this);
|
||||
|
|
|
@ -390,9 +390,9 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
|
|||
|
||||
// restores the group
|
||||
for (auto it = members.begin(); it != members.end(); ++it) {
|
||||
(*it)->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of group members
|
||||
(*it)->m_vRealSize = pWindowInsertAfter->m_vRealSize.goal(); // match the size of group members
|
||||
(*it)->m_vRealPosition = pWindowInsertAfter->m_vRealPosition.goal(); // match the position of group members
|
||||
(*it)->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of group members
|
||||
*(*it)->m_vRealSize = pWindowInsertAfter->m_vRealSize->goal(); // match the size of group members
|
||||
*(*it)->m_vRealPosition = pWindowInsertAfter->m_vRealPosition->goal(); // match the position of group members
|
||||
if (std::next(it) != members.end())
|
||||
(*it)->m_sGroupData.pNextWindow = *std::next(it);
|
||||
else
|
||||
|
@ -406,7 +406,7 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
|
|||
pDraggedWindow->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of the window
|
||||
|
||||
if (pWindowInsertAfter->m_bIsFloating)
|
||||
g_pXWaylandManager->setWindowSize(pDraggedWindow, pWindowInsertAfter->m_vRealSize.goal()); // match the size of the window
|
||||
g_pXWaylandManager->setWindowSize(pDraggedWindow, pWindowInsertAfter->m_vRealSize->goal()); // match the size of the window
|
||||
|
||||
pWindowInsertAfter->insertWindowToGroup(pDraggedWindow);
|
||||
|
||||
|
@ -515,7 +515,7 @@ CBox CHyprGroupBarDecoration::assignedBoxGlobal() {
|
|||
const auto PWORKSPACE = m_pWindow->m_pWorkspace;
|
||||
|
||||
if (PWORKSPACE && !m_pWindow->m_bPinned)
|
||||
box.translate(PWORKSPACE->m_vRenderOffset.value());
|
||||
box.translate(PWORKSPACE->m_vRenderOffset->value());
|
||||
|
||||
return box;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
|
|||
datas.push_back(getDataFor(wd.get(), pWindow));
|
||||
}
|
||||
|
||||
if (WINDOWDATA->lastWindowSize == pWindow->m_vRealSize.value() /* position not changed */
|
||||
if (WINDOWDATA->lastWindowSize == pWindow->m_vRealSize->value() /* position not changed */
|
||||
&& std::all_of(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(),
|
||||
[pWindow](const auto& data) { return pWindow != data->pWindow.lock() || !data->needsReposition; })
|
||||
/* all window datas are either not for this window or don't need a reposition */
|
||||
|
@ -132,9 +132,9 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
|
|||
)
|
||||
return;
|
||||
|
||||
WINDOWDATA->lastWindowSize = pWindow->m_vRealSize.value();
|
||||
WINDOWDATA->lastWindowSize = pWindow->m_vRealSize->value();
|
||||
WINDOWDATA->needsRecalc = false;
|
||||
const bool EPHEMERAL = pWindow->m_vRealSize.isBeingAnimated();
|
||||
const bool EPHEMERAL = pWindow->m_vRealSize->isBeingAnimated();
|
||||
|
||||
std::sort(datas.begin(), datas.end(), [](const auto& a, const auto& b) { return a->positioningInfo.priority > b->positioningInfo.priority; });
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ void CSurfacePassElement::draw(const CRegion& damage) {
|
|||
const bool MISALIGNEDFSV1 = std::floor(data.pMonitor->scale) != data.pMonitor->scale /* Fractional */ && data.surface->current.scale == 1 /* fs protocol */ &&
|
||||
windowBox.size() != data.surface->current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, data.surface->current.bufferSize.x, 3) &&
|
||||
DELTALESSTHAN(windowBox.height, data.surface->current.bufferSize.y, 3) /* off by one-or-two */ &&
|
||||
(!data.pWindow || (!data.pWindow->m_vRealSize.isBeingAnimated() && !INTERACTIVERESIZEINPROGRESS)) /* not window or not animated/resizing */;
|
||||
(!data.pWindow || (!data.pWindow->m_vRealSize->isBeingAnimated() && !INTERACTIVERESIZEINPROGRESS)) /* not window or not animated/resizing */;
|
||||
|
||||
g_pHyprRenderer->calculateUVForSurface(data.pWindow, data.surface, data.pMonitor->self.lock(), data.mainSurface, windowBox.size(), PROJSIZEUNSCALED, MISALIGNEDFSV1);
|
||||
|
||||
|
@ -148,8 +148,8 @@ CBox CSurfacePassElement::getTexBox() {
|
|||
if (!INTERACTIVERESIZEINPROGRESS) {
|
||||
windowBox.translate(CORRECT);
|
||||
|
||||
windowBox.width = SIZE.x * (PWINDOW->m_vRealSize.value().x / PWINDOW->m_vReportedSize.x);
|
||||
windowBox.height = SIZE.y * (PWINDOW->m_vRealSize.value().y / PWINDOW->m_vReportedSize.y);
|
||||
windowBox.width = SIZE.x * (PWINDOW->m_vRealSize->value().x / PWINDOW->m_vReportedSize.x);
|
||||
windowBox.height = SIZE.y * (PWINDOW->m_vRealSize->value().y / PWINDOW->m_vReportedSize.y);
|
||||
} else {
|
||||
windowBox.width = SIZE.x;
|
||||
windowBox.height = SIZE.y;
|
||||
|
@ -159,10 +159,10 @@ CBox CSurfacePassElement::getTexBox() {
|
|||
} else { // here we clamp to 2, these might be some tiny specks
|
||||
windowBox = {(int)outputX + data.pos.x + data.localPos.x, (int)outputY + data.pos.y + data.localPos.y, std::max((float)data.surface->current.size.x, 2.F),
|
||||
std::max((float)data.surface->current.size.y, 2.F)};
|
||||
if (data.pWindow && data.pWindow->m_vRealSize.isBeingAnimated() && data.surface && !data.mainSurface && data.squishOversized /* subsurface */) {
|
||||
if (data.pWindow && data.pWindow->m_vRealSize->isBeingAnimated() && data.surface && !data.mainSurface && data.squishOversized /* subsurface */) {
|
||||
// adjust subsurfaces to the window
|
||||
windowBox.width = (windowBox.width / data.pWindow->m_vReportedSize.x) * data.pWindow->m_vRealSize.value().x;
|
||||
windowBox.height = (windowBox.height / data.pWindow->m_vReportedSize.y) * data.pWindow->m_vRealSize.value().y;
|
||||
windowBox.width = (windowBox.width / data.pWindow->m_vReportedSize.x) * data.pWindow->m_vRealSize->value().x;
|
||||
windowBox.height = (windowBox.height / data.pWindow->m_vReportedSize.y) * data.pWindow->m_vRealSize->value().y;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue