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

Unified Diff: ui/views/widget/desktop_aura/x11_topmost_window_finder.cc

Issue 1003863005: Fix tab drag and drop with hi-dpi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename functions for clarity 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: ui/views/widget/desktop_aura/x11_topmost_window_finder.cc
diff --git a/ui/views/widget/desktop_aura/x11_topmost_window_finder.cc b/ui/views/widget/desktop_aura/x11_topmost_window_finder.cc
index d59b46cf3798755f1bfc8a11995b0723e64cbc18..71330483e6037851fa47aa6b2e7317ccd569d163 100644
--- a/ui/views/widget/desktop_aura/x11_topmost_window_finder.cc
+++ b/ui/views/widget/desktop_aura/x11_topmost_window_finder.cc
@@ -8,10 +8,20 @@
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/window.h"
+#include "ui/gfx/screen.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
namespace views {
+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()));
+}
+
X11TopmostWindowFinder::X11TopmostWindowFinder() : toplevel_(None) {
}
@@ -21,7 +31,7 @@ X11TopmostWindowFinder::~X11TopmostWindowFinder() {
aura::Window* X11TopmostWindowFinder::FindLocalProcessWindowAt(
const gfx::Point& screen_loc,
const std::set<aura::Window*>& ignore) {
- screen_loc_ = screen_loc;
+ screen_loc_ = DIPToPixelPoint(screen_loc);
sadrul 2015/03/19 23:46:58 Since FindWindowAt() takes screen_loc in physical-
stapelberg 2015/03/20 08:34:40 Done.
ignore_ = ignore;
std::vector<aura::Window*> local_process_windows =

Powered by Google App Engine
This is Rietveld 408576698