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) {
const auto PWINDOW = (CWindow*)data;
void setAnimToMove(void* data) {
auto *const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove");
if (!g_pCompositor->windowValidMapped(PWINDOW))
return 0;
CAnimatedVariable* animvar = (CAnimatedVariable*)data;
PWINDOW->m_vRealPosition.setConfig(PANIMCFG);
PWINDOW->m_vRealSize.setConfig(PANIMCFG);
return 0;
animvar->setConfig(PANIMCFG);
}
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 = 255.f;
const auto TIMER = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, setAnimToMove, PWINDOW);
wl_event_source_timer_update(TIMER, PWINDOW->m_vRealPosition.getDurationLeftMs() + 5);
PWINDOW->m_vRealPosition.setCallbackOnEnd(setAnimToMove);
PWINDOW->m_vRealSize.setCallbackOnEnd(setAnimToMove);
if (requestsFullscreen && !PWINDOW->m_bNoFullscreenRequest) {
// fix fullscreen on requested (basically do a switcheroo)

View file

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