Skip to content
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

Consider expose the "Hide Win11 corner" function as AttachedProperty #4

Open
rabbitism opened this issue Oct 20, 2024 · 5 comments
Open

Comments

@rabbitism
Copy link
Contributor

rabbitism commented Oct 20, 2024

So that user can utilize in any kind of window. It is possible to subscribe to the change of IsExtendedIntoWindowDecorationsProperty and apply the coercion. I have tested it locally and it works well.
(And I can open a PR if needed. )

@BAndysc
Copy link
Owner

BAndysc commented Oct 21, 2024

I was thinking about an attached property, but I am afraid observing IsExtendedIntoWindowDecorationsProperty is not enough.

Avalonia sets DWMWA_WINDOW_CORNER_PREFERENCE in ExtendClientArea(). ExtendClientArea is called when IsExtendedIntoWindowDecorationsProperty changes, but also in few different cases (ShowWindow, WM_SIZE message, few different cases). So I think there is high risk our call to no rounded corners could be replaced by Avalonia's call breaking the classic style.

I think it is better to just implement it on the Avalonia side: AvaloniaUI/Avalonia#17294

@rabbitism
Copy link
Contributor Author

rabbitism commented Oct 21, 2024

I'm suggesting this according to your current implementation. because every call of base.ExtendClientAreaToDecorationsChanged(bool) will set IsExtendedIntoWindowDecoration once (see Avalonia Source ), so eventually there should be no difference.

@BAndysc
Copy link
Owner

BAndysc commented Oct 21, 2024

Hmm, how do you use coercion with DirectProperty? I thought only StyledProperty supports it? Tho I think that's still a hack, as coercion should not have side effects (but in this particular case it is not very problematic).

@rabbitism
Copy link
Contributor Author

Hmm, how do you use coercion with DirectProperty? I thought only StyledProperty supports it? Tho I think that's still a hack, as coercion should not have side effects (but in this particular case it is not very problematic).

Sorry was a bit busy these days. Please check below commit: rabbitism@032a59b

@BAndysc
Copy link
Owner

BAndysc commented Oct 25, 2024

This is not enough. This callback will only fire on an effective property value change, i.e. only once, because we don't change IsExtendedIntoWindowDecorationsProperty. On the other hand ExtendClientAreaToDecorations in Window Impl is called more often. I.e. when you minimize and restore the window. In this case the rounded borders fix will be overriden by the default behavior.

So implementing it on the Avalonia side is the only option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants