Is there a cross platform way to achieve mouse penetration? #17836
-
I have been searching for ways to achieve mouse penetration, but all the blogs use winform solutions(like user32.dll) that are only applicable on the Windows platform. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This question has been asked several times. There is no built in way in Avalonia to do this. It can be done though if you are willing to write the native interop code yourself. Avalonia generally exposes things like the native window handle which should be all you need to modify the window behaviour with native APIs. But not all platforms necessarily allow for clicking through windows. For Linux you can use the XShape API. But there are almost no C# examples for it and the examples that do exist are in C++/C. https://en.wikipedia.org/wiki/Shape_extension For Windows you just need to set some window flags from memory. But I don't remember which ones. https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlonga For Mac I have no idea where to even start with that. |
Beta Was this translation helpful? Give feedback.
This question has been asked several times. There is no built in way in Avalonia to do this. It can be done though if you are willing to write the native interop code yourself. Avalonia generally exposes things like the native window handle which should be all you need to modify the window behaviour with native APIs. But not all platforms necessarily allow for clicking through windows.
For Linux you can use the XShape API. But there are almost no C# examples for it and the examples that do exist are in C++/C.
https://en.wikipedia.org/wiki/Shape_extension
For Windows you just need to set some window flags from memory. But I don't remember which ones.
https://learn.microsoft.com/en-us/windo…