PKGBUILDs/extra/chromium/x11-fix-mixup-between-DIP-pixel-coordinates.patch
2018-06-06 23:34:22 +00:00

40 lines
1.5 KiB
Diff

From 2752a03ba6435130848aa620b7ab4246eec2f77a Mon Sep 17 00:00:00 2001
From: Tom Anderson <thomasanderson@chromium.org>
Date: Mon, 4 Jun 2018 22:09:08 +0000
Subject: [PATCH] X11: Fix mixup between DIP/pixel coordinates
BUG=707721
R=sky
Change-Id: Ibbbff9c2c815700324f553a3b66e878f76938534
Reviewed-on: https://chromium-review.googlesource.com/1083692
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564261}
---
ui/views/widget/desktop_aura/desktop_screen_x11.cc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
index 8fd5d379d344..e90710c2c39c 100644
--- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
@@ -216,8 +216,13 @@ display::Display DesktopScreenX11::GetDisplayNearestWindow(
if (host) {
DesktopWindowTreeHostX11* rwh = DesktopWindowTreeHostX11::GetHostForXID(
host->GetAcceleratedWidget());
- if (rwh)
- return GetDisplayMatching(rwh->GetX11RootWindowBounds());
+ if (rwh) {
+ const float scale = 1.0f / GetDeviceScaleFactor();
+ const gfx::Rect pixel_rect = rwh->GetX11RootWindowBounds();
+ return GetDisplayMatching(
+ gfx::Rect(gfx::ScaleToFlooredPoint(pixel_rect.origin(), scale),
+ gfx::ScaleToCeiledSize(pixel_rect.size(), scale)));
+ }
}
return GetPrimaryDisplay();
--
2.17.1