X.A.WindowNavigation: Fix navigation getting stuck

Update left and right navigation to behave correctly even if the
currently saved position is directly on the edge of the focused window.
This makes the L/R behavior consistent with U/D navigation.

How to reproduce the issue on a 16:9 resolution like 1920x1080:

  - configure Grid layout;
  - open 4 terminals;
  - navigate to the top-right terminal;
  - open another terminal;
  - immediately close it;
  - try navigating left from the currently focused top-right terminal;
  - observe navigation being "stuck".
This commit is contained in:
Platon Pronko 2021-11-21 19:52:29 +03:00 committed by slotThe
parent 61c3aff33c
commit ca5841f7fa
2 changed files with 7 additions and 2 deletions

View File

@ -32,6 +32,11 @@
- Flipped how `(^?)`, `(~?)`, and `($?)` work to more accurately - Flipped how `(^?)`, `(~?)`, and `($?)` work to more accurately
reflect how one uses these operators. reflect how one uses these operators.
* `XMonad.Actions.WindowNavigation`
- Fixed navigation getting "stuck" in certain situations for
widescreen resolutions.
## 0.17.0 (October 27, 2021) ## 0.17.0 (October 27, 2021)
### Breaking Changes ### Breaking Changes

View File

@ -209,9 +209,9 @@ inr D (Point px py) (Rectangle rx ry w h) = px >= rx && px < rx + fromIntegral w
py < ry + fromIntegral h py < ry + fromIntegral h
inr U (Point px py) (Rectangle rx ry w _) = px >= rx && px < rx + fromIntegral w && inr U (Point px py) (Rectangle rx ry w _) = px >= rx && px < rx + fromIntegral w &&
py > ry py > ry
inr R (Point px py) (Rectangle rx ry _ h) = px < rx && inr R (Point px py) (Rectangle rx ry w h) = px < rx + fromIntegral w &&
py >= ry && py < ry + fromIntegral h py >= ry && py < ry + fromIntegral h
inr L (Point px py) (Rectangle rx ry w h) = px > rx + fromIntegral w && inr L (Point px py) (Rectangle rx ry _ h) = px > rx &&
py >= ry && py < ry + fromIntegral h py >= ry && py < ry + fromIntegral h
sortby :: Direction2D -> [(a,Rectangle)] -> [(a,Rectangle)] sortby :: Direction2D -> [(a,Rectangle)] -> [(a,Rectangle)]