Skip to content

Commit

Permalink
Fix invalid calculation of rect center point
Browse files Browse the repository at this point in the history
  • Loading branch information
Crozzers committed Jul 2, 2024
1 parent 2fa5bd4 commit 437f5b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,10 @@ def set_pos(self, rect: Rect, placement: Optional[Placement] = None):
# check if Window will fit on the Display it's being moved to. If not, adjust the rect to fit
# 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]))
target_display_rect = self.get_closest_display_rect((
rect[0] + (size_from_rect(rect)[0] // 2),
rect[1] + (size_from_rect(rect)[1] // 2)
))
rect = self.rebound(rect, to_rect=target_display_rect, offset=offset)

resizable = self.is_resizable()
Expand Down

0 comments on commit 437f5b5

Please sign in to comment.