remove_incorrect_width_height_adjustments.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Bruce Dawson <[email protected]>
  3. Date: Mon, 28 Feb 2022 19:07:41 +0000
  4. Subject: Remove incorrect width/height adjustments
  5. In late 2016 a change which fixed some problems around window sizing
  6. when attaching or detaching additional displays was landed, which fixed
  7. some genuine bugs. Unfortunately it included a subtraction of 1 from the
  8. width and height of the Chrome window. I couldn't find any discussion of
  9. this size adjustment and I think that it was just a misunderstanding of
  10. how window rectangles work (inclusive versus exclusive extents).
  11. This size adjustment causes non-maximized Chrome windows to shrink every
  12. time a monitor is added or removed. The problematic commit was found
  13. by the bug-filer through a bisect of more than four years of Chrome
  14. history - I'm just landing the fix that they suggested.
  15. Bug: 1300415
  16. Change-Id: Ief124f584a91aa9cc3f10704b0cc1e83356dea5b
  17. Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3492658
  18. Reviewed-by: Allen Bauer <[email protected]>
  19. Commit-Queue: Bruce Dawson <[email protected]>
  20. Cr-Commit-Position: refs/heads/main@{#975872}
  21. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
  22. index 264a9109e42c23e9be6bf7269b3cfee2634b61e4..86f06d2a2c9588a2210a9f78f47e73f1b7c5e329 100644
  23. --- a/ui/views/win/hwnd_message_handler.cc
  24. +++ b/ui/views/win/hwnd_message_handler.cc
  25. @@ -2834,8 +2834,8 @@ void HWNDMessageHandler::OnWindowPosChanging(WINDOWPOS* window_pos) {
  26. // (Win+Shift+Arrows). See crbug.com/656001.
  27. window_rect.left = window_pos->x;
  28. window_rect.top = window_pos->y;
  29. - window_rect.right = window_pos->x + window_pos->cx - 1;
  30. - window_rect.bottom = window_pos->y + window_pos->cy - 1;
  31. + window_rect.right = window_pos->x + window_pos->cx;
  32. + window_rect.bottom = window_pos->y + window_pos->cy;
  33. }
  34. HMONITOR monitor;