You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let resize_frame_thickness = unsafe{GetSystemMetricsForDpi(SM_CXSIZEFRAME, dpi)};
435
+
let padding_thickness = unsafe{GetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi)};
436
+
resize_frame_thickness + padding_thickness
437
+
}
438
+
439
+
pubfncalculate_insets_for_dpi(dpi:u32) -> RECT{
440
+
// - On Windows 10
441
+
// The top inset must be zero, since if there is any nonclient area, Windows will draw
442
+
// a full native titlebar outside the client area. (This doesn't occur in the maximized
443
+
// case.)
444
+
//
445
+
// - On Windows 11
446
+
// The top inset is calculated using an empirical formula that I derived through various
447
+
// tests. Without this, the top 1-2 rows of pixels in our window would be obscured.
448
+
449
+
let frame_thickness = get_frame_thickness(dpi);
450
+
451
+
let top_inset = matchWIN_VERSION.build{
452
+
v if v >= 22000 => (dpi asf32 / USER_DEFAULT_SCREEN_DPIasf32).round()asi32,
453
+
_ => 0,
454
+
};
455
+
456
+
RECT{
457
+
left: frame_thickness,
458
+
top: top_inset,
459
+
right: frame_thickness,
460
+
bottom: frame_thickness,
461
+
}
462
+
}
463
+
464
+
/// Calcuclate window insets, used in WM_NCCALCSIZE
465
+
///
466
+
/// Derived of GPUI implementation
467
+
/// see <https://github.com/zed-industries/zed/blob/7bddb390cabefb177d9996dc580749d64e6ca3b6/crates/gpui/src/platform/windows/events.rs#L1418-L1454>
0 commit comments