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
Windows Support #6
Comments
It could really be a game changer for company internal applications! |
Agree. This is huge. The only other options now are: Qt Xaml which uses skia under the hood hilariously. Electron / webview. |
Since linux version is based on glfw3 (which is also available on windows) there's a possibility that it would work also on windows. I don't have access to windows machine, so you can try it yourselves 😉 |
The GLFW version is temporary; the goal is to have all platforms have something closer to the current macOS level of integration where the Flutter content can be an arbitrary view within the native application. A temporary GLFW build for Windows would be fine as well, but that wouldn't be the full implementation. |
@stuartmorgan what would be 'closer' on linux site then? |
GTK is a possibility that's currently being investigated. Now tracked as issue #23 since I hadn't filed it yet. |
What would be closer on the Windows OS then ? |
@stuartmorgan regarding the question above. |
Looks like the Engine builds on Windows now. |
For Windows the ideal solution would use Windows APIs directly. |
What about language preferences for writing plugins. Maybe the team has a
preference ?
C++, c# or other ?
…On Thu, Mar 22, 2018, 5:26 PM krisgiesing ***@***.***> wrote:
For Windows the ideal solution would use Windows APIs
<https://msdn.microsoft.com/en-us/library/aa383723(v=vs.85).aspx>
directly.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATuCwgj1ZruiqTPQc3hnootLRvet01Knks5tg9CagaJpZM4STp5K>
.
|
I don't have a Windows development background, so I don't have an informed opinion about whether C++ or C# is dominant enough within the domain to make it a clear choice for the API surface. I'm happy to hear arguments from people with significant Windows experience. (Absent any clear consensus for C# I would lean toward C++ for a few reasons.) |
C++ would allow sharing code across platforms in the plugin implementations. While this may not be a large surface area, there is at least some code in the TextInput area that would benefit from a shared model class. Also, the Flutter embedding API is in C, so use of it from C++ is straightforward; I'm not sure about the situation for C#. That said, like Stuart I do not have a deep Windows development background, so these are just surface observations. |
That's a really good point about reuse.
I am currently using golang to write some plugins. It's a little more work
but not much because the gomobile framework generates the binding for you
so you end up with a Android and iOS framework ready to be used.
On desktop you can call c libs that OS has but using system calls. If you
have many OS binaries or method calls to talk to use cgo or the excellent
CforGo project which code generates all the code from an xml file.
https://github.com/xlab/c-for-go
…On Sun, Mar 25, 2018, 4:02 AM krisgiesing ***@***.***> wrote:
C++ would allow sharing code across platforms in the plugin
implementations. While this may not be a large surface area, there is at
least some code in the TextInput are that would benefit from a shared model
class. Also, the Flutter embedding API is in C, so use of it from C++ is
straightforward; I'm not sure about the situation for C#.
That said, like Stuart I do not have a deep Windows development
background, so these are just surface observations.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATuCwnHG3WTugLPWoJSengPD_Ubk-sPZks5thvrDgaJpZM4STp5K>
.
|
There have discussion about code reuse across all desktops to replace GLFW and for the plugins. This might be a good example of it. Its a webview for all desktops that is written in C, and has wrappers from golang , rust and python ( separate repo). It also handles window aspects. |
@gedw99 I think there are diffrent. In flutter, the Paint is base. and Web has not the replacement. |
It's not written in portable C. It's a C wrapper around GTK-specific code on Linux, Win32 code on Windows, and ObjC Cocoa on macOS.
Yes, by implementing them using platform-specific toolkits, just like this project is doing on the platforms that have been implemented. What's missing for a Windows implementation of this project is not a conceptual understanding of what needs to be written or how to write it, it's someone actually doing the work. |
Good points and thanks for the clarification. I am not good enough at this level or coding to do the windows work. Wish I was. I hope someone that does have the skills on Windows picks this up. The Mac and Linux versions are amazing to use |
Would using SDL be ok ? I only ask because i have been playing around with a FLutter Desktop that uses SDL. |
This seems like the supported to support windows https://github.com/Microsoft/cppwinrt UPDATE: |
There are 3 options to embed the engine on Windows
The classic Win32 API could be used. This is the most powerful Windows API. But it's old, hard to use, is written in old C style. And not future proof (no UWP support).
Still as powerful as Win32. C++ API. But has additional install steps (user needs to install .Net redistributable packages) and does also not run on UWP.
I think the focus should be on this. The API is future proof, easy to use, state of the art (with markup language and touch support) and runs on all Windows 10 Platforms (Xbox One etc.). Microsoft itself is converting its desktop apps to this. The problem is MS is using a costum C++ dialect and I'm not sure how hard it would be to integrate the flutter engine. See: https://docs.microsoft.com/windows/uwp/get-started/create-a-basic-windows-10-app-in-cpp |
@b-strauss Can you link to any example code using the costum c++ UWP api ? I tend to agree. Also with the Windows Store becoming the only way to deploy (unless you ask a user to side load) you basically have no choice as a developer but to embrace the UWP. There is Winrt, which is now part of the latest Windows 10 SDK. But i have no idea what support for UWP it has. |
You have to be careful with the terminology here. There was/is C++/CX which is a C++ language extension to be used for UWP app development. The new thing now is C++/WinRT which is a new C++ "language projection" based on C++17 to be used for UWP app development (not to be confused with the actual Windows Runtime the platform runtime or WindowsRT a discontinued Windows mobile variant). IMHO we should be using the things Microsoft suggests, which is: The Universal Windows Platform API (UWP) for cross platform support together with C++/WinRT. https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/ To quote Microsoft:
https://blogs.msdn.microsoft.com/vcblog/2017/11/01/cppwinrt-is-now-included-the-windows-sdk/ Skia seems to have some level of support: |
@b-strauss The last to link to the SKIA winrt support is a big bonus !!! I am hoping that the team start on this. My problem right now is that there is no basic build for windows yet or even architectural clarification ( but winrt looks like the one to me). |
As mentioned above, I would be happy to review and land an initial basic build separate from a decision about long-term architecture (as with Linux and the GLFW implementation). Several people indicated interest on the mailing list in helping with a Windows implementation, but so far nobody has sent any PRs or otherwise followed up. |
Thanks for the response.
It would be great for this to move forward.
You mean an SDL based approach right ?
…On Mon, May 7, 2018, 7:49 PM stuartmorgan ***@***.***> wrote:
My problem right now is that there is no basic build for windows yet or
even architectural clarification
As mentioned above, I would be happy to review and land an initial basic
build separate from a decision about long-term architecture (as with Linux
and the GLFW implementation). Several people indicated interest on the
mailing list in helping with a Windows implementation, but so far nobody
has sent any PRs or otherwise followed up.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATuCwuL9Hu_mTEhL3zRvNfMkGOPHYh6qks5twIkTgaJpZM4STp5K>
.
|
Or GLFW, or any other workable interim solution. A simple throw-away implementation (enough to support drawing and mouse events) that lets people try it out on Windows would be useful to have until there's a full implementation. |
Ok so its more of a proof of concept.
Did some googling on this and it seems SDL proof of concept with SDL is
happening.
https://github.com/ds84182/flutter_sdl
- SDL based for Desktop.
- Nice thing abotu SDL of course is that its cross platform and so you get
All desktops and even rasp pi
flutter/engine#4730
- engine PR for Windows.
- waiting on beta 3 which was today :)
…On Tue, 8 May 2018 at 19:58 stuartmorgan ***@***.***> wrote:
Or GLFW, or any other workable interim solution. A simple throw-away
implementation (enough to support drawing and mouse events) that lets
people try it out on Windows would be useful to have until there's a full
implementation.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATuCwntYpel3m5faxI88ClTPG2FsO0lUks5twdzQgaJpZM4STp5K>
.
|
Just a note on OpenGL and desktop applications: with the Nvidia drivers (under assuming Nvidia card) these do not work properly with Remote Desktop (Intel's for example is fine, maybe AMD too). Off course there is Google angle, but it wraps GLES not OpenGL (or maybe I have outdated information). Just FYI |
I'll experiment with the UWP stuff over the long weekend. Maybe I can draw something onto the screen with angle, but my c++ knowledge is limited. |
@clarkezone I'm getting an error when running the code with Visual Studio 2017 Community Edition. Do I need another Visual Studio Version? Thanks. |
@b-strauss The currently landed code, which it looks like is what you are running there, is @CallumIddon's implementation, not the code @clarkezone has been working on (which is now tracked in #101) See the discussion at the end of #87; I'm also unable to run it from VS (although the error I saw was different), but it works for me from the command line. I'd suggest seeing if the same is true for you. Either way, please file a new bug for your issue so it can be tracked. |
@b-strauss should be fixed in #106. If you could test it and let me know in that pull if it works or not it would be greatly appreciated. |
TLDR - Delayloading (/DELAYLOAD:flutter_engine.dll) solves the crashing issue while debugging in Visual Studio. What happens is that in the debugger, or maybe due to other circumstances, some thread exited (happened to be from the NVIDIA drivers), which is normal and expected, but Dart, more specifically flutter_engine.dll has established this "DllMain"-like handler (for lack of better explanation): https://github.com/dart-lang/sdk/blob/master/runtime/vm/os_thread_win.cc#L712 - e.g.
and
Now if this handler is called with DLL_THREAD_DETACH reason (as it happened with NVIDIA's driver), then it'll try to:
but Dart::InitOnce (https://github.com/dart-lang/sdk/blob/master/runtime/vm/dart.cc#L111) wasn't yet called, which would later call "OS::InitOnce();" then call (for os_win.cc) "ThreadLocalData::InitOnce" which would've initialzied two globals (mutex_ and thread_locals_) which were actually NULL when this happened. Or maybe somewhat better order of initialization... |
Correct, that’s what I was seeing also. I have filed a bug on the dart project with a suggested fix.
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
…________________________________
From: malkia <notifications@github.com>
Sent: Sunday, July 15, 2018 6:38:18 PM
To: google/flutter-desktop-embedding
Cc: James Clarke; Mention
Subject: Re: [google/flutter-desktop-embedding] Windows Support (#6)
TLDR - Delayloading (/DELAYLOAD:flutter_engine.dll) solves the crashing issue while debugging in Visual Studio.
What happens is that in the debugger, or maybe due to other circumstances, some thread exited (happened to be from the NVIDIA drivers), which is normal and expected, but Dart, more specifically flutter_engine.dll has established this "DllMain"-like handler (for lack of better explanation): https://github.com/dart-lang/sdk/blob/master/runtime/vm/os_thread_win.cc#L712<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdart-lang%2Fsdk%2Fblob%2Fmaster%2Fruntime%2Fvm%2Fos_thread_win.cc%23L712&data=02%7C01%7C%7Cbc53b87430114e4ea42e08d5eabccee5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636673018995625033&sdata=Kjc8MdUcrB8xW7iZcPotxOGimdaV%2BkSMNiqS5466brY%3D&reserved=0> - e.g.
#pragma data_seg(".CRT$XLB")
PIMAGE_TLS_CALLBACK p_thread_callback_dart = OnDartThreadExit;
and
void NTAPI OnDartThreadExit(PVOID module, DWORD reason, PVOID reserved) {
if (!dart::private_flag_windows_run_tls_destructors) {
return;
}
// On XP SP0 & SP1, the DLL_PROCESS_ATTACH is never seen. It is sent on SP2+
// and on W2K and W2K3. So don't assume it is sent.
if (DLL_THREAD_DETACH == reason || DLL_PROCESS_DETACH == reason) {
dart::ThreadLocalData::RunDestructors();
dart::MonitorWaitData::ThreadExit();
}
}
Now if this handler is called with DLL_THREAD_DETACH reason (as it happened with NVIDIA's driver), then it'll try to:
dart::ThreadLocalData::RunDestructors();
dart::MonitorWaitData::ThreadExit();
but Dart::InitOnce (https://github.com/dart-lang/sdk/blob/master/runtime/vm/dart.cc#L111<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdart-lang%2Fsdk%2Fblob%2Fmaster%2Fruntime%2Fvm%2Fdart.cc%23L111&data=02%7C01%7C%7Cbc53b87430114e4ea42e08d5eabccee5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636673018995625033&sdata=MtPss4a%2F6frc4A6w3TX1BaJFE8QjoEyzLJkO11nAROY%3D&reserved=0>) wasn't yet called, which would later call "OS::InitOnce();" then call (for os_win.cc) "ThreadLocalData::InitOnce" which would've initialzied two globals (mutex_ and thread_locals_) which were actually NULL when this happened.
Or maybe somewhat better order of initialization...
[image]<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F51738%2F42740585-3b6a6b64-885e-11e8-89de-8735f2059a9c.png&data=02%7C01%7C%7Cbc53b87430114e4ea42e08d5eabccee5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636673018995625033&sdata=tOGNCPWebIb%2F1jheeQUoPs09HJsFNaIRyj27Ei7O9CQ%3D&reserved=0>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgoogle%2Fflutter-desktop-embedding%2Fissues%2F6%23issuecomment-405133788&data=02%7C01%7C%7Cbc53b87430114e4ea42e08d5eabccee5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636673018995625033&sdata=7SsvsjBgUrfUtnhHLtDJ%2FXEsfWsV5eCw5spX3%2BS0I%2F0%3D&reserved=0>, or mute the thread<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABE3OhHsxluNT-v9TWeSeXp06AGsk6JJks5uG-6KgaJpZM4STp5K&data=02%7C01%7C%7Cbc53b87430114e4ea42e08d5eabccee5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636673018995625033&sdata=MDAHWwcAeuBDBJhwo1F2t3FYPtMGs1bMUww7RVbAGOU%3D&reserved=0>.
|
Oh, sorry - should've checked your messages above. I've run into similar issue with https://github.com/ds84182/flutter_sdl and had to fix it, but now that I saw the change in the main line decided to give it a try. |
Seems to work fine, and flutter_gallery's example works too! Had to add whatever was done in the "example":
https://drive.google.com/open?id=1_DPr9kmoy3sGCCXb6WNAUoBkI6DcNHe4 (45mb zipped file with the gallery example). |
It seems like there should be an issue tracking all major operating systems. Windows support would also be awesome! :)
The text was updated successfully, but these errors were encountered: