dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Desktop wry child window support

Open vyeevani opened this issue 1 year ago • 3 comments
trafficstars

I'm trying to do native wgpu 3d rendering. There's an example in the wry library that demonstrates how this would be possible. You can create child wry window from the parent and do the WebView rendering there while the main window supports the 3d content rendering. If the window config accepted a flag that included a parent window then it could replicate that example allowing for native 3d without waiting for blitz to become stable.

vyeevani avatar Oct 23 '24 15:10 vyeevani

There's a few ways I can see this working for my use-case.

  1. have a single flag like "with_create_as_child_window". You could accept a rect in the flag specifying the rect but for my case I don't think that's really needed and can just be a bool
  2. separating the tightly coupled WebViewInstance constructor into multiple functions which gives composability to anyone that wants to create a webviewinstance. For example, pulling the tao window creation out of that function and into a separate window builder while having another "render builder" to handle the WebView related things
  3. allow passing in an already created window directly. This is pretty interesting to me as it allows for complex things like creating a window out of a surface which we can then composite in interesting ways downstream. For example, creating a small dioxus window which casts a shadow in a 3d render making it really useful for rendering game uis without spawning a whole bunch of separate tao windows.

The first way is by far the simplest while the other two require more rework. I'll put up a pr for the first thing to get myself unblocked but would be interested in hearing feedback on the other two strategies.

vyeevani avatar Oct 23 '24 15:10 vyeevani

https://github.com/DioxusLabs/dioxus/pull/3093

vyeevani avatar Oct 24 '24 16:10 vyeevani

This might also be useful for rendering a webview (whether for a dioxus app or an actual website) within a Blitz application...

nicoburns avatar Nov 18 '24 02:11 nicoburns