-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(borders): track window movements + animations
This commit introduces a number of changes to the border manager module to enable borders to track the movements of windows as they are being animated. As part of these changes, the code paths for borders to track user movement of windows have also been overhauled. The biggest conceptual change introduced here is borrowed from @lukeyou05's work on tacky-borders, where the primary event listener of the komorebi process now forwards EVENT_OBJECT_LOCATIONCHANGE and EVENT_OBJECT_DESTROY messages from application windows directly on to their borders. These events are handled directly in the border window callbacks, outside of the main border manager module event processing loop. In order to handle these events more performantly in the border window callbacks, a number of state trackers have been added to the Border struct. When handling EVENT_OBJECT_NAMECHANGE, these values are read directly from the struct, whereas when handling WM_PAINT, which is sent by the system whenever we invalidate a border window, we update the state values on the Border structs from the various atomic configuration variables in the mod.rs file. Another trick I borrowed from tacky-borders is to store a pointer to the Border object alongside a border window whenever it is created with CreateWindowExW, which can be accessed within the callback as GWLP_USERDATA. There is some unfortunate introduction of unsafe code to make this happen, but the callback uses null checks to exit the callback early to ensure (to the best of my ability) that there are no pointer dereferencing issues once we start making border changes in the context of the callback. There are a few other Direct2D related optimizations throughout this commit, mainly avoiding the recreation of objects like brush properties and brushes. Finally, the border_z_order option is now deprecated as the border window is now tracking the z-ordering of the application window it is associated with by default - this should resolve a whole host of subtle border z-ordering issues, especially when dragging windows around using the mouse. This work would not have been possible without the guidance of @lukeyou05, so if you like this feature, please make sure you thank him too!
- Loading branch information
Showing
10 changed files
with
394 additions
and
248 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters