| Index: ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
|
| diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
|
| index 199a9e1c3cb2a655ab82b53029a5a71e82bbc77f..c94299f468018d9a63d6c9b5e8e500b8198bbf3f 100644
|
| --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
|
| +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
|
| @@ -12,6 +12,7 @@
|
| #include "ui/aura/window_property.h"
|
| #include "ui/base/cursor/cursor_loader_win.h"
|
| #include "ui/base/ime/input_method_win.h"
|
| +#include "ui/base/win/dpi.h"
|
| #include "ui/base/win/shell.h"
|
| #include "ui/gfx/insets.h"
|
| #include "ui/gfx/native_widget_types.h"
|
| @@ -106,7 +107,8 @@ aura::RootWindow* DesktopRootWindowHostWin::Init(
|
|
|
| message_handler_->set_remove_standard_frame(params.remove_standard_frame);
|
|
|
| - message_handler_->Init(parent_hwnd, params.bounds);
|
| + gfx::Rect pixel_bounds = ui::win::DIPToScreenRect(params.bounds);
|
| + message_handler_->Init(parent_hwnd, pixel_bounds);
|
|
|
| aura::RootWindow::CreateParams rw_params(params.bounds);
|
| rw_params.host = this;
|
| @@ -186,7 +188,8 @@ void DesktopRootWindowHostWin::ShowWindowWithState(
|
|
|
| void DesktopRootWindowHostWin::ShowMaximizedWithBounds(
|
| const gfx::Rect& restored_bounds) {
|
| - message_handler_->ShowMaximizedWithBounds(restored_bounds);
|
| + gfx::Rect pixel_bounds = ui::win::DIPToScreenRect(restored_bounds);
|
| + message_handler_->ShowMaximizedWithBounds(pixel_bounds);
|
| }
|
|
|
| bool DesktopRootWindowHostWin::IsVisible() const {
|
| @@ -194,29 +197,35 @@ bool DesktopRootWindowHostWin::IsVisible() const {
|
| }
|
|
|
| void DesktopRootWindowHostWin::SetSize(const gfx::Size& size) {
|
| - message_handler_->SetSize(size);
|
| + gfx::Size size_in_pixels = ui::win::DIPToScreenSize(size);
|
| + message_handler_->SetSize(size_in_pixels);
|
| }
|
|
|
| void DesktopRootWindowHostWin::CenterWindow(const gfx::Size& size) {
|
| - message_handler_->CenterWindow(size);
|
| + gfx::Size size_in_pixels = ui::win::DIPToScreenSize(size);
|
| + message_handler_->CenterWindow(size_in_pixels);
|
| }
|
|
|
| void DesktopRootWindowHostWin::GetWindowPlacement(
|
| gfx::Rect* bounds,
|
| ui::WindowShowState* show_state) const {
|
| message_handler_->GetWindowPlacement(bounds, show_state);
|
| + *bounds = ui::win::ScreenToDIPRect(*bounds);
|
| }
|
|
|
| gfx::Rect DesktopRootWindowHostWin::GetWindowBoundsInScreen() const {
|
| - return message_handler_->GetWindowBoundsInScreen();
|
| + gfx::Rect pixel_bounds = message_handler_->GetWindowBoundsInScreen();
|
| + return ui::win::ScreenToDIPRect(pixel_bounds);
|
| }
|
|
|
| gfx::Rect DesktopRootWindowHostWin::GetClientAreaBoundsInScreen() const {
|
| - return message_handler_->GetClientAreaBoundsInScreen();
|
| + gfx::Rect pixel_bounds = message_handler_->GetClientAreaBoundsInScreen();
|
| + return ui::win::ScreenToDIPRect(pixel_bounds);
|
| }
|
|
|
| gfx::Rect DesktopRootWindowHostWin::GetRestoredBounds() const {
|
| - return message_handler_->GetRestoredBounds();
|
| + gfx::Rect pixel_bounds = message_handler_->GetRestoredBounds();
|
| + return ui::win::ScreenToDIPRect(pixel_bounds);
|
| }
|
|
|
| gfx::Rect DesktopRootWindowHostWin::GetWorkAreaBoundsInScreen() const {
|
| @@ -225,7 +234,8 @@ gfx::Rect DesktopRootWindowHostWin::GetWorkAreaBoundsInScreen() const {
|
| GetMonitorInfo(MonitorFromWindow(message_handler_->hwnd(),
|
| MONITOR_DEFAULTTONEAREST),
|
| &monitor_info);
|
| - return gfx::Rect(monitor_info.rcWork);
|
| + gfx::Rect pixel_bounds = gfx::Rect(monitor_info.rcWork);
|
| + return ui::win::ScreenToDIPRect(pixel_bounds);
|
| }
|
|
|
| void DesktopRootWindowHostWin::SetShape(gfx::NativeRegion native_region) {
|
| @@ -372,10 +382,14 @@ void DesktopRootWindowHostWin::Hide() {
|
| void DesktopRootWindowHostWin::ToggleFullScreen() {
|
| }
|
|
|
| +// GetBounds and SetBounds work in pixel coordinates, whereas other get/set
|
| +// methods work in DIP.
|
| +
|
| gfx::Rect DesktopRootWindowHostWin::GetBounds() const {
|
| // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged().
|
| return WidgetSizeIsClientSize() ?
|
| - GetClientAreaBoundsInScreen() : GetWindowBoundsInScreen();
|
| + message_handler_->GetClientAreaBoundsInScreen() :
|
| + message_handler_->GetWindowBoundsInScreen();
|
| }
|
|
|
| void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) {
|
| @@ -659,7 +673,9 @@ void DesktopRootWindowHostWin::HandleClientSizeChanged(
|
| if (root_window_host_delegate_)
|
| root_window_host_delegate_->OnHostResized(new_size);
|
| // TODO(beng): replace with a layout manager??
|
| - content_window_->SetBounds(gfx::Rect(new_size));
|
| +
|
| + gfx::Size dip_size = ui::win::ScreenToDIPSize(gfx::Size(new_size));
|
| + content_window_->SetBounds(gfx::Rect(dip_size));
|
| }
|
|
|
| void DesktopRootWindowHostWin::HandleFrameChanged() {
|
|
|