Windows: Set browser window size to 0x0 when minimized to reduce resource usage (issue #1369).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/2062@1821 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-09-04 23:13:47 +00:00
parent 45d9e3f357
commit d5f9215aab
2 changed files with 35 additions and 25 deletions

View File

@ -589,13 +589,15 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message,
return 0;
case WM_SIZE:
// Minimizing resizes the window to 0x0 which causes our layout to go all
// screwy, so we just ignore it.
if (wParam != SIZE_MINIMIZED && browser && browser->window_widget_) {
// Resize the Widget window to the full size of the browser window.
if (browser && browser->window_widget_) {
// Pass window resize events to the HWND for the DesktopNativeWidgetAura
// root window. Passing size 0x0 (wParam == SIZE_MINIMIZED, for example)
// will cause the widget to be hidden which reduces resource usage.
RECT rc;
GetClientRect(hwnd, &rc);
browser->window_widget_->SetSize(gfx::Size(rc.right, rc.bottom));
SetWindowPos(HWNDForWidget(browser->window_widget_), NULL,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
SWP_NOZORDER);
}
return 0;