490 Commits

Author SHA1 Message Date
Jason Simmons
08d2703016
Roll libcxx to bd557f6f (#165621)
Changes required for this roll:
* addition of LLVM libc (which is now a dependency of libcxx)
* updates the to license script
* patching the verify_exported check to allow some symbols added by
libcxx
* annotations for clang-tidy warnings
2025-03-24 15:39:26 +00:00
Matthew Kosarek
554c814ada
(#112207) Adding view_id parameter to DispatchSemanticsAction and UpdateSemantics (#164577)
fixes #112207

## What's new?
- Added a `view_id` on `UpdateSemantics`
- Added a `view_id` on `DispatchSemanticsAction`
- Piped the `view_id` all over creation
- Updated tests for these actions across the different platforms
- Added `FlutterEngineSendSemanticsAction` to the embedder API in order
to not break `FlutterEngineDispatchSemanticsAction`
- Using this view ID properly on the Windows platform (see
`engine/src/flutter/shell/platform/windows/flutter_windows_engine.cc`)

## How to test
1. Checkout
[foundation-plus-framework](https://github.com/canonical/flutter/pull/36)
from canonical/flutter
2. Merge this branch into it
3. Enable the "Narrator" screen reader on windows
4. Run the Multi window reference app (see
[PR](https://github.com/canonical/flutter/pull/36) for details)
5. Open up another window, and note that the right buttons and things
are being highlighted, as the screenreader would expect 🎉

## Pre-launch Checklist
- [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], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
2025-03-20 16:30:07 +00:00
Robert Ancell
39dc5717d5
Consolidate GTK mocks (#164890)
This was split across three files, consolidate into one.

---------

Co-authored-by: Harlen Batagelo <hbatagelo@gmail.com>
2025-03-11 15:30:09 +00:00
Matej Knopp
92fdf29e6f
[Linux] Move rendering to raster thread (#161879)
Fixes https://github.com/flutter/flutter/issues/155045

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

## Pre-launch Checklist

- [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], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Robert Ancell <robert.ancell@canonical.com>
2025-03-11 09:30:03 +00:00
Robert Ancell
3b884b0871
Don't process cursor changes until view is realized. (#164349)
For views created with fl_view_new_for_engine() the cursor processing
was subscribed to before the window had realized. This caused the
following warnings on startup:

[+3105 ms] (com.example.flutter_multi_view_test:619234): Gdk-CRITICAL
**: 13:00:35.501: gdk_window_get_display: assertion 'GDK_IS_WINDOW
(window)' failed
[ ] (com.example.flutter_multi_view_test:619234): Gdk-CRITICAL **:
13:00:35.501: gdk_cursor_new_from_name: assertion 'GDK_IS_DISPLAY
(display)' failed
[ ] (com.example.flutter_multi_view_test:619234): Gdk-CRITICAL **:
13:00:35.501: gdk_window_set_cursor: assertion 'GDK_IS_WINDOW (window)'
failed

Co-authored-by: Matthew Kosarek <matt.kosarek@canonical.com>
2025-03-04 15:37:02 +00:00
Matej Knopp
b831b269c5
Add PlatformDispatcher.engineId (#163476)
Fixes https://github.com/flutter/flutter/issues/163430.

This PR adds `engineId` field to `PlatformDispatcher`. When provided by
the engine, this can be used to retrieve the engine instance from native
code.

Dart code:
```dart
final identifier = PlatformDispatcher.instance.engineId!;
```

macOS, iOS: 
```objc
FlutterEngine *engine = [FlutterEngine engineForIdentifier: identifier];
```

Android:
```java
FlutterEngine engine = FlutterEngine.engineForId(identifier);
```

Linux
```cpp
FlEngine *engine = fl_engine_for_id(identifier);
```

Windows
```cpp
FlutterDesktopEngineRef engine = FlutterDesktopEngineForId(identifier);
```

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

## Pre-launch Checklist

- [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], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-28 22:20:11 +00:00
Robert Ancell
933cb5da82
Support forward and back buttons (#164356)
Based on https://github.com/flutter/flutter/pull/163500 by @2bndy5
2025-02-28 14:28:47 +00:00
Robert Ancell
25b3a4743a
Fix window creation callback for multi-window (#164353)
The windowing handler wasn't being created early enough and the view
wasn't visibile by default.
2025-02-28 13:41:10 +00:00
Robert Ancell
407065ea20
Replace update semantics handler with signal. (#163583)
The previous code was built where there was only one view, and this view
provided the callback to the engine.

Now we have multiple views, they all should process the semantics update
and so the callback is replaced with a signal. This is similar to the
signal used for engine restarts.

---------

Co-authored-by: Harlen Batagelo <hbatagelo@gmail.com>
2025-02-27 23:30:53 +00:00
Robert Ancell
d8a57c61dd
Add windowing channel support to Linux embedder (#163180)
Implement flutter/windowing for the Linux embedder.
2025-02-27 04:14:20 +00:00
Robert Ancell
5365993ff5
Replace hard coded numbers with mouse button defines (#163503)
No behaviour change, just for clarity.
2025-02-18 14:36:46 +00:00
Robert Ancell
4cc9db4125
Move FlTextInputHandler from FlView (#162131)
This moves the final part of the keyboard handling from FlView to the
FlEngine and means keyboard should work correctly with multiple views.
2025-02-13 02:30:33 +00:00
Robert Ancell
af3c91045b
Fix Linux keyboard support for AltGr (#162495)
This was previously connected to right alt, which was confusing the
keyboard handling code into generating up events for this key when it
didn't match the expected values. This key is also configurable, and
only defaults to right alt in Ubuntu/GNOME.

Fixes https://github.com/flutter/flutter/issues/154053
2025-02-11 01:03:48 +00:00
Byoungchan Lee
44785daf01
Roll gn to c97a86a72105f3328a540f5a5ab17d11989ab7dd (#161012)
The current version is more than 3 years old.

## Pre-launch Checklist

- [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], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-05 01:09:14 +00:00
Robert Ancell
b68321a45d
Simplify hash table iteration. (#162483)
Removes the need to use structures to keep state and keeps logic in the
same function.
2025-02-05 01:03:04 +00:00
Robert Ancell
5a53ac3996
Fix warnings on startup about display monitor (#162653)
Create the display monitor at initialization, not engine start.
Handle case where the window is not visible and the monitor can't be
determined.
Don't leak the monitor when the engine is disposed.
2025-02-04 23:10:27 +00:00
Robert Ancell
b56b5b6a23
Keyboard tidy ups (#162054)
Make async calls use standard GLib async API.
Remove test specific methods.
Smaller cleanups.
2025-01-23 15:45:46 +00:00
Robert Ancell
6e9b863e6d
Replace hacky code creating fake devices (#162056) 2025-01-23 14:48:01 +00:00
Robert Ancell
2d3beadffe
Move FlKeyboardManager and FlKeyboardHandler from FlView to FlEngine. (#161925)
There can only be one handler that is shared between the views.

Move event redispatch matcher back into FlKeyboardManager - if a
redispatched event was moved between views due to a focus change it
would not be matched against.
2025-01-22 20:07:11 +00:00
Robert Ancell
e53bd2a103
Remove FlKeyboardViewDelegate (#161705)
Instead, do the filtering at the point the event is redispatched.
2025-01-21 23:18:20 +00:00
Robert Ancell
f2ce662fd2
Refactor event redispatching (#161701)
Instead of doing the redispatching from inside FlKeyboardManager, return
the event asynchronously to the code that provided the event in the
first case. That code has all the context on how to do the redispatch -
this will be more complicated in a multi-view case.
2025-01-17 01:01:49 +00:00
Robert Ancell
a6045c9985
Make fl_keyboard_manager_handle_event async (#161637)
In this way we can tell when this call completes, which should help
testing and refactoring.
2025-01-16 23:45:48 +00:00
Robert Ancell
732e003745
Remove some stray printf debugging (#161706) 2025-01-16 22:47:02 +00:00
Robert Ancell
c9923ca609
Remove unused method (#161572) 2025-01-14 14:35:36 +00:00
Robert Ancell
d14140f854
Provide monitor information. (#161359)
Fixes https://github.com/flutter/flutter/issues/144230
2025-01-12 21:20:40 +00:00
Robert Ancell
67f24bebe1
Refactor keyboard manager tests (#160637)
Carefully refactored FlKeyboardManager tests to make them more
consistent with existing tests in preparation for future changes to this
class.
2025-01-09 04:24:19 +00:00
Robert Ancell
94c4d0568e
Allow async platform responses in FlMockBinaryMessenger (#160636)
To help simplify the keyboard tests.
2025-01-07 21:48:44 +00:00
Robert Ancell
dd058ffa5b
Remove all remaining use of mock engine (#160635)
Test consistency achieved.
2024-12-20 03:48:39 +00:00
Robert Ancell
90c1f8ca69 Migrate FlBinaryMessenger using embedder API instead of mock engine. (flutter/engine#57214)
This allows us to remove most of the remaining mock engine code.
2024-12-16 20:02:45 +00:00
Robert Ancell
eb4af9071e Migrate FlEventChannel tests to FlMockBinaryMessenger (flutter/engine#57150)
Use FlMockBinaryMessenger instead of mocking the whole engine.
2024-12-16 11:45:17 +13:00
Robert Ancell
dcd093fad7 Migrate FlMethodChannel tests to FlMockBinaryMessenger (flutter/engine#57146)
Use FlMockBinaryMessenger instead of mocking the whole engine.
2024-12-16 10:34:14 +13:00
gaaclarke
3d8fc3c652 removed c style casts and enabled the lint (flutter/engine#57162)
test exempt: should have no functional change

## Pre-launch Checklist

- [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.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/engine/blob/main/docs/testing/Testing-the-engine.md
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
2024-12-12 15:33:37 -08:00
Robert Ancell
d9cdbeebea Make fl_engine_send_key_event into a standard async function. (flutter/engine#57112)
Add missing tests for this function.

Note this makes FlKeyboardManager a bit more complex, but this is
planned to be simplified in a future refactor.
2024-12-13 09:21:00 +13:00
Robert Ancell
50a40b310e Migrate FlPlatformChannel tests to FlMockBinaryMessenger (flutter/engine#57140)
Use FlMockBinaryMessenger instead of mocking the whole engine.
2024-12-13 08:40:13 +13:00
Robert Ancell
3a54460518 Migrate FlBasicMessageChannel tests to FlMockBinaryMessenger (flutter/engine#57115)
Use FlMockBinaryMessenger instead of mocking the whole engine.
2024-12-13 08:38:53 +13:00
Balint Rozgonyi
41009bcda1 [Linux] Add Multi-Touch Support for Linux (flutter/engine#54214)
This draft PR aims to address the lack of multi-touch support under Linux, leveraging the existing implementation used for Windows. As I am not an expert in this domain, I would greatly appreciate feedback on the implementation.

https://github.com/flutter/flutter/issues/133239
https://github.com/flutter/flutter/issues/52202

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-12-11 22:05:04 +00:00
Robert Ancell
85b89155d5 Clean up key embedder responder tests (flutter/engine#57054)
Remove global variable.
Rename function so doesn't look like provided by GLib.
Use g_autoptr to remove explicit unref.
Move type definition inline.
2024-12-11 10:58:22 +13:00
Robert Ancell
f3c1d7bab8 Make fl_key_channel_responder_handle_event async (flutter/engine#56959)
Replace a callback with a more standard async call
2024-12-10 09:06:22 +13:00
Robert Ancell
8cc75a926e Cleanup refactoring in FlKeyboardManager (flutter/engine#56956)
Remove pending keyboard event ID and use the object directly.

Use references to make sure FlKeyboardManagerData is freed.

Refactor marking events as handled
2024-12-09 09:53:58 +13:00
Robert Ancell
fd12f3489c Remove LSAN supressions for Linux embedder (flutter/engine#56913)
Fixes https://github.com/flutter/flutter/issues/90155
2024-12-05 11:44:08 +13:00
Robert Ancell
4bcd6a93a1 Remove unused constant (flutter/engine#56929) 2024-12-04 15:21:48 +13:00
Robert Ancell
dcc250c8a5 Split keyevent channel into own class (flutter/engine#56911)
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-12-04 11:57:05 +13:00
Robert Ancell
d1777a3abd Add tests for errors encoding message channel request and method calls. (flutter/engine#56914)
Fix error not being copied in this case.

Follow up to https://github.com/flutter/engine/pull/56856
2024-12-04 10:39:46 +13:00
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