diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-07-28 13:28:43 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-07-28 13:28:43 +0200 |
| commit | 920fdd6bff0f78d6f7f5de6167a23af303e00e57 (patch) | |
| tree | ff28eaba4ee9c6647e0a3b8ac1fab1cb8e14fbf3 /src/events/Windows.cpp | |
| parent | 9dd17a4be6a719ab0cc501f63cf07cfd066f3ef8 (diff) | |
Animation config rework
Diffstat (limited to 'src/events/Windows.cpp')
| -rw-r--r-- | src/events/Windows.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 2a553fbd..91840d3f 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -29,6 +29,20 @@ void addViewCoords(void* pWindow, int* x, int* y) { } } +int setAnimToMove(void* data) { + const auto PWINDOW = (CWindow*)data; + + auto *const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove"); + + if (!g_pCompositor->windowValidMapped(PWINDOW)) + return 0; + + PWINDOW->m_vRealPosition.setConfig(PANIMCFG); + PWINDOW->m_vRealSize.setConfig(PANIMCFG); + + return 0; +} + void Events::listener_mapWindow(void* owner, void* data) { CWindow* PWINDOW = (CWindow*)owner; @@ -44,7 +58,6 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_bReadyToDelete = false; PWINDOW->m_bFadingOut = false; PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW); - PWINDOW->m_fAlpha = 255.f; if (PWINDOW->m_iX11Type == 2) g_pCompositor->moveUnmanagedX11ToWindows(PWINDOW); @@ -271,6 +284,11 @@ void Events::listener_mapWindow(void* owner, void* data) { // do the animation thing g_pAnimationManager->onWindowPostCreateClose(PWINDOW, false); + 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); if (workspaceSilent) { // move the window @@ -343,8 +361,6 @@ void Events::listener_unmapWindow(void* owner, void* data) { g_pCompositor->m_pLastFocus = nullptr; } - PWINDOW->m_fAlpha = 0.f; - PWINDOW->m_bMappedX11 = false; // remove the fullscreen window status from workspace if we closed it @@ -380,7 +396,10 @@ void Events::listener_unmapWindow(void* owner, void* data) { if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in. PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.vec() + 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; // Destroy Foreign Toplevel wlr_foreign_toplevel_handle_v1_destroy(PWINDOW->m_phForeignToplevel); |
