Skip to content

Commit

Permalink
Fix issue where rebounding occasionally picks the wrong target monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
Crozzers committed Jul 1, 2024
1 parent 90b5dbd commit c473d9f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ def set_pos(self, rect: Rect, placement: Optional[Placement] = None):
offset = dpi_scale(self.get_border_and_shadow_thickness(), target_display_dpi)

# check if Window will fit on the Display it's being moved to. If not, adjust the rect to fit
target_display_rect = self.get_closest_display_rect(rect[:2])
# use center point because top left might be out of bounds due to drop shadow and offset, which may
# lead to `MONITOR_DEFAULTTONEAREST` picking the wrong display
target_display_rect = self.get_closest_display_rect((rect[2] - rect[0], rect[3] - rect[1]))
rect = self.rebound(rect, to_rect=target_display_rect, offset=offset)

resizable = self.is_resizable()
Expand Down

0 comments on commit c473d9f

Please sign in to comment.