microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.8k stars 320 forks source link

[RNW] GetForCurrentView API alternatives for islands #114

Closed asklar closed 2 years ago

asklar commented 4 years ago

React Native for Windows doesn't currently officially support islands today (on system xaml nor winui3) but I’m doing work to bring up islands support.

We have usages of a few WinRT types via GetForCurrentView which won't work in island scenarios, this tracks pursuing alternatives in Reunion that allow us to have a unified calling pattern for both win32 and UWP.

Members of DisplayInformation we use (after doing a GetForCurrentView):

There are a couple of other places where we do things like GetForCurrentView that we’ll need to figure out how to achieve with islands:

jonwis commented 4 years ago

Thanks - I see a bunch of APIs for this already available to your needs. You could potentially add the layer of indirection now, then help us make that indirection functionality part of Project Reunion. For example:

asklar commented 4 years ago

@jonwis any ideas for the other scenarios? e.g. detecting when the software keyboard shows/hides, etc.?

jonwis commented 4 years ago

For soft keyboard, can you use https://docs.microsoft.com/en-us/windows/win32/api/inputpaneinterop/nn-inputpaneinterop-iinputpaneinterop and then https://docs.microsoft.com/en-us/windows/uwp/design/input/respond-to-the-presence-of-the-touch-keyboard ?

What's left?

stevewri commented 4 years ago

@asklar - anything left (see Jon's question above)?

asklar commented 4 years ago

@stevewri @jonwis I was hoping Reunion would be this magic box I could call an API on and it would just work regardless of context (uwp/island/...). So maybe I should step back and ask...what is Reunion/how does it help me write converged uwp/win32 code? :) (happy to have this discussion offline too)

michael-hawker commented 3 years ago

@marb2000 @azchohfi these are the similar transitions needed for XAML Islands, those were all documented somewhere on docs.microsoft.com, right? Any insights here you can provide?

imbushuo commented 3 years ago

+1 for case in DisplayInformation. In this specifically case, a lot of Win32 applications do not have CoreWindow presence, for easier display information retrieval, something like DisplayInformation.GetForHwnd(hwnd) should be added. This will make querying HDR information on Win32 apps easier.

marb2000 commented 3 years ago

@asklar, @imbushuo I wrote several samples using the Win32 APIs that cover the majority of the gaps that there are in the platform. You can take a look at https://github.com/marb2000/DesktopWindow. Per the current engineering plan, these functionalities are not in Reunion v1.

jeffstall commented 2 years ago

Currently, it is recommended to use the various I*Interop APIs using HWNDs. See IPrintManagerInterop for an example. We are tracking this feature request to make improvements in the future.