win: Fix calculating window bounds on high DPI display

This commit is contained in:
Cheng Zhao 2014-12-12 09:04:43 -08:00
parent e38614ce31
commit e3ccb18696
3 changed files with 11 additions and 13 deletions

View file

@ -27,9 +27,9 @@ WinFrameView::~WinFrameView() {
gfx::Rect WinFrameView::GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const {
gfx::Size size(client_bounds.size());
ClientAreaSizeToWindowSize(&size);
return gfx::Rect(client_bounds.origin(), size);
return views::GetWindowBoundsForClientBounds(
static_cast<views::View*>(const_cast<WinFrameView*>(this)),
client_bounds);
}
int WinFrameView::NonClientHitTest(const gfx::Point& point) {
@ -53,12 +53,4 @@ const char* WinFrameView::GetClassName() const {
return kViewClassName;
}
void WinFrameView::ClientAreaSizeToWindowSize(gfx::Size* size) const {
// AdjustWindowRect seems to return a wrong window size.
gfx::Size window = frame_->GetWindowBoundsInScreen().size();
gfx::Size client = frame_->GetClientAreaBoundsInScreen().size();
size->set_width(size->width() + window.width() - client.width());
size->set_height(size->height() + window.height() - client.height());
}
} // namespace atom

View file

@ -25,8 +25,6 @@ class WinFrameView : public FramelessView {
const char* GetClassName() const override;
private:
void ClientAreaSizeToWindowSize(gfx::Size* size) const;
DISALLOW_COPY_AND_ASSIGN(WinFrameView);
};