From 8f2c33ce0708c2deb493d3ed435b04951a2cce9c Mon Sep 17 00:00:00 2001 From: Joone Hur Date: Wed, 20 Jan 2016 09:33:15 -0800 Subject: [PATCH] [Windows] Maximize the window over the taskbar in the fullscreen mode. It allows the users to close the fullscreen application. BUG=XWALK-4861 --- ui/views/widget/widget.cc | 3 +++ ui/views/win/hwnd_message_handler.cc | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index c3c0252a7f91f..4fbd4d11f9398 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -693,6 +693,9 @@ void Widget::SetVisibleOnAllWorkspaces(bool always_visible) { void Widget::Maximize() { native_widget_->Maximize(); +#if defined(OS_WIN) + saved_show_state_ = ui::SHOW_STATE_MAXIMIZED; +#endif } void Widget::Minimize() { diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 035df76e687cd..08814fd80d281 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -594,6 +594,17 @@ void HWNDMessageHandler::ShowWindowWithState(ui::WindowShowState show_state) { } ShowWindow(hwnd(), native_show_state); + + // Overlap the taskbar and remove the minimize and maximize button in + // the title bar for the fullscreen mode. + if (native_show_state == SW_SHOWMAXIMIZED) { + LONG style = GetWindowLong(hwnd(), GWL_STYLE); + SetWindowLong(hwnd(), GWL_STYLE, style & ~(WS_MAXIMIZEBOX | + WS_MINIMIZEBOX)); + SetWindowPos(hwnd(), HWND_TOPMOST, 0, 0, GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), SWP_DRAWFRAME | SWP_FRAMECHANGED); + } + // When launched from certain programs like bash and Windows Live Messenger, // show_state is set to SW_HIDE, so we need to correct that condition. We // don't just change show_state to SW_SHOWNORMAL because MSDN says we must