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

[Win32] Use WS_EX_LAYERED style for native control holders with winui composition #7111

Merged

Conversation

kekekeks
Copy link
Member

@kekekeks kekekeks commented Dec 9, 2021

Fixes #7106

@kekekeks kekekeks requested a review from maxkatz6 December 9, 2021 16:27
@kekekeks
Copy link
Member Author

kekekeks commented Dec 9, 2021

Probably also fixes #6308

@maxkatz6 maxkatz6 enabled auto-merge December 9, 2021 16:39
@maxkatz6 maxkatz6 merged commit 12f6feb into master Dec 9, 2021
@maxkatz6 maxkatz6 deleted the bufixes/fix-7106-use-layered-windows-for-embedded-controls branch December 9, 2021 17:01
danwalmsley pushed a commit that referenced this pull request Dec 20, 2021
…-windows-for-embedded-controls

[Win32] Use WS_EX_LAYERED style for native control holders with winui composition
@adirh3
Copy link
Contributor

adirh3 commented Apr 8, 2022

@kekekeks after this change the DumbWindow's handle is never created (when using composition), causing some native controls to not work anymore since the parent handle is empty.
I checked it a bit and it seems like to create a layered child window you need to use specific manifest file - https://docs.microsoft.com/en-us/windows/win32/winmsg/using-windows
Works after doing so, but might want to somehow make it work from Avalonia or at least throw an exception

@maxkatz6
Copy link
Member

maxkatz6 commented Apr 9, 2022

Can we possibly detect if manifest is missing or not?
Otherwise, we can throw an exception if Handle is empty with information that manifest is required. It might be less useful, because window handle can be empty for many other reasons too.

I am not sure if it's the best idea if we force users to use manifest. I don't think other frameworks do that. Although we definitely can include it with templates.

@adirh3
Copy link
Contributor

adirh3 commented Apr 9, 2022

Can we possibly detect if manifest is missing or not? Otherwise, we can throw an exception if Handle is empty with information that manifest is required. It might be less useful, because window handle can be empty for many other reasons too.

I am not sure if it's the best idea if we force users to use manifest. I don't think other frameworks do that. Although we definitely can include it with templates.

If it's missing, then CreateWindowEx will fail which I think should be identifiable using GetLastError.
One thing we can do is fallback to non-layered window if layered one fails and have a warning log.

@kekekeks
Copy link
Member Author

IMO we should just retry creating the window without WS_EX_LAYERED.

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

Successfully merging this pull request may close these issues.

NativeControlHost doesn't work properly with most native control when UseWindowsUIComposition enabled
4 participants