-
-
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
Remove internal access modifier from IWindowImpl.GetWindowsZOrder #16562
Remove internal access modifier from IWindowImpl.GetWindowsZOrder #16562
Conversation
You can test this PR using the following package version. |
Is there any other place where there are two lists/spans in a public API returned together where indexes are expected to match? I'm pretty sure this is an API design violation. A single list should be returned with a container containing the window/zindex. Otherwise all consumers have to check and verify indexing. This was internal for a reason I think. |
On second thought, I don't think this should even be here. This interface is for a single window. We can have a GetZIndez that returns for the window instance ONLY. And higher level functionality should be some place else like a window manager. |
@robloo that's a private API. Public API method has different definition: Avalonia/src/Avalonia.Controls/Window.cs Line 849 in 4c2d9fc
|
You can test this PR using the following package version. |
@maxkatz6 @MrJul This is "public" in the sense that 3rd parties are implementing it already. Although I realize Moreover, the architecture is very questionable. First, I think we got lazy adding this to the IWindowImpl interface. We are starting to have a number of issues in this area IMO. TopLevel, App, Lifetime and now Window are convoluted and the architecture and functionality was not designed properly between these. I ran across this already with the shutdown logic. Now here with Window being aware of and containing higher-level functionality. It's certainly not properly following a control hierarchy in the case of Window... This whole thing feels hacky to me. Your first ideas in the original PR seem much more in-line with what I am thinking here. I'm really surprised the core team asked you to change it. I disagree with the reasoning.
So long story short I still think all of this is a design mistake even though I agree the functionality is very important to have. |
@robloo I suggest opening a new issue for redesign discussion. This PR is only meant to remedy a breaking change for third-party platform implementers that can't be worked around. This makes Avalonia better today with minimal effort. There aren't contract guarantees, so the API could be moved or reworked. I have no strong opinions about this design as I don't use the functionality. |
I'm answering here a last time, but let's open an issue or discussion if you want to push this further.
While it's not the best API ever, I personally think it's fine enough for a low-level API, especially an internal one. For example
Here I completely agree, it should definitely have been part of
I also agree. Lifetime is a bit separate (it's really a higher optional level API compared to the
I disagree with this point: these are marked unstable for a reason. Believe me, I've mentioned before v11 that I was disappointed in so many public API being made "semi-internal". But that's also the strength of the system: we're able to change them. People have been warned, and if anyone implemented them, they should be prepared for potential breaking changes. And I'm including myself in those people. It's not a perfect system, it's a difficult balance, but I much prefer this to having everything internal (I'm looking at you, WPF). That being said, I really hope that in the future their shape would be stable enough to make them officially public again. Regarding the
The original PR, while being better at first glance, was posing problems in both performance (which isn't good but can sometimes be accepted), and more importantly in correctness. Z-order stability wasn't guaranteed, which completely defeated the purpose of a Z-order.
So paying the overhead of iterating through most windows in the operating system to simply list the app's windows? For an order most people won't care about? Which could change between two properties calls? I'm sorry, but that's a recipe for disaster: a simple for loop without capturing the property could potentially return the same window twice. I believe that every feature should be "pay for play" as much as possible.
Correctness is probably the number 1 consideration, but I agree that that the API design could have been better. Honestly, I wish we could have a proper API review process, that would work for both the core team and contributors. I know this has been discussed briefly in the past, but I think it's becoming more and more important. Even though I don't agree with everything you said, you raise an important point here. |
…6562) Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
What is the current behavior?
External platform implementations requiring
IWindowImpl
cannot be created by third-parties (affects 11.1.0 and 11.1.1 releases).Fixed issues
Fixes #16553