This change converts it from an events that spans a time interval
to an event that occurs at an instant.
We also emit this trace event when there is no lag as opposed to
only when there was a lag to make it monotonous.
Co-authored-by: Kaushik Iska <kaushikiska@google.com>
The C++ text input model used by Windows and Linux currently uses UTF-32. The intention was to facilitate handling of arrow keys, backspace/delete, etc., however since part of what is synchronized with the engine is cursor+selection offsets, and those offsets are defined in terms of UTF-16 code units, this causes very bad interactions with the framework-side model.
This converts to using UTF-16, rather than UTF-32, so that the offsets align with the framework. It also adds surrogate pair handling to the operations that adjust indexes, to avoid breaking surrogate pairs. (Arbitrary grapheme cluster handling is out of scope for this PR; while definitely desirable in the long term, surrogate pair handling is much more critical since improper handling yields invalid UTF-16, which breaks the text field).
This partially fixes https://github.com/flutter/flutter/issues/55014. A framework-side fix is also necessary (since currently both the engine and the framework attempt to handle arrow keys, which is another out-of-scope-for-this-PR issue), but even without the framework fix this dramatically improves the cursor behavior on Windows when there are surrogate pairs somewhere in the string since at least the two sides agree on what indexes mean.
Includes minor plumbing changes to the text input plumbing on Windows so that we're not pointlessly converting from UTF-16 to UTF-32 and then back to UTF-16.
Fixes a few issues with Windows text input:
- Filters out ASCII control characters
- Filters out lead surrogates, which aren't valid UTF-16 on their own so will cause assertion failures if sent to Flutter
- Adds a bandaid fix for a crash due to mismatches in indexing in the C++ and Dart text models. (A better fix would be to use UTF-16 and add surrogate pair handling to deletion and forward/back; that will be a later PR since it has a larger scope.)
Fixes https://github.com/flutter/flutter/issues/54879
The raster cache is critical for good performance. This
enables the cache and provides a GrContext to ScopedFrame
instances so the cache can be efficiently populated.
Small increase in peak GPU memory usage is expected from
this change. Otherwise, no change in behavior expected.
Fixes https://github.com/flutter/flutter/issues/54950
Co-authored-by: David Reveman <reveman@google.com>
16 MiB -> 28 MiB
Same size as what would be used on a 1024x600 display if we
allowed the common engine code to adjust this.
Co-authored-by: David Reveman <reveman@google.com>
The NSEvent->Flutter event conversion code for pointer events was
multiplying seconds by nanoseconds per milliseconds. While this does end
up giving the right number of microseconds, it's a very confusing way to
write it.
Fixes several bugs in the clipboard code, and makes some structural
improvements:
- Adds scoped wrappers for clipboard open/close and global lock/unlock,
to prevent missing cleanup, fixing at least one case where the lock
was not released.
- Adds the relevant window handle to the clipboard calls, since the docs
suggest that some operations won't work without one.
- Adds a missing clear step to setting the clipboard data.
- Switches from TEXT to UNICODETEXT to handle non-ASCII text correctly.
- To enable that, adds UTF-16/-8 conversion utilities built on the
Win32 APIs (rather than the deprecated std::codecvt functions, as
have been previously used in the engine).
- Fixes handling of getting data when the clipboard is empty, correctly
returning null.
- Passes more errors back through the method channel, with details, for
easier debugging of future issues.
Fixes https://github.com/flutter/flutter/issues/54226
Desktop embedding dependencies can trigger gn-generation-time
requiremenets; e.g., the Linux embeddings have pkg-config dependencies.
This can be problematic in some build environments, such as building
flutter_engine.so with a custom sysroot where those higher-level
dependencies aren't available.
This flag allows generating build files that don't have those
dependencies.
- Adds an explicit option for not building the GLFW embedding.
- Disables GLFW by default on Windows, where it's no longer the
uploaded embedding.
- Moves the X11 pkg-config, which is only used by the GLFW embedding,
behind the GLFW build flag.
Makes InvokeMethod's reply a high-level response object, rather than
binary data, matching the abstraction level of the class (and the other
languages' implementations).
In support of that:
- Adds the logic to the codecs to decode response envelopes, which had
never been implemented.
- Adds a convience implementation of MethodResult that forwards to
lambdas, so that one-off invocation handlers are easier to write.
Also simplified BinaryMessenger's API so that subclasses only need to
implement one version of Send, rather than two almost-identical versions.
Fixes https://github.com/flutter/flutter/issues/53223
The BaseInputConnection superclass does not call endBatchEdit
in setSelection and therefore does not implicitly cause
InputConnectionAdaptor to send a state update.
Some input modes such as numeric keypads will not function without
these updates.