Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: chrome/browser/ui/views/tabs/window_finder_x11.cc

Issue 1003863005: Fix tab drag and drop with hi-dpi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: noop whitespace changes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/tabs/window_finder_x11.cc
diff --git a/chrome/browser/ui/views/tabs/window_finder_x11.cc b/chrome/browser/ui/views/tabs/window_finder_x11.cc
index f7511233d856a2b11d78bfcd0a7a1e62455f5d1e..c800287408cb6da66db6e2e99444928c00dae5c9 100644
--- a/chrome/browser/ui/views/tabs/window_finder_x11.cc
+++ b/chrome/browser/ui/views/tabs/window_finder_x11.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/views/tabs/window_finder.h"
+#include "ui/gfx/geometry/point_conversions.h"
+#include "ui/gfx/screen.h"
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
#if defined(USE_ASH)
@@ -12,6 +14,15 @@ gfx::NativeWindow GetLocalProcessWindowAtPointAsh(
const std::set<gfx::NativeWindow>& ignore);
#endif
+float GetDeviceScaleFactor() {
+ gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
+ return display.device_scale_factor();
+}
+
+gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) {
+ return ToFlooredPoint(gfx::ScalePoint(dip_point, GetDeviceScaleFactor()));
+}
+
sadrul 2015/03/20 22:02:03 These two functions should be in anonymous namespa
stapelberg 2015/03/20 23:17:05 Done.
gfx::NativeWindow GetLocalProcessWindowAtPoint(
chrome::HostDesktopType host_desktop_type,
const gfx::Point& screen_point,
@@ -24,5 +35,5 @@ gfx::NativeWindow GetLocalProcessWindowAtPoint(
// The X11 server is the canonical state of what the window stacking order
// is.
views::X11TopmostWindowFinder finder;
- return finder.FindLocalProcessWindowAt(screen_point, ignore);
+ return finder.FindLocalProcessWindowAt(DIPToPixelPoint(screen_point), ignore);
}

Powered by Google App Engine
This is Rietveld 408576698