From 340fdaf511de6e60e42db280c32c1fdd108cf737 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 20 Feb 2025 21:39:12 +0100 Subject: [PATCH] feat: allow setting `roundedCorners` on Windows (#45594) * feat: allow setting roundedCorners on Windows * Update docs/api/structures/base-window-options.md Co-authored-by: Will Anderson --------- Co-authored-by: Will Anderson --- docs/api/structures/base-window-options.md | 7 ++++--- shell/browser/native_window_views.cc | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index dacb75f106b8..3876d6922527 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -97,9 +97,10 @@ * `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height. * `trafficLightPosition` [Point](point.md) (optional) _macOS_ - Set a custom position for the traffic light buttons in frameless windows. -* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window - should have rounded corners on macOS. Default is `true`. Setting this property - to `false` will prevent the window from being fullscreenable. +* `roundedCorners` boolean (optional) _macOS_ _Windows_ - Whether frameless window + should have rounded corners. Default is `true`. Setting this property + to `false` will prevent the window from being fullscreenable on macOS. + On Windows versions older than Windows 11 Build 22000 this property has no effect, and frameless windows will not have rounded corners. * `thickFrame` boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard window frame. Setting it to `false` will remove window shadow and window animations. Default is `true`. diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index a74e0ef365f4..d7765c930802 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -378,6 +378,11 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options, if (!thick_frame_) frame_style &= ~(WS_THICKFRAME | WS_CAPTION); ::SetWindowLong(GetAcceleratedWidget(), GWL_STYLE, frame_style); + + bool rounded_corner = true; + options.Get(options::kRoundedCorners, &rounded_corner); + if (!rounded_corner) + SetRoundedCorners(false); } LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);