Merge pull request #12650 from jordan-woyak/balloon-tip-multimon

DolphinQt: Fix BalloonTip positioning on secondary monitors.
This commit is contained in:
Admiral H. Curtiss 2024-03-21 03:33:43 +01:00 committed by GitHub
commit b19cf1f962
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -315,10 +315,12 @@ void BalloonTip::UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position,
// Place the arrow tip at the target position whether the arrow tip is drawn or not
const int target_balloontip_global_x =
target_arrow_tip_position.x() - static_cast<int>(arrow_tip_x);
const int rightmost_valid_balloontip_global_x = screen_rect.width() - size_hint.width();
const int rightmost_valid_balloontip_global_x =
screen_rect.left() + screen_rect.width() - size_hint.width();
// If the balloon would extend off the screen, push it left or right until it's not
const int actual_balloontip_global_x =
std::max(0, std::min(rightmost_valid_balloontip_global_x, target_balloontip_global_x));
std::max(screen_rect.left(),
std::min(rightmost_valid_balloontip_global_x, target_balloontip_global_x));
// The tip pixel should be in the middle of the control, and arrow_tip_exterior_y is at the bottom
// of that pixel. When arrow_at_bottom is true the arrow is above arrow_tip_exterior_y and so the
// tip pixel is in the right place, but when it's false the arrow is below arrow_tip_exterior_y