272 Commits

Author SHA1 Message Date
Tong Mu
e6f56a53ff [Linux] Make unit tests abort on critical errors, and fix two such errors (flutter/engine#32348) 2022-04-28 15:24:05 -07:00
J-P Nurmi
ef3ff4212e [Linux] add missing ATK_STATE_SENSITIVE flag (flutter/engine#32487)
Fixes: flutter/flutter#101500
2022-04-27 09:19:57 +12:00
J-P Nurmi
050055f52c [Linux] fix and test light vs. dark theme detection (flutter/engine#32618) 2022-04-26 10:39:03 -07:00
Tong Mu
d5820083a5 [Linux, Keyboard] Derive keyboard layout using printable information from system (flutter/engine#32665)
* Workable layout deduction

* Compilable test

* Tests

* Remove print, format

* Use new way to pass logical key

* Use unique_ptr

* Format

* Fix matrix format

* Format

* Cleanup

* Remove duplicate

* Remove printf

* Update shell/platform/linux/fl_keyboard_manager.cc

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
2022-04-21 00:48:22 -07:00
William Wold
59fa2c79e1 Linux/GTK: Do not jump cursor to start on preedit change (flutter/engine#32083)
Fixes https://github.com/flutter/flutter/issues/97032
2022-04-20 10:34:03 -07:00
J-P Nurmi
1bfba47c48 [Linux] add MockSignalHandler for testing GObject signals (flutter/engine#32650) 2022-04-14 13:19:05 -07:00
J-P Nurmi
4248b9b708 [Linux] add (Fl)MockBinaryMessenger for GMock (flutter/engine#32649) 2022-04-14 13:14:05 -07:00
J-P Nurmi
0002a8f57c [Linux] add GTest printer for FlValue (flutter/engine#32652)
Improves test failure messages when matching FlValue arguments.

For example, before:

  Expected arg #2: has setting ("platformBrightness", 0x32f0980)
           Actual: 0x7f81ec005990, 0x32f0900

And after:

  Expected arg #2: has setting ("platformBrightness", dark)
           Actual: 0x27bded0, {textScaleFactor: 0.0, alwaysUse24HourFormat: false, platformBrightness: light}
2022-04-14 10:52:51 +12:00
J-P Nurmi
f47c6428ec [Linux] add missing AtkObject::get_index_in_parent implementation (flutter/engine#32499) 2022-04-12 20:44:05 -07:00
Tong Mu
fd61f28c45 [Linux, Keyboard] Extract KeyboardManager's external dependencies as ViewDelegate; Rework testing framework (flutter/engine#32305) 2022-04-12 14:19:04 -07:00
J-P Nurmi
e2c68680b7 [linux] fix accessibility roles for radios and switches (flutter/engine#32454) 2022-04-07 16:16:03 -07:00
Tong Mu
60a3850cf5 [Linux, Keyboard] Make keyboard tests use unique_ptr and vector (flutter/engine#32372)
* Tester

* redispatched

* Correct events

* Format

* CallRecord

* nonnulaable call_records

* dispatch unique_ptr

* Remove print

* format

* Remove print

* Update shell/platform/linux/fl_keyboard_manager.h

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
2022-03-31 19:34:02 -07:00
Tong Mu
13e62bd9c7 [Linux, Keyboard] Convert duplicate down events to repeat events (flutter/engine#32261) 2022-03-25 16:36:08 -07:00
Renzo Olivares
0d9b02f227 Linux deltas double free and newline fix (flutter/engine#32168)
* Fix double free

* Fix entering a newline

* Formatting

Co-authored-by: Renzo Olivares <roliv@google.com>
2022-03-22 12:13:13 -07:00
Robert Ancell
8aa424bd89 Changed the default a11y node role from ATK_ROLE_FRAME to ATK_ROLE_PANEL (flutter/engine#31602) 2022-03-10 22:55:11 -08:00
Robert Ancell
6f6f57f38f Fix signals adding/removing a11y nodes in Linux. (flutter/engine#31601) 2022-03-10 22:50:06 -08:00
Robert Ancell
b58e7be9b6 Set a11y roles for checks, toggles and sliders. (flutter/engine#31600) 2022-03-10 22:40:05 -08:00
Robert Ancell
d3517e43a9 Generate a11y events for widgets that use kFlutterSemanticsFlagIsToggled (flutter/engine#31582) 2022-03-10 22:35:10 -08:00
Justin McCandless
53425594be Bugfix: linux deltas should use selection here, not composing (flutter/engine#31906)
Fix for TextEditingDeltas composing case.
2022-03-09 13:25:02 -08:00
Chris Bracken
8335c02fd1 [Linux] Fix CJK input (flutter/engine#31813)
Fixes an issue with CJK IMEs wherein a text input state update may be
sent to the framework that misleads the framework into assuming that IME
composing has ended.

As an example, when inputting Korean text, characters are built up keystroke by
keystroke until the point that either:

* the user presses space/enter to terminate composing and commit the
  character, or;
* the user presses a key such that the character currently being
  composed cannot be modified further, and the IME determines that the
  user has begun composing the next character.

The following is an example sequence of events for the latter case:

1. User presses ㅂ. Begin compose event followed by change event
   received with ㅂ. Embedder sends state update to framework.
2. User presses ㅏ. im_preedit_changed_cb with 바. Embedder sends state
   update to framework.
3. User presses ㄴ. im_preedit_changed_cb with 반.  Embedder sends state
   update to framework.
4. User presses ㅏ. At this point, the current character being composed
   (반) cannot be modified in a meaningful way, and the IME determines
   that the user is typing 바 followed by 나. im_commit_cb received with
   바, immediately followed by im_preedit_changed event with 나.

In step 4, we previously sent two events to the framework, one
immediately after the other:

* im_commit_cb triggers the text input model to commit the current
  composing region to the string under edit. This causes the composing
  region to collapse to an empty range.
* im_preedit_change_cb triggers the text input model to insert the new
  composing character and set the composing region to that character.

Conceptually, this is an atomic operation. The fourth keystroke causes
the 반 character to be broken into two (바 and ㄴ) and the latter to be
modified to 나. From the user's point of view, as well as from the IME's
point of view, the user has NOT stopped composing, and the composing
region has simply moved on to the next character.

Flutter has no concept of whether the user is composing or not other
that whether a non-empty composing region exists. As such, sending a
state update after the commit event misleads the framework into
believing that composing has ended. This triggers a serious bug:

Text fields with input formatters applied do not perform input
formatting updates while composing is active; instead they wait until
composing has ended to apply any formatting. The previous behaviour
would thus trigger input formatters to be applied each time the user
input caused a new character to be input. This has the add-on negative
effect that once formatting has been applied, it sends an update back to
the embedder so that the native OS text input state can be updated.
However, since the commit event is immediately followed by a
preedit change, the state has changed in the meantime, and the embedder
is left processing an update (the intermediate state sent after the
commit) which is now out of date (i.e. missing the new state from the
change event).

The source of this bug is as follows:
* Commit event for a character/compose region is sent from the engine.
  The engine TextInputModel still models its `composing` field as true.
  An update is sent to the framework with the committed text and an
  empty composing range such as (1, 1). Note that the engine previously
  only sends a range of (-1, -1) when composing has ended, NOT just when
  it has an empty composing region.
* Framework receives commit event and updates the text to match. The
  framework does not model the system composing state; instead its
  understanding of whether the user is composing or not is entirely
  predicated on whether the composing region is empty or not. If it is,
  it triggers input formatters, which in this case have no effect on the
  text/selection. However, the framework consistently models empty
  compose regions as (-1, -1) and resets the text editing value as such.
  Because the framework triggered a change to the TextEditingValue, it
  dutifully sends the update back to the engine.
* In the meantime, in parallel with the above step, the engine starts
  processing the change event immediately following the commit, and
  updates the text and composing region with the next character. This
  change is promptly stomped on by the incoming framework update.

To avoid this, we have the engine consistently send empty compose
regions as (-1, -1) to the framework. After the input formatter is
applied on commit, the compose region is still (-1, -1) and there are
therefore no diffs, and the framework will not send an update back to
the engine and stomp on any new state on the engine side.

Longer-term, we really should add some form of versioning information to
the text edit protocol so as to detect and resolve conflicts rather than
relying entirely on not creating races in the first place.

This bug was revealed by flutter/flutter#90211
which applies an input formatter to single-line text fields in order to
suppress newlines.

Issue: flutter/flutter#97174
2022-03-04 11:39:26 -08:00
godofredoc
64edff106a Generate linux gtk zip in the correct folder. (flutter/engine#31650) 2022-02-24 10:41:02 -08:00
Zachary Anderson
eca60c0b90 Add clang-analyzer-* and clang-diagnostic-* to .clang-tidy (flutter/engine#31291) 2022-02-09 12:26:34 -08:00
Justin McCandless
f3b4cf3045 Linux TextEditingDeltas (flutter/engine#29215)
The Linux platform can report the delta in text editing changes via enableDeltas, useful for custom rich text editors.
2022-02-07 14:58:48 -08:00
godofredoc
edb4651636 GN targets for generating release artifacts (flutter/engine#30679) 2022-01-05 12:10:02 -08:00
Robert Ancell
0e891a3c1d Update functions to be consistent with other code. (flutter/engine#29176)
Helper functions first, then callbacks/implementations, then public functions.
Add function comments.
Use consistent function naming.
Remove unnecessary protoypes.
Make a function static that wasn't.
2021-11-29 15:40:08 +13:00
Tong Mu
5077f867cf [Linux, Keyboard] Fix synthesization upon different logical keys (flutter/engine#29768)
This PR fixes an assertion error when the physical-logical map changes during key synthesization. This error will lead to irregular key sequences, and might occur during an extremely rare edge case described in the unit test in this PR.
2021-11-18 17:52:14 -08:00
Zachary Anderson
78d9e276e2 Fix some clang-tidy lints for Linux host_debug (flutter/engine#29734) 2021-11-18 13:08:01 -08:00
Chris Bracken
dd669f3631 Acquire context reference at the correct time for FlGlArea. (flutter/engine#29791)
This is a reland of flutter/engine#29178 onto the main branch. The
original patch was landed on the master branch during the branch switch
from master to main.
2021-11-17 11:04:33 -08:00
Tong Mu
d4d9c2aa4d [Linux keyboard] Fix logical keys of up events are not regularized (flutter/engine#29550)
This PR fixes a bug where up events from the embedder responder are not using the logical keys of the down events, breaking the regularization
2021-11-05 13:56:23 -07:00
Robert Ancell
702af087ba Can't test FlView on a server - no display 2021-10-29 11:46:22 +13:00
Robert Ancell
24372ebfa9 Move mock objects into separate modules 2021-10-29 11:46:22 +13:00
Robert Ancell
efe2f3ebfb Fix widget reference handling 2021-10-29 11:46:22 +13:00
Robert Ancell
1730ca3fee Make an interface for FlTextureRegistrar 2021-10-29 11:46:22 +13:00
Robert Ancell
e4951d8895 Make an interface for FlPluginRegistrar 2021-10-29 11:46:22 +13:00
Robert Ancell
66590346bf Make an interface for FlBinaryMessenger 2021-10-29 11:46:22 +13:00
Ahmed Ashour
acdc8a5c8b Fix typos (flutter/engine#29280) 2021-10-27 20:30:31 -07:00
Tong Mu
79249cf134 [macOS] Reset keyboard states on engine restart (flutter/engine#29283)
With this PR, the state of the keyboard system will be reset when the engine is reset (typically during a hot restart.)
2021-10-27 17:03:41 -07:00
Robert Ancell
0246f028f5 Add comment about why the present callback is empty 2021-10-27 15:27:29 +13:00
Robert Ancell
2d5c109c4d Remove unused present method
This is now done by the FlutterCompositor.present_layers_callback.
2021-10-27 15:27:29 +13:00
Tong Mu
e565b58d65 [Linux] Reset keyboard states on engine restart (flutter/engine#28877)
With this PR, the state of the keyboard system will be reset when the engine is reset (typically during a hot restart.)
2021-10-06 12:26:33 -07:00
Tong Mu
2e334c1134 Keyboard guarantee non empty events (flutter/engine#28648)
* Web

* macos

* Linux

* Easier web impl

* doc and format

* Better linux impl

* Format

* Better impl mac

* Format

* Windows

* Format

* Apply suggestions from code review

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
2021-10-04 14:01:51 -07:00
Tong Mu
f53ff208be [Linux] Fix crash when a method channel is reassigned (flutter/engine#28878)
* Impl

* Format

* Doc
2021-09-29 10:47:00 -07:00
Tong Mu
8ef081034c [Linux, Embedder] Add engine restart hooks (flutter/engine#28924)
* Restart

* Format

* Doc

* Test

* Format

* Revert keyboard
2021-09-29 10:46:43 -07:00
Yuhui Huang
1b2b1cae4c Linux texture support (flutter/engine#24916) 2021-09-23 13:53:02 -07:00
Brandon DeRosier
7b6fa075a7 Flip on leak detector and suppress or fix remaining leak traces (flutter/engine#28625)
Patch/suppress the remaining leaks and flip on the leak detector to start catching new leaks in CI.
2021-09-16 12:58:56 -07:00
Daco Harkes
eb9ef3e99c [Desktop][Linux] Add RUNPATH $ORIGIN to flutter_linux_gtk (flutter/engine#28525) 2021-09-13 07:57:29 +02:00
stuartmorgan
92341a8a64 Fix typo in FlMethodResponse docs 2021-09-01 16:46:08 +12:00
Shax
07e2ce8fd9 Rename fl_get_length to fl_value_get_length (flutter/engine#27757) 2021-08-26 13:06:02 -07:00
Brandon DeRosier
16829de462 Fix stack-buffer-overflow in linux value tests (flutter/engine#28204) 2021-08-19 13:51:24 -07:00
Tong Mu
b2924176cc [Keyboard] Send empty key events when no key data should (flutter/engine#27774)
The keyboard system on each platform now sends an empty key data instead of nothing if no key data should be sent.
2021-07-30 13:35:39 -07:00