|
|
Chromium Code Reviews|
Created:
7 years, 9 months ago by kevers Modified:
7 years, 8 months ago CC:
chromium-reviews, tfarina, ben+watch_chromium.org Base URL:
http://git.chromium.org/chromium/src.git@master Visibility:
Public. |
DescriptionFix window positioning in high-DPI on Windows.
BUG=149881
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=192750
Patch Set 1 #
Total comments: 3
Patch Set 2 : Fix merge conflicts. #Patch Set 3 : Fix another merge conflict. #
Messages
Total messages: 13 (0 generated)
Oshima-san, Can you please have a look at this CL. Cleans up many of the DIP versus pixel positioning/sizing issues on Win-Aura in high-DPI mode.
I'm not familiar with desktop aura/win. ben should review this. https://codereview.chromium.org/12512014/diff/1/ui/views/widget/desktop_aura/... File ui/views/widget/desktop_aura/desktop_screen_position_client.cc (right): https://codereview.chromium.org/12512014/diff/1/ui/views/widget/desktop_aura/... ui/views/widget/desktop_aura/desktop_screen_position_client.cc:19: float scale = gfx::Screen::GetScreenFor(window)-> can you use GetScaleFactorForNativewView?
I'm not familiar with desktop aura/win. ben should review this.
I'm not familiar with desktop aura/win. ben should review this.
https://codereview.chromium.org/12512014/diff/1/ui/views/widget/desktop_aura/... File ui/views/widget/desktop_aura/desktop_screen_position_client.cc (right): https://codereview.chromium.org/12512014/diff/1/ui/views/widget/desktop_aura/... ui/views/widget/desktop_aura/desktop_screen_position_client.cc:19: float scale = gfx::Screen::GetScreenFor(window)-> On 2013/03/21 00:31:55, oshima wrote: > can you use GetScaleFactorForNativewView? GetScaleFactorForNativeView returns an enumerated scale factor and not the actual device scaling.
win lgtm
https://codereview.chromium.org/12512014/diff/1/ui/views/widget/desktop_aura/... File ui/views/widget/desktop_aura/desktop_screen_position_client.cc (right): https://codereview.chromium.org/12512014/diff/1/ui/views/widget/desktop_aura/... ui/views/widget/desktop_aura/desktop_screen_position_client.cc:19: float scale = gfx::Screen::GetScreenFor(window)-> On 2013/03/21 13:37:26, kevers wrote: > On 2013/03/21 00:31:55, oshima wrote: > > can you use GetScaleFactorForNativewView? > > GetScaleFactorForNativeView returns an enumerated scale factor and not the > actual device scaling. fair enough. lgtm
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kevers@chromium.org/12512014/10001
Failed to apply patch for
ui/views/widget/desktop_aura/desktop_root_window_host_win.cc:
While running patch -p1 --forward --force --no-backup-if-mismatch;
patching file ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
Hunk #2 FAILED at 111.
Hunk #3 succeeded at 211 (offset 2 lines).
Hunk #4 succeeded at 220 (offset 2 lines).
Hunk #5 succeeded at 257 (offset 2 lines).
Hunk #6 succeeded at 406 (offset 2 lines).
Hunk #7 succeeded at 723 (offset 2 lines).
1 out of 7 hunks FAILED -- saving rejects to file
ui/views/widget/desktop_aura/desktop_root_window_host_win.cc.rej
Patch: ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
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
ed137d44ed0a78e090953ef6deafb8977e3f0d4f..a972db3032f4cb535b677d3350dfd24c89570e1e
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"
@@ -110,7 +111,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;
@@ -208,7 +210,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 {
@@ -216,29 +219,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 {
@@ -247,7 +256,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) {
@@ -395,10 +405,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().
- gfx::Rect bounds(WidgetSizeIsClientSize() ? GetClientAreaBoundsInScreen()
- : GetWindowBoundsInScreen());
+ gfx::Rect bounds(WidgetSizeIsClientSize() ?
+ message_handler_->GetClientAreaBoundsInScreen() :
+ message_handler_->GetWindowBoundsInScreen());
gfx::Rect without_expansion(bounds.x() - window_expansion_.x(),
bounds.y() - window_expansion_.y(),
bounds.width() - window_expansion_.width(),
@@ -708,8 +722,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(without_expansion));
- native_widget_delegate_->OnNativeWidgetSizeChanged(new_size);
+ gfx::Size dip_size = ui::win::ScreenToDIPSize(without_expansion);
+ content_window_->SetBounds(gfx::Rect(dip_size));
+ native_widget_delegate_->OnNativeWidgetSizeChanged(dip_size);
}
void DesktopRootWindowHostWin::HandleFrameChanged() {
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kevers@chromium.org/12512014/14003
Retried try job too often on win7_aura for step(s) content_browsertests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win7_aura&...
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kevers@chromium.org/12512014/14003
Message was sent while issue was closed.
Change committed as 192750 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
