Skip to content

fix: WM ext does not work when operating focused win from another display#919

Merged
RainyNight9 merged 1 commit intomainfrom
fix/wm_next_display
Oct 13, 2025
Merged

fix: WM ext does not work when operating focused win from another display#919
RainyNight9 merged 1 commit intomainfrom
fix/wm_next_display

Conversation

@SteveLauC
Copy link
Copy Markdown
Member

@SteveLauC SteveLauC commented Oct 11, 2025

This commit fixes a bug that most Window Management extension commands
won't work if you:

  1. operate the focused window from another display
  2. and they are adjacent

To reproduce this:

say you have 2 displays

  1. Put the focused window on a non-main display, maximize the window
  2. Move the mourse to the main display, making it the active display
  3. Launch Coco, then execute the TopHalf command

The focused window will be moved to the main display, while it should
stay in the non-main display.

The root cause of the issue is that the previous implementation of
intersects() didn't handle an edge case correctly, adjavent rectangles
should not be considered overlapping. This commit replaces the buggy
implementation with the CGRectIntersectsRect() function from macOS
core graphics library.

Standards checklist

  • The PR title is descriptive
  • The commit messages are semantic
  • Necessary tests are added
  • Updated the release notes
  • Necessary documents have been added if this is a new feature
  • Performance tests checked, no obvious performance degradation

@SteveLauC SteveLauC force-pushed the fix/wm_next_display branch 3 times, most recently from fa148bc to 5e77454 Compare October 11, 2025 09:11
@SteveLauC SteveLauC changed the title fix: WindowManagement:NextDisplay does not work fix: WM ext does not work when operating focused win from another display Oct 11, 2025
@SteveLauC SteveLauC force-pushed the fix/wm_next_display branch from 5e77454 to 43699b6 Compare October 11, 2025 09:41
…play

This commit fixes a bug that most Window Management extension commands
won't work if you:

1. operate the focused window from another display
2. and they are adjacent

To reproduce this:

say you have 2 displays

1. Put the focused window on a non-main display, maximize the window
2. Move the mourse to the main display, making it the active display
3. Launch Coco, then execute the `TopHalf` command

The focused window will be moved to the main display, while it should
stay in the non-main display.

The root cause of the issue is that the previous implementation of
`intersects()` didn't handle an edge case correctly, adjavent rectangles
should not be considered overlapping. This commit replaces the buggy
implementation with the `CGRectIntersectsRect()` function from macOS
core graphics library.
@SteveLauC SteveLauC force-pushed the fix/wm_next_display branch from 43699b6 to 1175548 Compare October 11, 2025 09:49
@SteveLauC SteveLauC marked this pull request as ready for review October 11, 2025 09:50
@RainyNight9 RainyNight9 merged commit ca71f07 into main Oct 13, 2025
4 checks passed
@RainyNight9 RainyNight9 deleted the fix/wm_next_display branch October 13, 2025 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants