views: Remove hack on setting min/max size for frameless window
This commit is contained in:
parent
e675407552
commit
3b1ee994e2
5 changed files with 2 additions and 46 deletions
|
@ -854,33 +854,6 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gfx::Size NativeWindowViews::WindowSizeToFramelessSize(
|
|
||||||
const gfx::Size& size) {
|
|
||||||
if (size.width() == 0 && size.height() == 0)
|
|
||||||
return size;
|
|
||||||
|
|
||||||
gfx::Rect window_bounds = gfx::Rect(size);
|
|
||||||
if (use_content_size_) {
|
|
||||||
if (menu_bar_ && menu_bar_visible_) {
|
|
||||||
window_bounds.set_height(window_bounds.height() + kMenuBarHeight);
|
|
||||||
}
|
|
||||||
} else if (has_frame()) {
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
gfx::Size frame_size = gfx::win::ScreenToDIPRect(
|
|
||||||
window_->non_client_view()->GetWindowBoundsForClientBounds(
|
|
||||||
gfx::Rect())).size();
|
|
||||||
#else
|
|
||||||
gfx::Size frame_size =
|
|
||||||
window_->non_client_view()->GetWindowBoundsForClientBounds(
|
|
||||||
gfx::Rect()).size();
|
|
||||||
#endif
|
|
||||||
window_bounds.set_height(window_bounds.height() - frame_size.height());
|
|
||||||
window_bounds.set_width(window_bounds.width() - frame_size.width());
|
|
||||||
}
|
|
||||||
|
|
||||||
return window_bounds.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
gfx::Size NativeWindowViews::ContentSizeToWindowSize(const gfx::Size& size) {
|
gfx::Size NativeWindowViews::ContentSizeToWindowSize(const gfx::Size& size) {
|
||||||
if (!has_frame())
|
if (!has_frame())
|
||||||
return size;
|
return size;
|
||||||
|
|
|
@ -89,8 +89,6 @@ class NativeWindowViews : public NativeWindow,
|
||||||
|
|
||||||
gfx::AcceleratedWidget GetAcceleratedWidget();
|
gfx::AcceleratedWidget GetAcceleratedWidget();
|
||||||
|
|
||||||
gfx::Size WindowSizeToFramelessSize(const gfx::Size& size);
|
|
||||||
|
|
||||||
views::Widget* widget() const { return window_.get(); }
|
views::Widget* widget() const { return window_.get(); }
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
|
|
@ -104,11 +104,11 @@ gfx::Size FramelessView::GetPreferredSize() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Size FramelessView::GetMinimumSize() const {
|
gfx::Size FramelessView::GetMinimumSize() const {
|
||||||
return static_cast<NativeWindow*>(window_)->GetMinimumSize();
|
return window_->GetContentSizeConstraints().GetMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Size FramelessView::GetMaximumSize() const {
|
gfx::Size FramelessView::GetMaximumSize() const {
|
||||||
return static_cast<NativeWindow*>(window_)->GetMaximumSize();
|
return window_->GetContentSizeConstraints().GetMaximumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* FramelessView::GetClassName() const {
|
const char* FramelessView::GetClassName() const {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "atom/browser/ui/views/win_frame_view.h"
|
#include "atom/browser/ui/views/win_frame_view.h"
|
||||||
|
|
||||||
#include "atom/browser/native_window_views.h"
|
#include "atom/browser/native_window_views.h"
|
||||||
#include "ui/gfx/win/dpi.h"
|
|
||||||
#include "ui/views/widget/widget.h"
|
#include "ui/views/widget/widget.h"
|
||||||
#include "ui/views/win/hwnd_util.h"
|
#include "ui/views/win/hwnd_util.h"
|
||||||
|
|
||||||
|
@ -39,18 +38,6 @@ int WinFrameView::NonClientHitTest(const gfx::Point& point) {
|
||||||
return FramelessView::NonClientHitTest(point);
|
return FramelessView::NonClientHitTest(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Size WinFrameView::GetMinimumSize() const {
|
|
||||||
gfx::Size size = window_->WindowSizeToFramelessSize(
|
|
||||||
FramelessView::GetMinimumSize());
|
|
||||||
return gfx::win::DIPToScreenSize(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
gfx::Size WinFrameView::GetMaximumSize() const {
|
|
||||||
gfx::Size size = window_->WindowSizeToFramelessSize(
|
|
||||||
FramelessView::GetMaximumSize());
|
|
||||||
return gfx::win::DIPToScreenSize(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* WinFrameView::GetClassName() const {
|
const char* WinFrameView::GetClassName() const {
|
||||||
return kViewClassName;
|
return kViewClassName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,6 @@ class WinFrameView : public FramelessView {
|
||||||
int NonClientHitTest(const gfx::Point& point) override;
|
int NonClientHitTest(const gfx::Point& point) override;
|
||||||
|
|
||||||
// views::View:
|
// views::View:
|
||||||
gfx::Size GetMinimumSize() const override;
|
|
||||||
gfx::Size GetMaximumSize() const override;
|
|
||||||
const char* GetClassName() const override;
|
const char* GetClassName() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue