Prevent rounded corners in Win11 windowed apps?

Windows 11 has a few questionable design decisions, not least the rounded window corners!!
Suddenly apps have lost a few pixels in the bottom left and right corners, as if this is some samsung phone!

Anyway - I think windows 11 apps can specify if the window corners should be rounded or not, so will Unity add support for the same or just deny rounded corners?!

Where did you see this being an option?

The way Microsoft words it is odd but there is a style setting:
Apply rounded corners in desktop apps - Windows apps | Microsoft Docs
How To Control Windows 11 Rounded Corners In Your App (embarcadero.com)

In fact I can do it through the windows API in Unity - this sets square window:

public class Main : MonoBehaviour
{
    // The enum flag for DwmSetWindowAttribute's second parameter, which tells the function what attribute to set.
    public enum DWMWINDOWATTRIBUTE
    {
        DWMWA_WINDOW_CORNER_PREFERENCE = 33
    }

    // The DWM_WINDOW_CORNER_PREFERENCE enum for DwmSetWindowAttribute's third parameter, which tells the function
    // what value of the enum to set.
    public enum DWM_WINDOW_CORNER_PREFERENCE
    {
        DWMWCP_DEFAULT = 0,
        DWMWCP_DONOTROUND = 1,
        DWMWCP_ROUND = 2,
        DWMWCP_ROUNDSMALL = 3
    }

    // Import dwmapi.dll and define DwmSetWindowAttribute in C# corresponding to the native function.
    [DllImport("dwmapi.dll", CharSet = CharSet.Unicode, SetLastError = true)]
    private static extern long DwmSetWindowAttribute(IntPtr hwnd,
                                                     DWMWINDOWATTRIBUTE attribute,
                                                     ref DWM_WINDOW_CORNER_PREFERENCE pvAttribute,
                                                     uint cbAttribute);

    [DllImport("user32.dll")]
    static extern System.IntPtr GetActiveWindow();

    // Start is called before the first frame update
    void Start()
    {
        IntPtr hWnd = GetActiveWindow();
        var attribute = DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE;
        var preference = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_DONOTROUND;
        DwmSetWindowAttribute(hWnd, attribute, ref preference, sizeof(uint));
    }
}

Thanks for that code snippet. We have no plans to add an option at this point but it seems like you already figured out how to do it from script yourself.

just adding personal vote,
+1 for ‘no rounded corners’ (rather have bigger space (or at least feeling of it), than “web/mobile style” for no reason… not that the win11 design is unity’s fault)

1 Like

I think so many buitin apps is the reason that ruined the windows