Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(animation): add window animations
Work on this feature was first started by @thearturca in November 2023 before komorebi v0.1.21 in #597 and has undergone numerous revisions to reach the point of this commit. Although this is a single squashed commit, almost all of the heavy lifting for this feature was done by @thearturca, which is where all of the kudos and gratitude should be directed. This commit adds a new static configuration block for animations, where they can be enabled, and have their style, fps and duration set. Corresponding SocketMessages and komorebic cli commands have also been exposed. There are some caveats to the use of this feature, which revolve around the quality of the Windows compositor (it is not very good): * There will be visual artifacts with various apps when animations are taking place - komorebi can't do anything about this as it is a limitation of the Windows compositor * Since komorebi's borders are implemented as independent windows are are not a part of the windows they are drawn around, these borders will be hidden while animations are in progress * If you wish to use borders with this feature, you'll probably better off using BorderImplementation::Windows, which uses the native thin "accent" borders, which are part of the windows they are drawn around, and can be moved with those windows during animations As a result of these and other caveats, this feature will be marked as "experimental" for the foreseeable future and will be off-by-default. Below, a number of now-squashed commits that contributed to the stabilization of this feature are referenced to help with code archeology in the future. fix(animation): Fixed cancelling logic (57e9b2f) Added static animation state manager for tracking "in_progress" and "is_cancelled" states. The idea is not to have states in Animation struct but to keep them in HashMap<hwnd, AnimationState> behind reference (Arc<Mutex<>>). So we each animation frame we have access to state and can cancel animation if we have to. Need review and testings refactor(animation): avoid unwrap (fa6d5bb) fix(animation): Move cancel call to Animation struct (306513f) Only focused window was cancelling its animation because we call cancel in window::set_position and waiting for its cancelling. And because we waiting for cancelling second window is still moving. Second window will stop moving only after the first window. So I moved `cancel` call to Animation struct so its happening in its own thread and doesn't block others animation moves and cancels. refactor(animation): renamed args parameters and variables names (8abb4b9) refactor(animation): inverse if-statement in `window::animate_position` (3de2c6e) There is was a bug when ease function generates `t` greater the `SetWindowPos` function will be called instead of `move_window`. `SetWindowPos` is only for last frame of animation. fix(wm): add shadow rect to `move_window` calls (b58620f) This fixes a bug when windows get shunk during the animation
- Loading branch information