// WM_SIZE handler BOOL cef_main_window::HandleSize(BOOL bMinimize) { // Minimizing the window to 0x0 which causes our layout to go all // screwy, so we just ignore it. CefWindowHandle hwnd = SafeGetCefBrowserHwnd(); if (!hwnd) return FALSE; RECT rect; GetClientRect(&rect); if (!bMinimize) { HDWP hdwp = ::BeginDeferWindowPos(1); hdwp = ::DeferWindowPos(hdwp, hwnd, NULL, rect.left, rect.top, ::RectWidth(rect), ::RectHeight(rect), SWP_NOZORDER); ::EndDeferWindowPos(hdwp); } #ifdef DARK_UI // We turn off redraw during activation to minimized flicker // which causes problems on some versions of Windows. If the app // was minimized and was re-activated, it will restore and the client area isn't // drawn so redraw the client area now or it will be hollow in the middle... if (GetProp(L"WasMinimized")) { DoRepaintClientArea(); } SetProp(L"WasMinimized", (HANDLE)bMinimize); #endif return FALSE; }
// WM_ERASEBKGND handler BOOL cef_main_window::HandleEraseBackground(HDC hdc) { #if defined(DARK_AERO_GLASS) && defined (DARK_UI) DrawMenuBar(hdc); #endif return (SafeGetCefBrowserHwnd() != NULL); }
void cef_main_window::DoRepaintClientArea() { CefWindowHandle hwnd = SafeGetCefBrowserHwnd(); if (!hwnd) return; RECT rect; GetClientRect(&rect); ::RedrawWindow(hwnd, &rect, NULL, RDW_ERASE|RDW_INTERNALPAINT|RDW_INVALIDATE|RDW_ERASENOW|RDW_UPDATENOW|RDW_ALLCHILDREN); }
// WM_SETFOCUS handler BOOL cef_main_window::HandleSetFocus(HWND hLosingFocus) { // Pass focus to the browser window CefWindowHandle hwnd = SafeGetCefBrowserHwnd(); if (hwnd) { ::PostMessage(hwnd, WM_SETFOCUS, (WPARAM)hLosingFocus, NULL); return TRUE; } return FALSE; }
// WM_SIZE handler BOOL cef_main_window::HandleSize(BOOL bMinimize) { CefWindowHandle hwnd = SafeGetCefBrowserHwnd(); if (!hwnd) return FALSE; RECT rect; GetBrowserRect(rect); // Minimizing the window to 0x0 which causes our layout to go all // screwy, so we just ignore it. if (!bMinimize) { HDWP hdwp = ::BeginDeferWindowPos(1); hdwp = ::DeferWindowPos(hdwp, hwnd, NULL, rect.left, rect.top, ::RectWidth(rect), ::RectHeight(rect), SWP_NOZORDER); ::EndDeferWindowPos(hdwp); } return FALSE; }
// WM_CLOSE handler BOOL cef_main_window::HandleClose() { SaveWindowRestoreRect(); CefWindowHandle hwnd = SafeGetCefBrowserHwnd(); if (hwnd) { BOOL closing = (BOOL)::GetProp(hwnd, ::kCefWindowClosingPropName); if (closing) { ::RemoveProp(hwnd, ::kCefWindowClosingPropName); } else { g_handler->QuittingApp(true); g_handler->DispatchCloseToNextBrowser(); return TRUE; } } return FALSE; }
// WM_ERASEBKGND handler BOOL cef_main_window::HandleEraseBackground() { return (SafeGetCefBrowserHwnd() != NULL); }