Open chuckries opened 3 years ago
Hi @chuckries,
First of all, this is awesome! We love your enthusiasm here and really appreciate your work here and thoughtful discussion.
So, for the moment, I don't have any direct answers but again, thanks for your work here! I'm going to see who is the best person from those teams to ask about this and we'll get back to you. :)
@chuckries - We're ready to start working on this, if you are willing to contribute we would be thrilled. if not, we will continue to build on your contributions To answer your previous question, moving forward, the WinAppSDK Win2D branch will never be merged into the UWP Win2D codebase.
@juan- unfortunately I don't have time to fix up my branch to actually submit as a PR, but you are more the welcome to use that branch as a start. It has the bulk of the changes needed to get CanvasAnimatedControl off of ICoreDispatcher and onto IDispatcherQueue. In addition, the message loop that runs on the game loop thread likely needs to be much more robust. I was hoping the WinAppSDK would provide some sort of default message loops for IDispatcherQueue (similar to CoreDispatcher), but I haven't looked at this in some time. My understanding of IDispatcherQueue was that it would work with both CoreDispatcher based apps and win32 message loop based apps, but I'm not really sure. IDispatcherQueue appears to just provide the queue, and you have to bring your own message loop to process the queue. The exact behavior of the existing ICoreDispatcher::ProcessEvents and what is required to mimic it with a win32 message loop is a little out of my depth.
The win32 message loop I used seems to be fine for win32 apps, but I wasn't sure if it was the right thing for all application types that the WinAppSDK version of Win2D would be pulled into. The distinctions in windows land are confusing to me.
If I can help in any way I'm happy to do so and I will enjoy following CanvasAnimatedControl coming up in WinAppSDK Win2D.
I took a stab at getting CanvasAnimatedControl off the ground for WinUI 3. I was able to get it running, my branch is here and I am happy to clean it up and contribute it if there is interest.
The work left me with a primary question: Is there an expectation for Microsoft.Graphics.Win2D to support UWP in the future? Or should UWP always use Win2D.uwp?
This question focuses on the use of win32 API's within Win2D and the packaging expectation. The primary issues with CanvasAnimatedControl in WinUI is the lack of CoreDisptacher. WinUI has DisptacherQueue, but this requires a "bring your own message loop" solution currently. I was able to make this work by using a very simple win32 GetMessage/DispatchMessage loop, but these API's aren't available in UWP (at least through winuser.h, maybe I'm missing something). These API's can be used in MSIX packaged apps (like WinUI 3 Desktop Apps), but my understanding is that WinUI 3 will also be supported in UWP, in which case these API's are not available. I also don't know if WinUI 3 plans to offer a message loop solution over the top of DispatcherQueue, my understanding is that DispatcherQueue can at least interop with an existing win32 message loop (which CoreDispatcher can't).
Any thoughts? I'm just trying to understand the UWP vs WinUI space, and if MS.Graphics.Win2D is hoping to support WinUI within the scope of UWP or will only be WinUI Desktop.
I found it very interesting working on this and was really excited to get it working, I'd love to contribute something but I'm just not sure what the "right" thing is regarding an "abstract message loop runner" is for WinUI.
Thanks!