* snap: add option `border_overlap` and other improvements
I really liked the way borders used to overlap when snapping and how
only the window's main surface would snap to the monitor, so I would
like to bring that behavior back, but in the form of a config option.
Other improvements include:
- reduced the number of snap functions from 4 down to 2, and only
one ever gets called at any given time.
- border size should not be added to gap size. It seemed like the
right thing to do at the time, but it makes snapping feel way
stronger than it actually should.
- all const variables have been given the all-caps naming convention.
- to avoid excessive casting, border size is declared as a double.
- to avoid excessive x + w, y + h calculations. I'm using a struct
called Range and working only with start and end values until the
very end of the function.
- check for both monitor snapping as well as reserved monitor space
snapping in a relatively efficient way.
* snap: always border-align for corners and reserved monitor space
We probably don't want to treat reserved monitor space as if it were just
a smaller monitor. Instead, it should be treated more like a borderless
window, which means our window's border should never encroach upon it.
* add snapping to floating windows
Works for both moving and resizing of windows.
It comes with 3 options:
`general:snap:enabled` - whether it's enabled, off by default
`general:snap:window_gap` - minimum gap in pixels between windows before
snapping. Setting to 0 effectively turns off this method of snapping.
`general:snap:monitor_gap` - minimum gap in pixels between window and
monitor edges before snapping. Again, setting it to 0 effectively turns
it off.
* snap: add more ignore criteria and change if clause into a guard
* snap: refactor code
* snap: new refactoring approach and account for border size
* snap: do corner snapping after all edge snapping is done
The approach of performing corner snaps after each individual edge snap
results in far fewer scenarios where snapping can occur.
After trying it out for a while, I found that I prefer an approach
that's more prone to snapping.
* snap: combine snapWindows and snapMonitor into a single function
* snap: add forced aspect ratio functionality
* snap: avoid directly referring to border_size config value
* snap: address vaxerski feedback
- add new line between functions
- use std::function typedef for SnapFn and make snap functions static
- avoid uninitialized variable declarations.
- change ignore condition m_bIsX11 to isX11OverrideRedirect()
- use braces for CBox and Vector2D declarations.
- add SNAP_INVALID to eSnapEdge enum
- use bitshift notation for eSnapEdge and eRectCorner
- make performSnap a non-member function.
* snap: add corner-snapping to forced aspect ratio mode
ref https://github.com/hyprwm/xdg-desktop-portal-hyprland/issues/251
if the XDG_CURRENT_DESKTOP is externally managed (e.g. DE, DM, etc) Hyprland will not overwrite it. In those cases, if that's undesired, portals and other apps depending on it might break.
* config: add xwayland enabled option to config
* xwayland: use DISPLAY env variable for enable/disable of new launches
* xwayland: close X11 windows when turning of XWayland
* clang: format fix
* config: add better description for xwayland:enabled
* xwayland: close X11 windows on disable without crashes
* xwayland: better method of informing CXWayland if xwayland enabled
* xwayland: prevent closing non-xwayland windows on disable
* misc: loop formatting