| 36 | HWND hwndAppMsg = nullptr; |
| 37 | |
| 38 | LRESULT CALLBACK BrowserWindowWndProc(HWND window_handle, UINT message, WPARAM w_param, LPARAM l_param) |
| 39 | { |
| 40 | switch (message) |
| 41 | { |
| 42 | case WM_CREATE: |
| 43 | { |
| 44 | pBrowserClient = new ccef::NanoCefBrowserClient{}; |
| 45 | |
| 46 | RECT rect = { 0 }; |
| 47 | GetClientRect(window_handle, &rect); |
| 48 | CefRect cefRect; |
| 49 | cefRect.x = rect.left; |
| 50 | cefRect.y = rect.top; |
| 51 | cefRect.width = rect.right - rect.left; |
| 52 | cefRect.height = rect.bottom - rect.top; |
| 53 | |
| 54 | CefWindowInfo info; |
| 55 | info.SetAsChild(window_handle, cefRect); |
| 56 | |
| 57 | CefBrowserSettings settings; |
| 58 | // this special url (domain+schema) triggers load-from-disk behavior |
| 59 | std::string url = "https://app/index.html"; |
| 60 | if (Options::Get().url) { |
| 61 | url = *Options::Get().url; |
| 62 | } |
| 63 | CefBrowserHost::CreateBrowser( |
| 64 | info, pBrowserClient.get(), url, |
| 65 | settings, {}, {} |
| 66 | ); |
| 67 | break; |
| 68 | } |
| 69 | case WM_SIZE: |
| 70 | // from the cefclient example, do not allow the window to be resized to 0x0 or the layout will break; |
| 71 | // also be aware that if the size gets too small, GPU acceleration disables |
| 72 | if ((w_param != SIZE_MINIMIZED) |
| 73 | && (pBrowserClient.get()) |
| 74 | && (pBrowserClient->GetBrowser())) |
| 75 | { |
| 76 | CefWindowHandle hwnd(pBrowserClient->GetBrowser()->GetHost()->GetWindowHandle()); |
| 77 | if (hwnd) { |
| 78 | RECT rect{}; |
| 79 | GetClientRect(window_handle, &rect); |
| 80 | SetWindowPos(hwnd, NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); |
| 81 | } |
| 82 | } |
| 83 | break; |
| 84 | case WM_ERASEBKGND: |
| 85 | if (pBrowserClient.get() |
| 86 | && pBrowserClient->GetBrowser() |
| 87 | && pBrowserClient->GetBrowser()->GetHost()->GetWindowHandle() != nullptr) |
| 88 | { |
| 89 | return 1; |
| 90 | } |
| 91 | break; |
| 92 | case WM_ENTERMENULOOP: |
| 93 | if (!w_param) { |
| 94 | CefSetOSModalLoop(true); |
| 95 | } |
nothing calls this directly
no test coverage detected