From c46fd503089a5c808948156be58c9be03f928f2c Mon Sep 17 00:00:00 2001 From: Dylan Perks Date: Sun, 8 Dec 2024 20:48:44 +0000 Subject: [PATCH] Add ScaleChanged event, some improvements --- .../proposals/Proposal - Windowing 3.0.md | 54 ++++++++++++++----- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/documentation/proposals/Proposal - Windowing 3.0.md b/documentation/proposals/Proposal - Windowing 3.0.md index 93ce8cc07d..3f909975ba 100644 --- a/documentation/proposals/Proposal - Windowing 3.0.md +++ b/documentation/proposals/Proposal - Windowing 3.0.md @@ -1121,15 +1121,20 @@ public interface ISurfaceWindow /// bool IsCloseRequested { get; set; } + /// + /// Raised when is set to true. + /// + event Action CloseRequested { add; remove; } + /// /// Gets or sets a value indicating whether the window is visible. /// bool IsVisible { get; set; } /// - /// Raised when is set to true. + /// Raised when changes. /// - event Action CloseRequested { add; remove; } + event Action VisibilityChanged { add; remove; } /// /// Gets or sets a value indicating whether the window currently has input focus. If setting to true, the @@ -1529,15 +1534,35 @@ their rendering code. It provides no configuration but provides extra informatio ```cs namespace Silk.NET.Windowing; +/// +/// Contains properties pertaining to a change in a surface's scale. +/// +/// The surface to which the change in scale occurred. +/// The previous value for . +/// The new value for . +/// The previous value for . +/// The new value for . +/// The previous value for . +/// The new value for . +public readonly record struct ScaleChangedEvent( + Surface Surface, + float OldContent, + float NewContent, + float OldDraw, + float NewDraw, + float OldPixelDensity, + float NewPixelDensity +); + /// /// Provides information pertaining to the surface's graphical scaling. /// /// -/// is typically used to scale UI elements to the correct size for the end user. +/// is typically used to scale UI elements to the correct size for the end user. /// on the other hand is used to scale the entire application to cover the entire client /// area in cases where the window client size is smaller than the actual drawable size (i.e. it is high density). /// If scaling content for legibility and scaling the application's rendering as a whole are not needed to be separated, -/// it is recommended to use . Implementations shall always request a high density surface if +/// it is recommended to use . Implementations shall always request a high density surface if /// given the choice, to account for the platforms where applications may not be able to opt-out of high density. /// public interface ISurfaceScale @@ -1546,35 +1571,40 @@ public interface ISurfaceScale /// Gets the factor with which the application should scale its content to make the content more legible for the /// user. This has no influence on . /// - /// - float ContentScale { get; } + /// + float Content { get; } /// /// Gets the suggested amplification factor when drawing in terms of . This /// represents the scale from the pixel resolution to the desired content size, and is typically the multiplication - /// of and . + /// of and . /// /// /// For example, if is 2.0 (i.e. there are 2 pixels per screen coordinate) /// and the window manager requests that applications scale their content up by 2.0 to meet the user's - /// settings as per , this would be 4.0. This is because we're scaling once to + /// settings as per , this would be 4.0. This is because we're scaling once to /// account for the fact that the application has twice the amount of pixels available to it for the given window /// size, and then scaling again so that what we are drawing appears zoomed in as per the user's request. Note that /// it is rarely the case that an operating system employs both dense pixels and content scale. macOS for - /// instance, instead of setting , opts to scale the resolution in the cases where the + /// instance, instead of setting , opts to scale the resolution in the cases where the /// user wants magnified visuals instead of having the applications scale their content; whereas Windows sets - /// and instead always keeps as 1.0. This is down + /// and instead always keeps as 1.0. This is down /// to philosophical differences between the window coordinate systems on platforms as to whether they prefer to /// deal in physical device pixels or physical content sizes. /// - float DrawScale { get; } + float Draw { get; } /// /// Gets the ratio of pixels rendered to window size. This shall be equivalent to /// divided by . /// - /// + /// float PixelDensity { get; } + + /// + /// An event raised when any scale factor changes. + /// + event Action Changed { add; remove; } } public abstract partial class Surface