Use setBounds to implement maximize for window without thickFrame
This commit is contained in:
parent
b87c3c4b2d
commit
baff744601
1 changed files with 21 additions and 2 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include "ui/aura/window_tree_host.h"
|
#include "ui/aura/window_tree_host.h"
|
||||||
#include "ui/base/hit_test.h"
|
#include "ui/base/hit_test.h"
|
||||||
#include "ui/gfx/image/image.h"
|
#include "ui/gfx/image/image.h"
|
||||||
|
#include "ui/gfx/screen.h"
|
||||||
#include "ui/views/background.h"
|
#include "ui/views/background.h"
|
||||||
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
|
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
|
||||||
#include "ui/views/controls/webview/webview.h"
|
#include "ui/views/controls/webview/webview.h"
|
||||||
|
@ -415,6 +416,16 @@ bool NativeWindowViews::IsEnabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::Maximize() {
|
void NativeWindowViews::Maximize() {
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
// For window without WS_THICKFRAME style, we can not call Maximize().
|
||||||
|
if (!thick_frame_) {
|
||||||
|
auto display =
|
||||||
|
gfx::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
|
||||||
|
SetBounds(display.work_area(), false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (IsVisible())
|
if (IsVisible())
|
||||||
window_->Maximize();
|
window_->Maximize();
|
||||||
else
|
else
|
||||||
|
@ -459,6 +470,15 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
||||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||||
NotifyWindowLeaveFullScreen();
|
NotifyWindowLeaveFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For window without WS_THICKFRAME style, we can not call Maximize().
|
||||||
|
if (!thick_frame_) {
|
||||||
|
auto display =
|
||||||
|
gfx::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
|
||||||
|
SetBounds(display.bounds(), false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// We set the new value after notifying, so we can handle the size event
|
// We set the new value after notifying, so we can handle the size event
|
||||||
// correctly.
|
// correctly.
|
||||||
window_->SetFullscreen(fullscreen);
|
window_->SetFullscreen(fullscreen);
|
||||||
|
@ -475,8 +495,7 @@ bool NativeWindowViews::IsFullscreen() const {
|
||||||
return window_->IsFullscreen();
|
return window_->IsFullscreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::SetBounds(const gfx::Rect& bounds,
|
void NativeWindowViews::SetBounds(const gfx::Rect& bounds, bool animate) {
|
||||||
bool animate = false) {
|
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
// On Linux the minimum and maximum size should be updated with window size
|
// On Linux the minimum and maximum size should be updated with window size
|
||||||
// when window is not resizable.
|
// when window is not resizable.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue