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

Unified Diff: ui/wm/core/default_screen_position_client.cc

Issue 1426933002: Refactor Windows DPI Point, Rect, and Size for Multiple Monitor DPI Awareness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« ui/gfx/screen_win.cc ('K') | « ui/views/win/hwnd_message_handler_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/default_screen_position_client.cc
diff --git a/ui/wm/core/default_screen_position_client.cc b/ui/wm/core/default_screen_position_client.cc
index d26a91ed9c8f92c66495eab9cfc7de7e5a749d87..725a7d8e3942edabb299529ef81516880fe8c8ba 100644
--- a/ui/wm/core/default_screen_position_client.cc
+++ b/ui/wm/core/default_screen_position_client.cc
@@ -9,6 +9,10 @@
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/screen.h"
+#if defined(OS_WIN)
+#include "ui/gfx/screen_win.h"
+#endif
+
namespace wm {
DefaultScreenPositionClient::DefaultScreenPositionClient() {
@@ -20,10 +24,15 @@ DefaultScreenPositionClient::~DefaultScreenPositionClient() {
gfx::Point DefaultScreenPositionClient::GetOriginInScreen(
const aura::Window* root_window) {
gfx::Point origin_in_pixels = root_window->GetHost()->GetBounds().origin();
+#if defined(OS_WIN)
+ // Origins in Windows are fixed. Use the Windows aware scaling instead.
+ return gfx::ScreenWin::ScreenToDIPPoint(origin_in_pixels);
+#else
aura::Window* window = const_cast<aura::Window*>(root_window);
float scale = gfx::Screen::GetScreenFor(window)->
GetDisplayNearestWindow(window).device_scale_factor();
return gfx::ScaleToFlooredPoint(origin_in_pixels, 1.0f / scale);
+#endif
}
void DefaultScreenPositionClient::ConvertPointToScreen(
« ui/gfx/screen_win.cc ('K') | « ui/views/win/hwnd_message_handler_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698