MCPcopy Create free account
hub / github.com/cztomczak/cefpython / GetDpiAwareWindowSize

Function GetDpiAwareWindowSize

src/client_handler/dpi_aware.cpp:145–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void GetDpiAwareWindowSize(int* width, int* height) {
146 int dpix = 0;
147 int dpiy = 0;
148 GetSystemDpi(&dpix, &dpiy);
149 double newZoomLevel = 0.0;
150 // 1. Using only "dpix" value to calculate zoom level. All
151 // modern displays have equal horizontal and vertical resolution.
152 // 2. Calculation for DPI < 96 is not yet supported (newZoomLevel<0.0).
153 newZoomLevel = (dpix - DEFAULT_DPIX) / 24;
154 if (newZoomLevel > 0.0) {
155 *width = *width + (int)ceil(newZoomLevel * 0.25 * (*width));
156 *height = *height + (int)ceil(newZoomLevel * 0.25 * (*height));
157 LOG(INFO) << "[Browser process] GetDpiAwareWindowSize():"
158 " enlarged by " << ceil(newZoomLevel * 0.25 * 100) << "%"
159 " new size = " << *width << "/" << *height;
160 }
161}
162
163void SetBrowserDpiSettings(CefRefPtr<CefBrowser> cefBrowser,
164 CefString autoZooming) {

Callers

nothing calls this directly

Calls 1

GetSystemDpiFunction · 0.85

Tested by

no test coverage detected