182 Commits

Author SHA1 Message Date
Robert Ancell
8e621546e8 Fix typo in documentation for FlPlatformPlugin (flutter/engine#22426) 2020-11-12 12:02:44 +13:00
William Wold
3fe0d1f1d0 Set the IM context when showing the input method (flutter/engine#21896) 2020-11-06 09:22:17 +13:00
stuartmorgan
156dafb961 Switch Linux embedding to proc table embedder API (flutter/engine#22280)
Switches the Linux embedding from the standard C API to the new proctable version, to allow for unit testing of the embedding layer separately from the embedder APIs implementation.
2020-11-04 15:12:44 -08:00
Omar Emara
fc87f2df63 Fix Linux handling of window exposure events (flutter/engine#22268)
Currently, the Linux embedder does not handle window exposure events.
This is typically not a problem for users who use compositing window
managers, since they keep the display buffers even if the window is
completely covered. However, for users that don't use a compositor, the
window will not be redrawn by the engine if it was previously covered
until another event triggers the redraw.

This patch implements the GtkWidget draw callback to handle window
exposure events. The callback doesn't actually draw anything, it just
schedule a frame for drawing by the engine.

The engine doesn't support exposure events, so instead, we force redraw
by sending a window metrics event of the same geometry. Since the
geometry didn't change, only a frame will be scheduled.
2020-11-04 16:43:47 +13:00
Robert Ancell
396ad5a9a9 Add braces on if statements to match linter style (flutter/engine#22130) 2020-11-03 12:32:39 +13:00
Robert Ancell
524a96de10 Fix warning when no entrypoing args provided. (flutter/engine#22136)
Fixes errors like:
GLib-CRITICAL **: 14:20:17.248: g_strv_length: assertion 'str_array != NULL' failed

Introduced in fe489569a722816acab038ebe0f882722d2434ee
2020-10-30 14:57:35 +13:00
Robert Ancell
904e5d491e Fix incorrect parameter used for self object (flutter/engine#22135)
Fix incorrect parameter used for self object

Rename the GWeakNotify function parameters.
This matches the prototype and makes it harder to accidentally use the object
parameter the wrong way.
2020-10-30 14:52:24 +13:00
J-P Nurmi
30b8a62f7f Fix FlTextInputPlugin tear down (flutter/engine#22007) 2020-10-29 15:18:04 -07:00
J-P Nurmi
f1621c0370 Fix typos in FlValue docs (flutter/engine#21875) 2020-10-29 15:13:04 -07:00
Anirudh Balaji
07498fbc67 Refactor make_mock_engine into fl_test (flutter/engine#21585) 2020-10-29 15:08:03 -07:00
Robert Ancell
eb7e81fe4c Add FlEventChannel (flutter/engine#21316)
Related to https://github.com/flutter/flutter/issues/65270
2020-10-22 15:06:52 -07:00
stuartmorgan
10a7448f57 Revert "Revert "Explicitly make the X connection for EGL. (#21831)" (#21851)" (flutter/engine#21871)
This reverts commit 12cd3076aff3accf56e399b0d56f69b3f3fdf520.
2020-10-22 13:50:14 -07:00
George Wright
fe489569a7 Plumb through Dart entrypoint arguments on the Linux embedder (flutter/engine#21933) 2020-10-22 09:47:04 +13:00
Damian Wrobel
16f0aff1a2 Fix linking issue (missing wayland-client library) (flutter/engine#21408)
As fl_renderer_wayland.cc uses directly some of the wayland-client
related functions it should also add this library as a dependency.
2020-10-20 05:47:40 -07:00
Chris Bracken
617f0096e3 Add multi-step input method support for Linux (flutter/engine#21897)
This implements the Gtk hooks required to support multi-step input
methods on Linux. This builds on the support for composing regions
(preedit region in Gtk terminology) added to TextInputModel in
https://github.com/flutter/engine/pull/21682.

Specifically, the following changes are included:

1. Add handler for TextInput.setMarkedTextRegion framework messages: On
any change to the EditableText in the framework, this message is sent
which provides an updated rect (in the local co-ordinates of the
EditableText) for the composing region. If not in composing mode, the
cursor rect is sent.

2. Add handler for TextInput.setEditableSizeAndTransform framework messages:
On any change to the RenderObject underlying the EditableText, an
updated size for the full EditableText widget, as well as an affine
transform matrix from local co-ordinates to Flutter root co-ordinates is
sent.

3. On either of the above messages, we use the transformed composing
rect to compute the cursor position in Gtk window co-ordinates and
inform Gtk, so that it can position any system IM composing window
correctly for on-the-spot composing, such as is used when inputting
Japanese text.

4. Adds handlers for preedit-start, preedit-changed, and preedit-end
signals from Gtk. These are passed on to the TextInputModel.

5. Updates the preedit-commit handler to commit the composing region to
the text or, if not composing, insert new text at the cursor.

6. Updates the handler for TextInput.setEditingState framework messages
to extract the composing range base and extent and pass these on to
TextInputModel.

7. Updates update_editing_state function to set composing base and
extent on text input state updates sent to the framework.
2020-10-19 16:25:56 -07:00
J-P Nurmi
3e2a675dfa FlTextInputPlugin: fix memory leaks (flutter/engine#21879)
This PR fixes a few small memory leaks in FlTextInputPlugin. All three cases
are creating temporary FlValue instances for lookups and comparison without
ever releasing them.
2020-10-19 16:23:10 -07:00
Chris Bracken
aa0ad5a83e Update FLUTTER_NOLINT uses to include issue link (flutter/engine#21921)
In an upcoming patch, we'll enable enforcement that all FLUTTER_NOLINT
comments include an issue link. This migrates the remaining uses to that
format.

Bug: https://github.com/flutter/flutter/issues/68273
2020-10-16 16:08:36 -07:00
Chris Bracken
60e1170f62 Migrate TextInputPlugin API to TextRange (flutter/engine#21854)
Replaces selection_base() and selection_extent() with selection() and
SetSelection(int, int) with SetSelection(range).

This also adds the following convenience methods to TextRange:
* reversed()
* Contains(size_t position)
* Contains(const TextRange& range)

as well as operator== for use in unit tests. When Flutter migrates to
C++20, we can replace that method with a default declaration.
2020-10-15 09:54:06 -07:00
gaaclarke
12cd3076af Revert "Explicitly make the X connection for EGL. (#21831)" (flutter/engine#21851)
This reverts commit a9019523c09d8c50e2f9e29d3246825cad886f64.
2020-10-14 16:30:40 -07:00
Robert Ancell
a9019523c0 Explicitly make the X connection for EGL. (flutter/engine#21831)
Explicitly make the X connection for EGL.

EGL can mistakenly choose the GBM backend when using EGL_DEFAULT_DISPLAY.

Fixes https://github.com/flutter/flutter/issues/60429
2020-10-15 11:06:08 +13:00
Damian Wrobel
cc2aa3ca3c Support Wayland only (without X11 support in gdk) (flutter/engine#21218)
Adds a support for compiling flutter engine when
gdk does not have X11 backend. In such a configuration
the generated gdkconfig.h header file looks like the following:

 /* gdkconfig.h
  *
  * This is a generated file.  Please modify `configure.ac'
  */

 #ifndef __GDKCONFIG_H__
 #define __GDKCONFIG_H__

 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
 #error "Only <gdk/gdk.h> can be included directly."
 #endif

 #include <glib.h>

 G_BEGIN_DECLS

 #define GDK_WINDOWING_WAYLAND

 G_END_DECLS

 #endif  /* __GDKCONFIG_H__ */

Additionally headers like <gdk/gdkx.h> are not available at all.

Above configuration can be found on the most of the embedded systems.

This patch enables compilation of X11 specific code only when gdk
defines GDK_WINDOWING_X11.

Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
2020-10-13 15:54:44 +13:00
J-P Nurmi
9453cb51b6 Add workaround for missing fl_method_xxx_response_get_type() symbols (flutter/engine#21405) 2020-10-12 19:32:02 -07:00
J-P Nurmi
232410d279 fl_method_response.cc: fix lint failures (flutter/engine#21406)
Fix lint issues caused by `google-readability-braces-around-statements`.
2020-10-08 14:47:07 -07:00
Justin McCandless
30ff61de06 hasStrings Linux (flutter/engine#21388)
hasStrings method for clipboard status, Linux
2020-10-06 16:29:12 -07:00
stuartmorgan
983e9db4f8 [linux] Allow engine flags via environment vars (flutter/engine#21497)
Adds the ability to pass engine switches temporarily at runtime via
environment variables. Uses the same approach recently added to
Windows and macOS.

This is enabled only for debug/profile to avoid potential issues with
tampering with released applications, but if there is a need for that in
the future it could be added (potentially with a whitelist, as is
currently used for Dart VM flags).

Fixes flutter/flutter#60393
2020-10-06 11:17:19 -07:00
Chris Bracken
ae54caed8c Separate mutators for text and selection (flutter/engine#21612)
Previously, TextInputModel's SetEditingState method was a 1:1 mapping of
the underlying protocol used on the text input channel between the
framework and the engine. This breaks it up into two methods, which
allows the selection to be updated independently of the text, and avoids
tying the API the the underlying protocol.

This will become more important when we add additional state to support
composing regions for multi-step input methods such as those used for
Japanese.

SetText resets the selection rather than making a best-efforts attempt
to preserve it. This choice was primarily to keep the code simple and
make the API easier to reason about. An alternative would have been to
make a best-effort attempt to preserve the selection, potentially
clamping one or both to the end of the new string. In all cases where an
embedder resets the string, it is expected that they also have the
selection, so can call SetSelection with an updated selection if needed.
2020-10-06 11:07:21 -07:00
Robert Ancell
1e7257eb84 Detect errors encoding method channel responses (flutter/engine#21314) 2020-09-25 10:33:38 +12:00
Robert Ancell
4a218b9995 Fix segfault if engine is disposed with an uncompleted task. (flutter/engine#21234) 2020-09-24 11:29:38 +12:00
Damian Wrobel
ededf03020 Add missing cstring header (fixes fl_renderer_wayland.cc) (flutter/engine#21217) 2020-09-16 09:07:01 -07:00
William Wold
983b6a8636 Add Linux Wayland support (flutter/engine#20629) 2020-09-16 14:13:06 +12:00
Damian Wrobel
2c4ff91e3c Add missing <cstring> header for (strcmp, strrchr) (flutter/engine#21176)
Fixes the following compilation errors:
../../flutter/shell/platform/linux/fl_platform_plugin.cc:89:7: error: use of undeclared identifier 'strcmp'
  if (strcmp(format, kTextPlainFormat) != 0) {
      ^
../../flutter/shell/platform/linux/fl_platform_plugin.cc:127:7: error: use of undeclared identifier 'strcmp'
  if (strcmp(method, kSetClipboardDataMethod) == 0)
      ^
../../flutter/shell/platform/linux/fl_platform_plugin.cc:129:12: error: use of undeclared identifier 'strcmp'
  else if (strcmp(method, kGetClipboardDataMethod) == 0)
           ^
../../flutter/shell/platform/linux/fl_platform_plugin.cc:131:12: error: use of undeclared identifier 'strcmp'
  else if (strcmp(method, kSystemNavigatorPopMethod) == 0)
           ^
../../flutter/shell/platform/linux/fl_view.cc:194:7: error: use of undeclared identifier 'strcmp'
  if (strcmp(pspec->name, "scale-factor") == 0) {
      ^
../../flutter/shell/platform/linux/fl_engine.cc:67:18: error: use of undeclared identifier 'strrchr'
  gchar* match = strrchr(l, '@');
                 ^
../../flutter/shell/platform/linux/fl_engine.cc:75:11: error: use of undeclared identifier 'strrchr'
  match = strrchr(l, '.');
          ^
../../flutter/shell/platform/linux/fl_engine.cc:83:11: error: use of undeclared identifier 'strrchr'
  match = strrchr(l, '_');
          ^

Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
2020-09-15 08:05:12 -07:00
Greg Spencer
b78f92a7c5 Track lock key down state instead of lock state (flutter/engine#20836)
This converts the GTK keyboard code to track the key down states of the lock modifiers NumLock and CapsLock so that they represent the actual "down" state of the key, rather than the lock state itself.

GTK tracks the lock state, and Flutter expects the down state.
2020-09-13 14:44:25 -07:00
Chris Bracken
2586db3b22 Clean up C++ includes (flutter/engine#21127)
Cleans up header order/grouping for consistency: associated header, C/C++ system/standard library headers, library headers, platform-specific #includes.

Adds <cstring> where strlen, memcpy are being used: there are a bunch of places we use them transitively.

Applies linter-required cleanups. Disables linter on one file due to included RapidJson header. See https://github.com/flutter/flutter/issues/65676

This patch does not cover flutter/shell/platform/darwin. There's a separate, slightly more intensive cleanup for those in progress.
2020-09-11 21:18:35 -07:00
Chris Bracken
d03692449b Prefer C++ standard headers to their C counterpart (flutter/engine#21091)
We currently use a mix of C standard includes (e.g. limits.h) and their
C++ variants (e.g. climits). This migrates to a consistent style for all
cases where the C++ variants are acceptable, but leaves the C
equivalents in place where they are required, such as in the embedder
API and other headers that may be used from C.
2020-09-11 17:10:00 -07:00
Chris Bracken
7acd2b407c Fix linter errors in mock_engine (flutter/engine#21102)
Make a single-param ctor explicit in order to prevent surprising
implicit conversions.

Add a check for zero message-size and don't malloc/memcpy the incoming
message in those cases.

Add braces where they were missing.
2020-09-11 10:27:00 -07:00
Damian Wrobel
d71cece456 Add missing <cstring> header (flutter/engine#21069)
Fixes the following compilation errors:

../../flutter/shell/platform/linux/fl_value.cc:267:3: error: use of undeclared identifier 'memcpy'
  memcpy(self->values, data, sizeof(uint8_t) * data_length);
  ^
../../flutter/shell/platform/linux/fl_value.cc:284:3: error: use of undeclared identifier 'memcpy'
  memcpy(self->values, data, sizeof(int32_t) * data_length);
  ^
../../flutter/shell/platform/linux/fl_value.cc:294:3: error: use of undeclared identifier 'memcpy'
  memcpy(self->values, data, sizeof(int64_t) * data_length);
  ^
../../flutter/shell/platform/linux/fl_value.cc:304:3: error: use of undeclared identifier 'memcpy'
  memcpy(self->values, data, sizeof(double) * data_length);
  ^

../../flutter/shell/platform/linux/fl_string_codec.cc:29:28: error: use of undeclared identifier 'strlen'
  return g_bytes_new(text, strlen(text));
                           ^

../../flutter/shell/platform/linux/fl_standard_message_codec.cc:512:23: error: use of undeclared identifier 'strlen'
      size_t length = strlen(text);
                      ^

Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
2020-09-10 09:24:54 -07:00
William Wold
2752ef1dcd Replace FlRenderer::get_visual() with more generic FlRenderer::setup_window_attr() (flutter/engine#20833) 2020-08-28 14:31:34 +12:00
William Wold
aff51746dd Consolidate FlRenderer initialization into fl_renderer_start() (flutter/engine#20763) 2020-08-28 09:57:14 +12:00
Maksim Lin
37da36ab16 send newline char when input type is multiline (flutter/engine#20660) 2020-08-25 10:51:02 -07:00
William Wold
ef326b26ef Improve FlRenderer interface in preperation for Wayland on Linux (flutter/engine#20006) 2020-08-05 12:04:01 +12:00
Robert Ancell
1a4c83514c Update code style to pass clang-tidy checks 2020-08-05 10:35:03 +12:00
Robert Ancell
ead38a2509 Fix Implments typo 2020-08-03 10:45:01 +12:00
Robert Ancell
41f57f117b Fix parameter names 2020-08-03 10:44:20 +12:00
Siva
03706dce89 Manual roll of Dart from 24c7666def...40fd1c456e (flutter/engine#20092)
* Manual roll of Dart from 24c7666def...40fd1c456e

dart-lang/sdk@40fd1c456e Revert "[dart:io] Add Abort() on HttpClientRequest"
dart-lang/sdk@17d7296a42 [vm/nnbd/bytecode] Fix reuse of type arguments in bytecode
dart-lang/sdk@58b6f40c73 Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns. (reland)
dart-lang/sdk@fc8a6d9f9b [VM/compiler] Dereference TypeRef literal when propagating constants.
dart-lang/sdk@0689ec527a Move "test.dart" (well, most of its contents) into pkg/test_runner.
dart-lang/sdk@1094b3c61d Prepare static error test updater tool to handle web tests.
dart-lang/sdk@b258585f2f [observatory] Migrate from deprecated isInstanceOf to isA.
dart-lang/sdk@dfe1d9b682 Disable OverrideContributor for Cider.
dart-lang/sdk@aea99b2f5c scope debug property assist to Diagnosticables
dart-lang/sdk@4b96f20a79 [dart:io] Add Abort() on HttpClientRequest
dart-lang/sdk@1b1a39708c [build] Use frameworks instead of libs
dart-lang/sdk@3fef522496 Revert "Reland "[vm] Replaces fuchsia.deprecatedtimezone""
dart-lang/sdk@8c664d4f3f Revert "Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns."
dart-lang/sdk@2efb5bebc7 [ dart:_http ] Fix typo in HTTP response timeline event
dart-lang/sdk@0884dae36c Revert "Fix the #include path for ICU headers"
dart-lang/sdk@5171534e81 Scope tweaks. Report REFERENCED_BEFORE_DECLARATION in more places.
dart-lang/sdk@6bba75079a Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns.
dart-lang/sdk@b4ebbb7f5c [build] Update gn to match Fuchsia
dart-lang/sdk@cb428a7a02 [dart2js] Remove old bug work around in collector.
dart-lang/sdk@08663c20ab Change flutter patch to match existing DEPS on master branch
dart-lang/sdk@146ad014d9 update js/meta for the 2.10 dev sdk
dart-lang/sdk@488c718793 [co19] Roll co19 to d79951e06e443213243e54c2c32694b79a221b65
dart-lang/sdk@ba20edd7be Add patch for flutter-engine when changing to version 2.10

* Rev buildroot to latest version.

* Update license.

* update.

* Update gn revision.

* Format BUILD.gn files as the gn revision has been updated.
2020-07-29 13:10:15 -07:00
stuartmorgan
cd66f501cb Fix invalid selection handling in text plugins (flutter/engine#19899)
The Windows, Linux, and GLFW embeddings (which all share a common code
ancestry) pass TextInput.setEditingState selection base and extents
straight through to the shared text model class. The model expects those
values to be valid, but the framework sends -1/-1 for "invalid"
selections, which happen for some empty text cases (e.g.,
TextFieldController.clear()).

This translates those invalid selection values to an empty selection at
the start of the string, as expected by the model.

Fixes https://github.com/flutter/flutter/issues/59140
2020-07-27 11:00:02 -07:00
William Wold
f9535697d8 Change FlView::renderer from X11-specific to generic 2020-07-22 11:17:38 +12:00
William Wold
31b6df06b4 Call eglGetError() before other EGL calls that will wipe it 2020-07-22 11:17:38 +12:00
Tong Mu
78f0fc74d9 Add all system cursors (engine) (flutter/engine#19550)
* Support all system cursors in WIn, Linux, mac, Web and Android.
2020-07-15 15:37:18 -07:00
Tong Mu
a7cf911b7e Linux: Use a hash table to map cursors (flutter/engine#19561)
Refactors the process of looking up system mouse cursor value, so that instead of a linear search it uses a hash table.
2020-07-13 13:32:13 -07:00
Robert Ancell
7dc1897fba Fix clipboard paste functionality not working (flutter/engine#19489) 2020-07-10 11:34:23 +12:00