Skip the window key (both left and right) on Windows#84292
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
I investigated this problem and submitted PR flutter-team-archive/engine#26757 that likely solves this issue. Thanks for your contribution all the same, especially the reproducing steps. |
十分感谢,请问实测可以解决此问题吗? |
|
是的,实测在master上重现了这个问题,而在这个PR之后这个问题同样的步骤无法重现。 |
感谢,实测在我的电脑上 master channel 已解决此问题(即包含 flutter-team-archive/engine#26757 的 flutter engine,前两天才能 upgrade 到) 目前我这里还有三个比较迫切的影响 Windows 中文用户体验的小问题需要解决:
希望桌面端上 flutter 的行为更符合预期,同时期待更丝滑的交互体验,加油,再次感谢。 |
This PR solves the following issues:
Related to:
解决了一个影响广泛的、非常影响 Windows 中文用户体验的、release-blocker 级别的 BUG。
详述:上个月我遇到了它,即 backspace 键不起作用,反复试了一段时间后发现从英文切换到中文输入就会这样,一度以为是微软拼音的问题,十分郁闷,吃饭路上研究了一下输入法原理,又觉得不应该是它的问题。继续测试,发现
window + space切换键盘布局就会导致此问题,同时window + backspace却能神奇地解除此状态,这就很迷惑了...决定调试下 flutter 框架的代码,最后发现是 window 键“卡住”了,被误认为一直按着,而 backspace 等键则会被忽略(只剩 IME 能用):flutter/packages/flutter/lib/src/rendering/editable.dart
Lines 663 to 671 in 6827968
所以问题很明显了:
window + *的系统热键会导致 flutter 窗口失去焦点,从而没有捕获到 window 键弹起的消息。然而 Windows 上的 flutter 程序并不需要响应系统热键,始终忽略 window 键是一个合适的选择。
我先是修改了 win32_window.cpp,发现不起作用,经反复调试,推测是因为 raw_keyboard.dart 中的 methodChannel 调用的是预编译的 flutter_windows.dll,于是转而修改
raw_keyboard_windows.dart,完美解决问题:考虑到还有非常多的人遇到了此问题,且这个 BUG 是 release-blocker 级别的,不解决就无法发布软件,所以今天用这个号提交 PR。同时麻烦跟进其它系统中的类似问题,希望 flutter 对桌面端的支持尽快完善,谢谢。