-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Screen API refactoring #15901
Comments
Media query API can re-use the same new Screen API as well. |
How would we identify a particular screen? By connector id? |
@kekekeks does it work as an answer? #15382 (comment) |
I think a user readable identifier would also be useful, even if it's only implemented on some platforms. EG if you can read EDID (should be possible on all desktops) you can get the manufacturer name, model number and serial number of the display. EDID however is not always the most reliable thing (EG it's very easy to spoof on Linux), but it makes it much easier to show/handle monitors with the same model number/display name. Even if the ports they are connected to changes. But otherwise this change looks pretty good. There is probably also some other things that might be useful (EG colour depth, DPI, supported resolutions, etc), but they are fairly minor. SDL's display APIs can probably be used for some inspiration as SDL supports pretty much every platform ever created. |
@maxkatz6 , @kekekeks , @simonhaines, @thevortexcloud The mobile community has thought about this problem for a little while longer it looks like. Their guideline on window size classes is in agreement with the guideline from the Materials Design Foundation on how to design across window classes. Guidelines and how to's like these are something that I am missing in Avalonia's official documentation as well as the communities Avalonia Materials library and I believe should rather be part of a UI framework library. It seems like this feature request is moving along these lines if I am not mistaken?
Since the term dp is not uniform across platforms I add this overview, as px are used for Web, pts for iOS, and dps for Android. Also, this is how Android developers retrieve the window size class Apple has a similar approach via their UserInterfaceSizeClass, based on adaptive design principles.
|
You can do this already with a converter/markup extension and binding to the window width. Although you will have to define what counts as large/small yourself.
Avalonia already has device independent pixels. EG the PixelSize struct contains many methods for calculating them. Avalonia/src/Avalonia.Base/PixelSize.cs Lines 154 to 184 in b1e96ad
Many things already use them. |
Completed in 11.2 nightly. Mobile support is coming later. |
Is your feature request related to a problem? Please describe.
Current Screens API was designed and implemented very long time ago, when Avalonia supported way less platforms.
Main problems that needs to be solved:
Browser related nuance:
Browser returns only single active display, where web browser is located. It also doesn't include display name info by default.
If developer want to retrieve extended information, like other screens and additional info, they need to run async Window.getScreenDetails() API. At least once. In Avalonia, it can be covered by
RequestScreenDetails
-like API.Describe the solution you'd like
Describe alternatives you've considered
No response
Additional context
Child issues:
The text was updated successfully, but these errors were encountered: