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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/tabs/window_finder.h" 5 #include "chrome/browser/ui/views/tabs/window_finder.h"
6 6
7 #include "ui/gfx/geometry/point_conversions.h"
8 #include "ui/gfx/screen.h"
7 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" 9 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
8 10
9 #if defined(USE_ASH) 11 #if defined(USE_ASH)
10 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( 12 gfx::NativeWindow GetLocalProcessWindowAtPointAsh(
11 const gfx::Point& screen_point, 13 const gfx::Point& screen_point,
12 const std::set<gfx::NativeWindow>& ignore); 14 const std::set<gfx::NativeWindow>& ignore);
13 #endif 15 #endif
14 16
17 float GetDeviceScaleFactor() {
18 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
19 return display.device_scale_factor();
20 }
21
22 gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) {
23 return ToFlooredPoint(gfx::ScalePoint(dip_point, GetDeviceScaleFactor()));
24 }
25
sadrul 2015/03/20 22:02:03 These two functions should be in anonymous namespa
stapelberg 2015/03/20 23:17:05 Done.
15 gfx::NativeWindow GetLocalProcessWindowAtPoint( 26 gfx::NativeWindow GetLocalProcessWindowAtPoint(
16 chrome::HostDesktopType host_desktop_type, 27 chrome::HostDesktopType host_desktop_type,
17 const gfx::Point& screen_point, 28 const gfx::Point& screen_point,
18 const std::set<gfx::NativeWindow>& ignore) { 29 const std::set<gfx::NativeWindow>& ignore) {
19 #if defined(USE_ASH) 30 #if defined(USE_ASH)
20 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) 31 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH)
21 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); 32 return GetLocalProcessWindowAtPointAsh(screen_point, ignore);
22 #endif 33 #endif
23 34
24 // The X11 server is the canonical state of what the window stacking order 35 // The X11 server is the canonical state of what the window stacking order
25 // is. 36 // is.
26 views::X11TopmostWindowFinder finder; 37 views::X11TopmostWindowFinder finder;
27 return finder.FindLocalProcessWindowAt(screen_point, ignore); 38 return finder.FindLocalProcessWindowAt(DIPToPixelPoint(screen_point), ignore);
28 } 39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698