// 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; }
// WindowProc handles dispatching of messages and routing back to the base class or to Windows LRESULT cef_dark_window::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_SETTINGCHANGE: // NOTE: We want anyone else interested in this message // to be notified of a setting change even if we handle // the message. Otherwise the default implementation // may be in the wrong state HandleSettingChange((UINT)wParam, (LPCWSTR)lParam); break; case WM_NCMOUSELEAVE: // NOTE: We want anyone else interested in this message // to be notified. Otherwise the default implementation // may be in the wrong state HandleNcMouseLeave(); break; case WM_NCMOUSEMOVE: if (HandleNcMouseMove((UINT)wParam)) return 0L; break; case WM_NCLBUTTONDOWN: if (HandleNcLeftButtonDown((UINT)wParam)) return 0L; break; case WM_NCLBUTTONUP: { POINT pt; POINTSTOPOINT(pt, lParam); if (HandleNcLeftButtonUp((UINT)wParam, &pt)) return 0L; } break; case WM_NCCREATE: if (HandleNcCreate()) return 0L; break; case WM_NCPAINT: if (HandleNcPaint((HRGN)wParam)) return 0L; break; case WM_NCDESTROY: if (HandleNcDestroy()) return 0L; break; case WM_NCHITTEST: { POINT pt; POINTSTOPOINT(pt, lParam); return HandleNcHitTest(&pt); } break; case WM_MEASUREITEM: if (HandleMeasureItem((LPMEASUREITEMSTRUCT)lParam)) return TRUE; break; case WM_DRAWITEM: if (HandleDrawItem((LPDRAWITEMSTRUCT)lParam)) return TRUE; break; case WM_SETICON: mWindowIcon = 0; break; case WM_SETTEXT: case WM_ACTIVATE: case WM_NCACTIVATE: // Turn off redraw because the // DefaultWindowProc will paint over top of // our frame and cause the title bar to flicker if (!IsIconic()){ SetRedraw(FALSE); } break; } LRESULT lr = cef_window::WindowProc(message, wParam, lParam); // post default message processing switch (message) { case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: case WM_MOVE: case WM_SIZE: case WM_SIZING: case WM_EXITSIZEMOVE: UpdateNonClientArea(); break; } // special case -- since we turned off redraw for these // messages to reduce flicker, we need to turn redraw // on now and force updating the non-client area switch (message) { case WM_SETTEXT: case WM_ACTIVATE: case WM_NCACTIVATE: if (!IsIconic()){ SetRedraw(TRUE); UpdateNonClientArea(); if (message != WM_SETTEXT) { DoRepaintClientArea(); } } break; } return lr; }