In the sample CefClient app, its currently done in response to the WM_SIZE message using the following code.
- Code: Select all
// Resize the browser window and address bar to match the new frame
// window size
RECT rect;
GetClientRect(hWnd, &rect);
rect.top += URLBAR_HEIGHT;
int urloffset = rect.left + BUTTON_WIDTH * 4;
HDWP hdwp = BeginDeferWindowPos(1);
hdwp = DeferWindowPos(hdwp, editWnd, NULL, urloffset,
0, rect.right - urloffset, URLBAR_HEIGHT, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, g_handler->GetBrowserHwnd(), NULL,
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
SWP_NOZORDER);
EndDeferWindowPos(hdwp);
While this is for the case when we are resizing the parent window and want the child windows to be resized as well, there are use cases where an embedder may want to resize or reposition the browser area at any time based on business logic.
A simple Cef method (probably something like CefClient::SetPositionAndSize)to warp this functionality would be nice and convenient.