447 Commits

Author SHA1 Message Date
Robert Ancell
14ae687eac Make a mock messenger that can easily mock channels (flutter/engine#56867)
The previous mock required knowing the specific functions used in the
binary messenger, this method instead allows test code to provide
complete platform channel implementation for testing and make simulated
platform channel calls into embedder code.
2024-12-03 13:41:33 +13:00
Robert Ancell
983837c311 Fix GTask reference counting (flutter/engine#56866)
Incorrect reference counting of GTask objects meant platform channel
method calls would leave tasks alive that would leak memory and leave
unclosed references to the binary messenger.
2024-12-03 13:37:31 +13:00
Robert Ancell
aa01970589 Always check for errors when propagating task values. (flutter/engine#56856)
This could occur if a request is cancelled, without this it might not chain up to the original caller correctly.
2024-12-02 21:47:06 +00:00
richardexfo
c62bbc18ad Fix linux on vivante drivers. (flutter/engine#56862)
The same problem with NVIDIA drivers which causes issue [152099](https://github.com/flutter/flutter/issues/152099) occurs with Vivante Corporation drivers.

Quick fix for issue on Vivante drivers:  
https://github.com/flutter/flutter/issues/152099

- [ x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
- [ x] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
- [ x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
- [ x] I listed at least one issue that this PR fixes in the description above.
- [ x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests.
- [ x] I updated/added relevant documentation (doc comments with `///`).
- [ x] I signed the [CLA].
- [ x] All existing and new tests are passing.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-12-02 21:16:22 +00:00
Jason Simmons
d48ceb1ba2 Fix the mapping from exit response strings to the FlPlatformChannelExitResponse enum (flutter/engine#56769) 2024-11-25 14:02:28 +13:00
Robert Ancell
504bff9b26 Allow GTK style enum naming (flutter/engine#56731)
Remove the linting overrides for enum names and set this in the
clang-format file.
2024-11-21 15:16:43 +13:00
Robert Ancell
56686525b2 Split channel messaging out of handlers (flutter/engine#56667)
Split the channel messaging out of the system channels to make them
simpler to understand and refactor.

The new channel classes could be automatically generated in a second
phase, e.g. using Pigeon to reduce code usage.

The new classes don't have tests as they will already be covered by the
existing code.
2024-11-21 09:32:20 +13:00
Robert Ancell
3852b13841 Add missing cancellable to text input handler (flutter/engine#56666)
Without this if a channel method call was in progress and then the
handler was destroyed the call could attempt to access the destroyed
handler. This is possible as the handler is recreated on engine restart.

However, in this case the result is not used so no invalid memory access
would occur. Adding the cancellable fixes any future change where this
would no longer be the case.
2024-11-19 16:20:53 +13:00
Robert Ancell
4026506519 Move FlMouseCursorHandler from FlView to FlEngine (flutter/engine#56026) 2024-11-14 15:15:43 +13:00
Jason Simmons
3af706d188 [Linux] Configure depth and stencil framebuffer attachments needed for Impeller (flutter/engine#56516) 2024-11-12 22:47:30 +00:00
Robert Ancell
99c0b7b50d Add FlPointerManager to process pointer events from GTK in a form suitable for Flutter. (flutter/engine#56443)
This matches FlScrollingManager and FlKeyboardManager.

Add tests for this behaviour that was previously missing.
2024-11-12 14:29:42 +13:00
Robert Ancell
e9012014c0 Remove unused FlMockTextInputHandler (flutter/engine#56495)
This was the only thing that required FlTextInputHandler to be derivable, so also simplify the class.
2024-11-11 17:47:05 +00:00
Tristan Ross
84300e4029 [Linux] Replace deprecated macros in fl_application_test.cc (flutter/engine#56257)
Fixes this compile error:
```
[211/451] CXX obj/flutter/shell/platform/linux/flutter_linux_unittests.fl_application_test.o
FAILED: obj/flutter/shell/platform/linux/flutter_linux_unittests.fl_application_test.o
../../flutter/buildtools/linux-arm64/clang/bin/clang++ -MMD -MFobj/flutter/shell/platform/linux/flutter_linux_unittests.fl_application_test.o.d -DFLUTTER_ENGINE_NO_PROTOTYPES -DFLUTTER_LINUX_COMPILATION -DUSE_OPENSSL=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_LIBCPP_DISABLE_AVAILABILITY=1 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DSK_FONTMGR_ANDROID_AVAILABLE -DSK_TYPEFACE_FACTORY_FREETYPE -DSK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE -DSK_FONTMGR_FREETYPE_EMBEDDED_AVAILABLE -DSK_FONTMGR_FREETYPE_EMPTY_AVAILABLE -DSK_GL -DSK_VULKAN -DSK_CODEC_DECODES_JPEG -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_ICO -DSK_CODEC_DECODES_WEBP -DSK_HAS_WUFFS_LIBRARY -DSK_CODEC_DECODES_GIF -DSK_XML -DFLUTTER_RUNTIME_MODE_DEBUG=1 -DFLUTTER_RUNTIME_MODE_PROFILE=2 -DFLUTTER_RUNTIME_MODE_RELEASE=3 -DFLUTTER_RUNTIME_MODE_JIT_RELEASE=4 -DDART_LEGACY_API=\[\[deprecated\]\] -DFLUTTER_RUNTIME_MODE=1 -DFLUTTER_JIT_RUNTIME=1 -DIMPELLER_DEBUG=1 -DIMPELLER_SUPPORTS_RENDERING=1 -DIMPELLER_ENABLE_OPENGLES=1 -DIMPELLER_ENABLE_VULKAN=1 -DSK_CODEC_DECODES_BMP -DSK_CODEC_DECODES_WBMP -DSK_ENABLE_DUMP_GPU -DSK_FORCE_AAA -DSK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER -DSK_DISABLE_LEGACY_METAL_BACKEND_SURFACE -DSK_DISABLE_LEGACY_PARAGRAPH_UNICODE -DSK_USE_LEGACY_BLUR_RASTER -DSK_DISABLE_LEGACY_SHADERCONTEXT -DSK_DISABLE_LOWP_RASTER_PIPELINE -DSK_FORCE_RASTER_PIPELINE_BLITTER -DSK_METAL_WAIT_UNTIL_SCHEDULED -DSK_DISABLE_EFFECT_DESERIALIZATION -DSK_R32_SHIFT=16 -DSK_ENABLE_PRECOMPILE -DSK_GANESH -DSK_USE_PERFETTO -I../.. -Igen -I../../flutter/third_party/libcxx/include -I../../flutter/third_party/libcxxabi/include -I../../flutter/build/secondary/flutter/third_party/libcxx/config -I../../flutter -I../../flutter/third_party/dart/runtime -I../../flutter/third_party/dart/runtime/include -Igen/flutter -Igen/flutter/impeller/runtime_stage -I../../flutter/third_party/flatbuffers/include -I../../flutter/third_party/skia -I../../flutter/third_party/googletest/googlemock/include -I../../flutter/third_party/googletest/googletest/include -fno-strict-aliasing -fstack-protector --param=ssp-buffer-size=8 -fPIC -pipe -pthread --target=aarch64-linux-gnu -DBORINGSSL_CLANG_SUPPORTS_DOT_ARCH -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-implicit-int-float-conversion -Wno-deprecated-copy -Wno-psabi -Wno-deprecated-literal-operator -Wno-unqualified-std-cast-call -Wno-non-c-typedef-for-linkage -Wno-range-loop-construct -fdebug-prefix-map=/home/ross/flutter-engine/src/= -no-canonical-prefixes -fvisibility=hidden --sysroot=/nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f -Wstring-conversion -Wnewline-eof -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/x56wmsqb0cwv09iqivb7i9fx9iy5zlkf-gtk+3-3.24.43-dev/include/gtk-3.0 -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/as8vpbnch4a9n70x0v22pbmdp0zy0bj5-pango-1.52.2-dev/include/pango-1.0 -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/9n0d1issr9pmaqix7jgzp214mlnz4sw7-harfbuzz-9.0.0-dev/include/harfbuzz -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/22xgw9djkc5jrmm08f8qx8ki8a3yghy5-at-spi2-core-2.52.0-dev/include/atk-1.0 -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/xya3gcnd2ald7yqw1chvfsbrvfdivykh-cairo-1.18.2-dev/include/cairo -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/sd61i6hj14jvf83brrih1irmg7r0vb3v-freetype-2.13.3-dev/include/freetype2 -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/sd61i6hj14jvf83brrih1irmg7r0vb3v-freetype-2.13.3-dev/include -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/i2n1y998igf66wlz6b5yyc5fg1mjp5g7-gdk-pixbuf-2.42.12-dev/include/gdk-pixbuf-2.0 -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include/glib-2.0 -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/cw9qz08zwd1li8vd8lm0laywa6rsi3gs-glib-2.80.4/lib/glib-2.0/include -isystem../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/60vanm346k9kjx9adzpsqgci7m0z1b3n-libepoxy-1.5.10-dev/include -Wunreachable-code -Wno-newline-eof -fvisibility-inlines-hidden -std=c++17 -fno-rtti -nostdinc++ -nostdinc++ -fvisibility=hidden -fno-exceptions -Wno-inconsistent-missing-override   -c ../../flutter/shell/platform/linux/fl_application_test.cc -o obj/flutter/shell/platform/linux/flutter_linux_unittests.fl_application_test.o
../../flutter/shell/platform/linux/fl_application_test.cc:11:38: error: 'G_APPLICATION_FLAGS_NONE' is deprecated: Use 'G_APPLICATION_DEFAULT_FLAGS' instead [-Werror,-Wdeprecated-declarations]
   11 |       "com.example.TestApplication", G_APPLICATION_FLAGS_NONE);
      |                                      ^
../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include/glib-2.0/gio/gioenums.h:1545:28: note: 'G_APPLICATION_FLAGS_NONE' has been explicitly marked deprecated here
 1545 |   G_APPLICATION_FLAGS_NONE GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(G_APPLICATION_DEFAULT_FLAGS),
      |                            ^
../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include/glib-2.0/gio/gio-visibility.h:858:50: note: expanded from macro 'GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR'
  858 | #define GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
      |                                                  ^
../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include/glib-2.0/glib/gmacros.h:1313:43: note: expanded from macro 'GLIB_DEPRECATED_ENUMERATOR_FOR'
 1313 | #define GLIB_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f)
      |                                           ^
../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include/glib-2.0/glib/gmacros.h:1273:44: note: expanded from macro 'G_DEPRECATED_FOR'
 1273 | #define G_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
      |                                            ^
../../flutter/shell/platform/linux/fl_application_test.cc:16:13: error: 'G_APPLICATION_FLAGS_NONE' is deprecated: Use 'G_APPLICATION_DEFAULT_FLAGS' instead [-Werror,-Wdeprecated-declarations]
   16 |             G_APPLICATION_FLAGS_NONE);
      |             ^
../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include/glib-2.0/gio/gioenums.h:1545:28: note: 'G_APPLICATION_FLAGS_NONE' has been explicitly marked deprecated here
 1545 |   G_APPLICATION_FLAGS_NONE GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(G_APPLICATION_DEFAULT_FLAGS),
      |                            ^
../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include/glib-2.0/gio/gio-visibility.h:858:50: note: expanded from macro 'GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR'
  858 | #define GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
      |                                                  ^
../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include/glib-2.0/glib/gmacros.h:1313:43: note: expanded from macro 'GLIB_DEPRECATED_ENUMERATOR_FOR'
 1313 | #define GLIB_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f)
      |                                           ^
../../../../../../nix/store/l8f409nhbvgl4xgd3ka5bvqjqdr39l6w-flutter-engine-toolchain-af0f0d559c8a87d912a20971bbd84afc80a54b0f/nix/store/5bhcbbcl7p77zv5hx5bdnfggjlpmqzbq-glib-2.80.4-dev/include/glib-2.0/glib/gmacros.h:1273:44: note: expanded from macro 'G_DEPRECATED_FOR'
 1273 | #define G_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
      |                                            ^
2 errors generated.
[218/451] CXX obj/flutter/shell/platform/embedder/tests/embedder_unittests.embedder_gl_unittests.o
ninja: build stopped: subcommand failed.
```

*List which issues are fixed by this PR. You must list at least one issue.*

- https://github.com/flutter/flutter/issues/157906

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-08 21:31:19 +00:00
Robert Ancell
9df9cb0c8d Document fields in FlEngine (flutter/engine#56266)
Update documentation.
2024-11-06 12:34:19 +13:00
Robert Ancell
2a567cbef7 Remove unnecessary method for getting engine switches (command line). (flutter/engine#56265)
This method simply wrapped a common method, which is simpler to use
directly. The test only tested this common method, which already has
tests in common/.
2024-11-06 10:17:13 +13:00
Robert Ancell
a98f1eb4e2 Remove FlScrollingViewDelegate (flutter/engine#56270)
We can just contact the engine directly and test that by overriding the
engine API.
2024-11-06 10:16:49 +13:00
Robert Ancell
6966cb21a0 Clean up comments and names in FlView (flutter/engine#56084)
Add/update comments for clarity and ensure naming matches other code
conventions.
2024-10-26 02:50:37 +13:00
Robert Ancell
d62ce043c5 Move platform handler from FlView to FlEngine (flutter/engine#56024)
There can only be one handler and multiple views.
2024-10-26 02:46:45 +13:00
Robert Ancell
762302a69a Move get_keyboard_state from FlKeyboardViewDelegate to FlKeyboardManager. (flutter/engine#56021)
Like the other associated changes, I've added
fl_keyboard_manager_set_get_get_pressed_state_handler for now to keep
the tests working.
2024-10-23 23:05:21 +13:00
Robert Ancell
bb8679e23f Move send_key_event from FlKeyboardViewDelegate to FlKeyboardManager. (flutter/engine#56020)
Ideally the tests would mock FlEngine, but I wasn't able to get it
working so I've added fl_keyboard_manager_set_send_key_event_handler for
now.
2024-10-23 22:05:09 +13:00
Robert Ancell
15129c0bbc Move keymap from FlKeyboardViewDelegate to FlKeyboardManager (flutter/engine#55942)
Ideally the tests would mock gdk_keymap_lookup_key, but I wasn't able to get it working so I've added fl_keyboard_manager_set_lookup_key_handler for now.
2024-10-19 01:36:10 +00:00
Robert Ancell
aca239fe59 Move redispatch_event from FlKeyboardViewDelegate to FlKeyboardManager (flutter/engine#55941)
Events can only be redispatched using gdk_event_put which is not
dependent on the view.

Ideally the tests would mock gdk_event_put, but I wasn't able to get it
working so I've added fl_keyboard_manager_set_redispatch_handler for
now.
2024-10-18 14:34:52 +13:00
Robert Ancell
a54730d091 Remove FlKeyResponder and use the two responder classes directly. (flutter/engine#55925)
We only ever have two classes and implementation, so reduce complexity
by removing the parent class and related code.
2024-10-18 13:19:47 +13:00
Robert Ancell
2ccc210029 Remove obsolete fl_keyboard_view_delegate_get_messenger (flutter/engine#54857)
This is unnecessary - we already have the messenger.
2024-10-16 14:53:27 +13:00
Robert Ancell
6203c3e0f3 Split FlKeyboardManager out of FlKeyboardHandler (flutter/engine#55892)
They continue to share a FlKeyboardViewDelegate, but this will be split
too in a later change as part of moving these classes from FlView to
FlEngine.
2024-10-16 13:26:42 +13:00
Robert Ancell
db1e63b948 Simplify code for dispatching events (flutter/engine#55871) 2024-10-16 10:00:34 +13:00
Robert Ancell
0388529ef9 Use GWeakRef API (flutter/engine#55795)
For consistency with other code.
2024-10-14 14:36:37 +13:00
Robert Ancell
e0daa80cb2 Remove unnecessary use of std::vector (flutter/engine#55796) 2024-10-14 13:57:12 +13:00
Robert Ancell
7790182059 Remove fl_keyboard_view_delegate_subscribe_to_layout_change and just access the object directly via a method (flutter/engine#55817)
A step on the way to get FlKeyboardHandler out of FlView and into
FlEngine.
2024-10-14 13:54:05 +13:00
Robert Ancell
24ceeac432 Split out FlKeyboardLayout into its own class (flutter/engine#55816) 2024-10-14 12:07:26 +13:00
Robert Ancell
b9db87f8ac When rendering into secondary views, copy the pixel contents between contexts (flutter/engine#55639)
This is because GTK3 can't share contexts between GtkGLAreas.

We may be able to avoid the copy using the GL_OES_EGL_image or
GL_OES_EGL_image_external extensions.

Note that keyboard input doesn't work on the secondary view, this
requires moving the keyboard handling from FlView to FlEngine. Proposing
this now as a step forwards, but not yet useful for real applications.
2024-10-14 12:05:12 +13:00
Robert Ancell
b857ade17e Make FlRenderable interface (flutter/engine#55763)
Added to make testing of FlRenderer easier.
2024-10-14 10:30:41 +13:00
Robert Ancell
e5ecdd9c94 Fix dispose methods that didn't chain the parent. (flutter/engine#55794)
Remove empty dispose methods and convert finalize methods to dispose for
consistency.
2024-10-14 09:40:47 +13:00
Robert Ancell
971dbd79fb Refactor FlKeyboardHandler (flutter/engine#55601)
Refactor FlKeyboardHandler to be more GObject and less C++.

Done as we will need to move the handler from FlView to FlEngine to
support multi-view.
2024-10-04 12:00:00 +13:00
Robert Ancell
788cdbe3be Deregister views when they are destroyed (flutter/engine#55542) 2024-10-02 10:00:33 +13:00
Robert Ancell
166590d6c2 Allocate a view ID for secondary views (flutter/engine#55541)
Allocate view IDs for secondary Flutter views - another step towards
full multi-view support.
2024-10-02 09:04:31 +13:00
Robert Ancell
53b8ece3c8 Use GTask integer return APIs and fix documentation on return value on error. (flutter/engine#55353) 2024-09-24 13:25:15 +12:00
Robert Ancell
3443af6a5c Delay the window until the first frame is received from the Flutter engine (flutter/engine#54703)
Fixes https://github.com/flutter/flutter/issues/151098
2024-09-17 10:48:43 +12:00
Robert Ancell
e3f49a5875 Match Windows logic for picking RGB/BGR textures. (flutter/engine#55121)
The existing code had a lot of additional checks that didn't seem to
need to be there.

BGR could be passed back to Flutter, but this was never used in creating
the texture.

There has been a report of a Flutter app on Linux with swapped red and
blue color channels, so this seems like it is likely not working on some
drivers.

The original logic was introduced in
87509d8518cea0e90912cc30b08192b1dd4da760
2024-09-16 12:17:57 +12:00
Robert Ancell
420b1b5d44 Filter out bad locales returned by g_get_language_names (flutter/engine#55091)
We're seeing issues with and "und" (undefined) locale and exceptions in
applications (see https://github.com/ubuntu/app-center/issues/1659). It
seems the GLib method for getting the language names doesn't clean up
invalid values, so we should do that.
2024-09-13 11:40:52 +12:00
Robert Ancell
2a10ec7c44 Fix crash quitting application due to iterating over a changing list. (flutter/engine#55062)
Detected as the FlPlatformHandlerTest.ExitApplicationDispose was
crashing sometimes, valgrind showed invalid memory access.
2024-09-12 09:40:45 +12:00
Robert Ancell
a89c2ae2a4 Use a signal for the pre-engine restart event (flutter/engine#55063)
With multiple FlViews a callback doesn't scale.
2024-09-12 09:25:52 +12:00
Robert Ancell
d6415a16c7 Make FlApplication class (flutter/engine#54637)
An app can now be:
```c
#include <flutter_linux/flutter_linux.h>

#include "flutter/generated_plugin_registrant.h"

static void register_plugins_cb(FlApplication *app, FlPluginRegistry *registry) {
  fl_register_plugins(registry);
}

static GtkWindow *create_window_cb(FlApplication *app, FlView *view) {
  GtkApplicationWindow *window =
      GTK_APPLICATION_WINDOW(gtk_application_window_new(GTK_APPLICATION(app)));

  gtk_window_set_title(GTK_WINDOW(window), "flutter_application_test");
  gtk_window_set_default_size(GTK_WINDOW(window), 1280, 720);

  gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));

  return GTK_WINDOW(window);
}

int main(int argc, char** argv) {
  g_autoptr(FlApplication) app = fl_application_new(APPLICATION_ID, G_APPLICATION_NON_UNIQUE);
  g_signal_connect(app, "register-plugins", G_CALLBACK(register_plugins_cb), nullptr);
  g_signal_connect(app, "create-window", G_CALLBACK(create_window_cb), nullptr);
  return g_application_run(G_APPLICATION(app), argc, argv);
}
```

With this simplified, we can now build multi-window behaviour without having to modify the template much in the future.

Fixes https://github.com/flutter/flutter/issues/142920
2024-09-03 16:02:21 +12:00
Robert Ancell
3fc9ab6c1a Store a set of layers per view. (flutter/engine#54793)
This means when rendering the correct layers are rendered for a view.
2024-08-27 20:28:05 +12:00
Robert Ancell
4b992b898f Use TRUE/FALSE consistently for gboolean values. (flutter/engine#54768)
Some code was using stbool true/false - use the gboolean values
consistently.
2024-08-27 15:43:13 +12:00
Robert Ancell
2bbc3b4b41 Allow the default background color to be changed (flutter/engine#54575)
Fixes https://github.com/flutter/flutter/issues/149920
2024-08-20 08:00:06 +12:00
Robert Ancell
5c4ffe8f9c Add a precision to the fragment shader (flutter/engine#54109)
This is required for OpenGL ES.

See https://registry.khronos.org/OpenGL/specs/es/3.2/GLSL_ES_Specification_3.20.html#precision-and-precision-qualifiers

https://github.com/flutter/flutter/issues/152297
2024-08-08 20:07:41 +00:00
Chris Bracken
853222c175 Revert "Set GLArea.has-alpha = true (#54053)" (flutter/engine#54190)
Reason for revert: Regression + no tests. Must have been at the end of a long day, cause I missed the missing test and glaring warning about that.

This reverts commit 0325e590babb33963dc35283cd425b39290919e5.

Re-opens https://github.com/flutter/flutter/issues/152154

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-07-29 20:09:04 +00:00
Sam Lakerveld
0325e590ba Set GLArea.has-alpha = true (flutter/engine#54053)
GLArea.has-alpha defaults to false, which makes it impossible for a Flutter app to be transparent.

The additional change to glClearColor is to prevent a black flash when the application starts, before Flutter widgets become visible. This will also affect applications that aren't transparent, by showing the default GTK background color instead of black. This will not make the window transparent, because the developer currently has to add some code to their `linux/my_application.cc` to support transparency.

Fixes flutter/flutter#152154

Transparent windows were possible before #50754. Would it be ok to add a test for this to prevent breaking transparency again in the future?

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-07-26 16:48:05 +00:00
Robert Ancell
613b0b2fb2 Remove unused virtual methods (flutter/engine#54074) 2024-07-26 04:51:12 +12:00