X.Operations: Apply size hints in floatLocation #446
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is hopefully harmless with well-behaved clients and ordinary xmonad configs, and it enables using re-floating to apply size hints to existing windows. The only visible behaviour change I can foresee is that tiled windows (which ignore hints by default, unless X.L.LayoutHints is used) will now snap to size hints whenever they're floated (either via a keybinding or on mouseMoveWindow), whereas previously they'd only do so on mouseResizeWindow.
My use-case for this is the following: when I change fonts in my terminal, it updates its size hints and then sends a ConfigureRequestEvent to change its size to keep the number of rows and columns the same, and it also happens to reset the position to 0, 0. If it's tiled, that request is just ignored and hintsEventHook handles the layout refresh. If it happens to be floating, I want neither the move to 0, 0 nor the window size change to keep rows/colums, so I have a handleEventHook that ignores that ConfigureRequestEvent and just refloats the window, but I need a way to reapply size hints.
I could add a separate function that applies these hints to the floating RationalRect, but that seems like a lossy operation due to the Doubles in there. So I'd probably end up replicating most of the code from floatLocation, and then I might just improve that instead… 🙂
(I'll submit that custom ConfigureRequestEvent-ignoring hook to xmonad-contrib later.)
Checklist
I've read CONTRIBUTING.md
I've confirmed these changes don't belong in xmonad-contrib instead:
see the 3rd paragraph 🙂
I've considered how to best test these changes (property, unit, manually, ...) and concluded:
Making sure this doesn't break anything involves using it with all sorts of X clients. I've been running this for about a week with no trouble, but I haven't run any Steam games or Libreoffices during this time, so it definitely needs more testing.
I updated the
CHANGES.md
file - TODO I don't know what to say, yet.