未验证 提交 623d9ce1 编写于 作者: J James Clarke 提交者: GitHub

Windows: linker compatibility with AppContainer for winuwp target (#24318)

* Update Windows linker settings to be compatible with AppContainer when target==winuwp
上级 6b33d4ee
......@@ -245,6 +245,9 @@ if (enable_unittests) {
sources = [ "tests/embedder_unittests_proctable.cc" ]
defines = [ "FLUTTER_ENGINE_NO_PROTOTYPES" ]
if (is_win) {
libs = [ "psapi.lib" ]
}
deps = [
":embedder",
......
......@@ -170,7 +170,10 @@ executable("flutter_windows_unittests") {
testonly = true
if (target_os == "winuwp") {
libs = [ "windowsapp.lib" ]
libs = [
"windowsapp.lib",
"user32.lib",
]
}
# Common Windows test sources.
......
......@@ -122,7 +122,12 @@ KeyEventHandler::KeyEventHandler(flutter::BinaryMessenger* messenger,
kChannelName,
&flutter::JsonMessageCodec::GetInstance())),
send_input_(send_input) {
// As described in the header, UWP doesn't support the SendInput API hence we
// only need to assert that the delegate is null in the non-UWP case since it is
// expected to be null in the UWP case.
#ifndef WINUWP
assert(send_input != nullptr);
#endif
}
KeyEventHandler::~KeyEventHandler() = default;
......@@ -190,6 +195,15 @@ void KeyEventHandler::HandleResponse(bool handled,
std::cerr << "Unable to find event " << id << " in pending events queue.";
return;
}
// As described in the header, the user32 SendInput function is not supported in
// UWP appcontainer and there is no WinRT equivalent hence we pass null for
// SendInputDelegate param. Since this handler is one of last resort, it is
// only applicable for platformview scenarios where the host view can handle
// input events in the event the Flutter view does not choose to handle them.
// Since platformview is currently not support for desktop, there is no
// functional gap caused by this currently.
#ifndef WINUWP
INPUT input_event;
input_event.type = INPUT_KEYBOARD;
input_event.ki = *key_event;
......@@ -199,6 +213,7 @@ void KeyEventHandler::HandleResponse(bool handled,
"with scancode "
<< scancode << " (character " << character << ")" << std::endl;
}
#endif
}
}
......@@ -225,6 +240,10 @@ bool KeyEventHandler::KeyboardHook(FlutterWindowsView* view,
event.AddMember(kKeyMapKey, kWindowsKeyMap, allocator);
#ifndef WINUWP
event.AddMember(kModifiersKey, GetModsForKeyState(), allocator);
#else
// TODO: Implement modifiers in UWP codepath
// TODO: https://github.com/flutter/flutter/issues/70202
event.AddMember(kModifiersKey, 0, allocator);
#endif
switch (action) {
......
......@@ -27,8 +27,19 @@ class KeyEventHandler : public KeyboardHookHandler {
using SendInputDelegate =
std::function<UINT(UINT cInputs, LPINPUT pInputs, int cbSize)>;
// the user32 SendInput function is not supported in UWP appcontainer and there
// is no WinRT equivalent hence we pass null for SendInputDelegate param. Since
// this handler is one of last resort, it is only applicable for platformview
// scenarios where the host view can handle input events in the event the
// Flutter view does not choose to handle them. Since platformview is currently
// not support for desktop, there is no functional gap caused by this currently.
#ifdef WINUWP
explicit KeyEventHandler(flutter::BinaryMessenger* messenger,
SendInputDelegate delegate = nullptr);
#else
explicit KeyEventHandler(flutter::BinaryMessenger* messenger,
SendInputDelegate delegate = SendInput);
#endif
virtual ~KeyEventHandler();
......
......@@ -13,6 +13,14 @@ executable("testing") {
]
sources = [ "tester_main.cc" ]
if (is_win) {
libs = [
"psapi.lib",
"user32.lib",
"FontSub.lib",
"shlwapi.lib",
]
}
deps = [
"//flutter/assets",
......
......@@ -105,6 +105,8 @@ def to_gn_args(args):
gn_args['skia_use_fontconfig'] = args.enable_fontconfig
gn_args['flutter_use_fontconfig'] = args.enable_fontconfig
gn_args['flutter_enable_skshaper'] = args.enable_skshaper
if args.target_os == 'winuwp':
gn_args['skia_enable_winuwp'] = True
if args.enable_skshaper:
gn_args['skia_use_icu'] = True
gn_args['skia_enable_icu_ubrk_safeclone'] = True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册