use anim callbacks and don't spam config resets in drag

This commit is contained in:
vaxerski 2022-12-09 15:00:58 +00:00
parent fba03540d5
commit b9812f8bc0
2 changed files with 5 additions and 14 deletions

View file

@ -29,18 +29,12 @@ void addViewCoords(void* pWindow, int* x, int* y) {
} }
} }
int setAnimToMove(void* data) { void setAnimToMove(void* data) {
const auto PWINDOW = (CWindow*)data;
auto *const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove"); auto *const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove");
if (!g_pCompositor->windowValidMapped(PWINDOW)) CAnimatedVariable* animvar = (CAnimatedVariable*)data;
return 0;
PWINDOW->m_vRealPosition.setConfig(PANIMCFG); animvar->setConfig(PANIMCFG);
PWINDOW->m_vRealSize.setConfig(PANIMCFG);
return 0;
} }
void Events::listener_mapWindow(void* owner, void* data) { void Events::listener_mapWindow(void* owner, void* data) {
@ -447,8 +441,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_fAlpha.setValueAndWarp(0.f); PWINDOW->m_fAlpha.setValueAndWarp(0.f);
PWINDOW->m_fAlpha = 255.f; PWINDOW->m_fAlpha = 255.f;
const auto TIMER = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, setAnimToMove, PWINDOW); PWINDOW->m_vRealPosition.setCallbackOnEnd(setAnimToMove);
wl_event_source_timer_update(TIMER, PWINDOW->m_vRealPosition.getDurationLeftMs() + 5); PWINDOW->m_vRealSize.setCallbackOnEnd(setAnimToMove);
if (requestsFullscreen && !PWINDOW->m_bNoFullscreenRequest) { if (requestsFullscreen && !PWINDOW->m_bNoFullscreenRequest) {
// fix fullscreen on requested (basically do a switcheroo) // fix fullscreen on requested (basically do a switcheroo)

View file

@ -139,9 +139,6 @@ void IHyprLayout::onBeginDragWindow() {
g_pInputManager->setCursorImageUntilUnset("hand1"); g_pInputManager->setCursorImageUntilUnset("hand1");
DRAGGINGWINDOW->m_vRealPosition.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
DRAGGINGWINDOW->m_vRealSize.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
DRAGGINGWINDOW->m_bDraggingTiled = false; DRAGGINGWINDOW->m_bDraggingTiled = false;
if (!DRAGGINGWINDOW->m_bIsFloating) { if (!DRAGGINGWINDOW->m_bIsFloating) {