328 Commits

Author SHA1 Message Date
J-P Nurmi
42b7de838e [Linux][a11y] implement AtkText::get_text/string_at_offset() (flutter/engine#38144)
This PR implements `AtkText::get_string_at_offset()` (and the deprecated `AtkText::get_text_at_offset()` still used by e.g. Orca) for `FlAccessibleTextField` to allow Orca to read out loud the current character while moving the text cursor around.

### Before (unmute to hear the screen reader)

[textfield-a11y-before.webm](https://user-images.githubusercontent.com/140617/206556644-fb4f4df8-acca-4d97-86d5-7120f0a4871d.webm)

### After (unmute to hear the screen reader)

[textfield-a11y-after.webm](https://user-images.githubusercontent.com/140617/206556678-4fbf9112-291e-4518-a258-e9ca33469430.webm)

Fixes: flutter/flutter#113049

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-07 17:18:04 +00:00
Greg Spencer
a1b365111f Reland: "Adding app lifecycle notification for macOS and Linux, add hidden state." (#40542) (flutter/engine#42418)
## Description

This reverts commit 879917b to re-land #40542 to fix the lint warning which caused the original PR to be reverted (the lint warnings were turned on after the original was landed, which is why it wasn't caught earlier).
2023-05-30 20:45:46 +00:00
Zachary Anderson
879917b1e6 Revert "Adding app lifecycle notification for macOS and Linux, add hidden state." (flutter/engine#42384) 2023-05-28 00:02:58 -07:00
Greg Spencer
2af9be9d97 Adding app lifecycle notification for macOS and Linux, add hidden state. (flutter/engine#40542)
## Description

This adds app lifecycle notification for macOS and Linux, and adds a new `hidden` state to the `AppLifecycleState` enum.

To be functional, this needs a corresponding framework change: https://github.com/flutter/flutter/pull/123274

## Related Issues
 - https://github.com/flutter/flutter/issues/30735

## Tests
 - Added tests for state changes.
2023-05-26 23:24:33 +00:00
Greg Spencer
4eebfb2246 [linux] Wait for binding to be ready before requesting exits from framework (flutter/engine#41782)
## Description

Similar to https://github.com/flutter/engine/pull/41733 and https://github.com/flutter/engine/pull/41753 this causes the linux embedding to wait until it hears that the scheduler binding has registered itself before proceeding to send termination requests to the framework.

This allows applications that don't use the framework (just use `dart:ui` directly) to exit automatically when the last window is closed.  Without this change, the app does not exit when the window is closed.

Depends on framework PR https://github.com/flutter/flutter/pull/126075 landing first.

## Related PRs
 - https://github.com/flutter/engine/pull/41733
 - https://github.com/flutter/engine/pull/41753

## Related Issues
 - https://github.com/flutter/flutter/issues/126033.

## Tests
 - Added a test to make sure that it doesn't send a termination request if the binding hasn't notified that it is ready yet.
2023-05-16 20:34:05 +00:00
Bruno Leroux
8a9edf40aa [Linux - TextInput] Do not add new line for send action (flutter/engine#41895)
Respects input action.
2023-05-11 16:32:43 -07:00
yaakovschectman
e0b8175ef4 Only register top level window message listener upon registering service binding (flutter/engine#41733)
Move registering the `WM_CLOSE` message listener in the engine from
initialization to in response to a message sent from `ServiceBinding`
upon its initialization so that we do not intercept window messages when
there is no binding registered.

Addresses https://github.com/flutter/flutter/issues/126033.

## 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.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said 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 `///`).
- [ ] 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/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat

---------

Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
2023-05-10 07:55:39 -04:00
Robert Ancell
2ff5380c01 Change back to using the memory address of a texture as its ID. (flutter/engine#40899)
Change back to using the memory address of a texture as its ID.
2023-04-04 00:43:49 +00:00
Kingtous
bcaa44592e [Linux] fix: make textures thread-safe on linux (flutter/engine#40478)
Make textures GHashTable thread-safe
2023-04-03 11:30:04 +12:00
Robert Ancell
84c69f7df9 Fix incorrect usage of fl_method_error_response_new in documentation example (flutter/engine#40288) 2023-03-17 10:23:24 +13:00
Robert Ancell
c411d37046 Add fl_texture_get_id, so textures can be passed to Flutter (flutter/engine#40290)
Add fl_texture_get_id, so textures can be passed to Flutter
2023-03-16 01:10:07 +00:00
Robert Ancell
3c8cac2faa Improve Linux texture examples. (flutter/engine#40289)
Use 'MyTexture' naming to match the Linux shell 'MyApplication'.

Show how to connect up the virtual methods.
2023-03-15 14:09:26 +13:00
Robert Ancell
5c4c343488 Add platform channel System.exitApplication and System.requestAppExit support (flutter/engine#40033)
Add platform channel System.exitApplication and System.requestAppExit support
2023-03-10 14:43:35 +13:00
Jason Simmons
bd3381321d Make the Linux GTK widget focusable (flutter/engine#40163)
Make the Linux GTK widget focusable
2023-03-09 15:26:57 +00:00
Robert Ancell
5041a77db3 Use a single FlGLArea (flutter/engine#39473)
Use a single FlGLArea
2023-03-07 20:51:54 +00:00
Robert Ancell
ea232f836d Fix incorrect response to platform SystemSound.play (flutter/engine#39992)
* Fix incorrect response to platform SystemSound.play
* Add tests for FlPlatformPlugin
2023-03-07 09:49:49 +13:00
godofredoc
b6f6101b10 Remove special handling of gtk debug artifact. (flutter/engine#40040)
Remove special handling of gtk debug artifact.
2023-03-03 18:29:11 +00:00
Robert Ancell
d7dbc85328 Fix FlView self variables using non-standard names. (flutter/engine#39468)
By convention, use `self` for the pointer to the current object. Fixes this inconsistency in FlView.
2023-03-01 16:00:15 -08:00
Robert Ancell
a226775bdc Simplify FlView (flutter/engine#39467)
This PR simplifies the FlView GL interactions. It removes some code paths that were never being used (possibly for future use with platform views?) and complex internal APIs that could be done in a single method call. This is motivated in investigating https://github.com/ubuntu-flutter-community/software/issues/868.

I plan to take this further, since there doesn't seem to be any reason why multiple FlGLArea widgets are used - we can draw all the layers in one widget.

For reviewers - the individual commits aren't particularly interesting, I just did it that way to be sure I wasn't breaking anything along the way and help to diagnose any regressions in the future.

The structural changes that this PR is simplifying came in 0561c75b4d6036e7d2c7e06163a3f0629464db9f.
2023-03-01 12:34:38 -08:00
Robert Ancell
7d854f318f Fix documentation of FlEngineOnPreEngineRestartHandler (flutter/engine#39759) 2023-02-21 19:02:16 +00:00
Chris Bracken
2b185ea8d8 [linux] Eliminate mirrors support (flutter/engine#39701)
Support for using dart:mirrors has been deprecated for nearly two years.
this removes support for enabling mirrors from the embedder as
documented in the deprecation comment. This was primarily added as a
workaround for an internal tooling usecase, which no longer exists.

Issue: https://github.com/flutter/flutter/issues/120924
2023-02-17 09:37:03 -08:00
J-P Nurmi
d7963e6fa1 [Linux][FlView] fix rendering on startup when shown after plugin registration (flutter/engine#38982)
* [FlView] fix rendering on startup when shown after plugin registration

* Add clarifying comment
2023-01-26 21:11:20 +00:00
Ahmed Ashour
51c0a9ec65 Remove superfluous words from comments (flutter/engine#39068)
* Remove superfluous words.

* Format

* Duplicate in consecutive lines.
2023-01-24 09:54:19 -08:00
Robert Ancell
3b47df5adf Fix invalid Unix locale to Flutter locale (BCP-47) mapping (flutter/engine#36512)
Flutter locales use the BCP-47 format
(https://www.rfc-editor.org/rfc/bcp/bcp47.txt), and Unix locales use a POSIX
format. There is not a perfect mapping between them, see
https://wiki.openoffice.org/wiki/LocaleMapping

The current implementation is not correctly setting the appropriate optional
fields, so remove that.

There are likely some Unix locales that should set these fields, but these are
best fixed by adding special cases for them as they are discovered.

Fixes: https://github.com/flutter/flutter/issues/111341
2023-01-19 22:53:59 +00:00
Chris Bracken
55911c9c7f [linux] Allow overriding asset, ICU data path (flutter/engine#38296)
Support setting a custom asset directory and ICU data path.

Fixes: https://github.com/flutter/flutter/issues/117103
Issue: https://github.com/flutter/flutter/issues/117102
2022-12-15 08:25:01 -08:00
gaaclarke
5a10c0ead2 Made responses to platform methods threadsafe in linux (flutter/engine#37689)
* Made responses to platform methods threadsafe in linux

* brought back the logic that the engine clears handlers

* removed leak

* more feedback
2022-12-02 00:45:20 +00:00
Bruno Leroux
ed7aea9a05 [Linux] Synthesize modifier keys events on pointer events (flutter/engine#37491)
Co-authored-by: Bruno Leroux <bruno.leroux@gmail.com>
2022-11-21 20:34:41 +00:00
gaaclarke
af036b8857 Turned on performance-unnecessary-value-param everywhere. (flutter/engine#37447)
* Turned on performance-unnecessary-value-param everywhere.

* linux host additions

* ios patch

* reverted bad fix

* revert bad fix

* another ios patch

* removed lint fix printer
2022-11-09 20:55:13 +00:00
Bruno Leroux
f6c5601c2f [Lixux] fix pressing Shift+AltLeft throws (flutter/engine#37079) 2022-10-29 03:51:57 +00:00
Joel Winarske
93a55ddeeb Enable cross compile of Linux GTK embedder (flutter/engine#36056) 2022-09-22 13:03:47 -07:00
Robert Ancell
42c4e6191f Fix wrong use of fl_method_call_respond arguments in documentation (flutter/engine#35247) 2022-08-29 09:48:08 -07:00
J-P Nurmi
6321cd7b64 [Linux][FlView] guard against disconnecting a disconnected signal (flutter/engine#35490)
GObject's dispose() method may be called multiple times. Guard against
trying to disconnect the same signal multiple times by clearing the ID
to avoid warnings when closing the window.

```
(bug:74019): GLib-GObject-WARNING **: 11:15:08.697: ../../../gobject/gsignal.c:2731: instance '0x55e1c3ea0200' has no handler with id '255'
```
2022-08-25 13:27:20 -07:00
J-P Nurmi
5ced18fed0 [Linux] use top-level GTK IM client window (flutter/engine#35272)
This PR takes a step back and changes the GTK IM client window back from FlView to GtkApplicationWindow as it was before #33111. The window was originally changed to FlView to make the code testable by cutting a dependency to gtk_widget_translate_coordinates(). The change was hard to revert because there were several conflicting changes on top. Therefore, this PR introduces an FlTextInputViewDelegate to be able to provide coordinate mapping in a testable way.

Fixes: flutter/flutter#108832
2022-08-09 16:55:41 -07:00
J-P Nurmi
bacc6eb5cc [Linux] remove AtkText stub implementation (flutter/engine#34839)
When Orca has "Speak object under mouse" enabled, it tries to get the
text range extents for any object that implements the AtkText interface
and gets a bit confused by our AtkText stub implementation that merely
returns null for `get_text`.

Removing the stub implementation helps to avoid the issue that Orca
would try to call `atk_text_get_range_extents()` with `start_offset=0`
and `end_offset=0`:

> Atk-CRITICAL **: atk_text_get_range_extents: assertion 'start_offset >= 0 && start_offset < end_offset' failed
2022-08-04 11:33:55 -07:00
Tong Mu
ee2970fc03 [Keyboard, Linux] Disconnect keymap signal on dispose (flutter/engine#34488) 2022-07-07 15:06:47 +12:00
J-P Nurmi
625f971298 [Linux] do not destroy unowned GdkKeymap instance (flutter/engine#34351)
`gdk_keymap_get_for_display()` does not transfer ownership to the
caller. Destroying the keymap object would cause problems further down
the road when `GtkWindow` gets to clean up and tries to destroy the
same keymap.
2022-06-29 11:25:52 +12:00
godofredoc
de593702de Add gen_snapshot to flutter_gtk. (flutter/engine#34287) 2022-06-27 17:00:06 +00:00
J-P Nurmi
4eb93fed5a Fix build on Linux (flutter/engine#34312)
* Fix build on Linux

The MockBinaryMessenger tweaks applied by #33955 caused the newly added
tests in #33313 to not build.

* Fix clang-tidy failures
2022-06-27 08:03:37 -07:00
J-P Nurmi
433ac149bf [Linux][A11y] implement AtkEditableText interface (flutter/engine#33955)
* Make FlAccessibleNode derivable

This allows introducing specialized subclasses that implement such a11y
interfaces as AtkEditableText that should not be implemented for the
generic node.

* FlAccessibleNode: add set value, text selection & perform action

Prepare API required for the upcoming AtkEditableText implementation.

* FlViewAccessible: postpone child node creation

This changes the a11y node creation flow so that (unknown) child nodes
are not pre-created when their parent is updated but "pending" child
node IDs are collected for later. Parent-child relationships are
established at the end of update batches when all nodes have been
created.

* Add FlAccessibleTextField that implements AtkEditableText

Solves: flutter/flutter#103191
2022-06-27 10:11:40 +12:00
J-P Nurmi
514b0a43b8 [Linux][A11y] report disabled animations and high contrast accessibility features (flutter/engine#33313)
* FlEngine: add fl_engine_update_accessibility_features()
* FlSettings: add API for high-contrast & animations
* FlEngine: allow passing mock messenger at construction time
* FlSettingsPlugin: report accessibility features
2022-06-27 10:10:55 +12:00
J-P Nurmi
d79e1196c9 [Linux] remove duplicate clone_string() in favor of g_strdup() (flutter/engine#34031)
GLib's g_strdup() offers the same behavior that it returns NULL if the
argument is NULL: https://docs.gtk.org/glib/func.strdup.html
2022-06-24 12:24:33 -07:00
Tong Mu
ee0e8303fb [Keyboard] Mark generated file names with infix .g. (flutter/engine#34123)
* Impl

* Format
2022-06-23 20:02:33 -07:00
Chris Bracken
53a9648da9 [lint] Merge impeller .clang-tidy into main config (flutter/engine#33692)
Merges most (but not all) of the impeller .clang-tidy rules into the
main .clang-tidy config. Merges:

readability-identifier-naming.PrivateMemberSuffix (_)
readability-identifier-naming.EnumConstantPrefix (k)
modernize-use-default-member-init.UseAssignment
Does not merge:

readability-identifier-naming.PublicMethodCase (CamelCase)
readability-identifier-naming.PrivateMethodCase (CamelCase)
These last two are not merged due to the non-trivial number of existing
field accessors that use field_name() methods to directly return
field_name_. While these are permitted by the C++ style guide, we may
want to move to a single, simple rule and name everything in CamelCase.
These can be enabled in a followup patch.

No new tests added, since this change is style-only.
2022-06-21 11:52:42 -07:00
J-P Nurmi
b7bfa342dd [Linux] Test text input (flutter/engine#34186)
This PR finishes what #33661 and #33111 started - most of `FlTextInputPlugin` is now covered by tests.
2022-06-21 10:03:30 -07:00
J-P Nurmi
024fd472b8 [Linux][Testing] reduce the boilerplate for MockBinaryMessenger (flutter/engine#34029)
Let MockBinaryMessenger internally manage the FlBinaryMessenger wrapper
instance and provide it via operator FlBinaryMessenger*() to avoid
having to create two objects in every test. The same technique was used
for MockSettings in #32618.
2022-06-21 09:07:05 +12:00
godofredoc
5e932a2524 Fixes for gn artifacts. (flutter/engine#34152) 2022-06-18 04:23:04 +00:00
J-P Nurmi
f7d46e29c2 [Linux] take first steps towards testable text input (flutter/engine#33661)
This PR is a continuation of #33111 and includes necessary changes to test the `TextInputType.setClient()` platform channel call. Testing the actual text input flow requires a mock IM context that will follow in a separate PR.

* [Linux] pass GdkWindow instead of FlView to FlTextInputPlugin
* [Linux] add MockBinaryMessenger::ReceiveMessage()
* [Linux] add test for TextInputType.setClient
* Drop the offscreen window

GdkOffscreenWindow requires display & screen which is a problem in
headless mode. Luckily, we don't really need a window instance in tests
because its only passed as a client window to the IM context which will
be mocked out when we get to tests that depend on it.
2022-06-10 11:17:22 -07:00
Chris Bracken
56fbdd0232 [lint] Enforce k prefix for global constants (flutter/engine#33666)
Enforces that all global constants are prefixed with a 'k' as per the
style guide and updates the codebase into conformance where necessary.

This does not change any public API.

Additional testing provided by the addition of the lint rule.

Ref: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#begin-global-constant-names-with-prefix-k
2022-05-27 18:33:38 -07:00
J-P Nurmi
f35001f852 [Linux] fix typos in FlAccessibleNode docs (flutter/engine#32651) 2022-05-27 13:28:31 -07:00
J-P Nurmi
12ac248051 [Linux] FlTextInputPlugin: use FlView as GTK IM client window (flutter/engine#33111)
GTK IM operates in [coordinates relative to its client window](https://docs.gtk.org/gtk3/method.IMContext.set_cursor_location.html#:~:text=The%20location%20is%20relative%20to%20the%20client%C2%A0window.). Let GTK
IM use the native window that backs FlView, which is the same native
window that is used for key event processing - see GDK_KEY_XXX_MASK in
fl_view_realize().

This is an important step towards testable FlTextInputPlugin because it
eliminates the depency to GtkWidget's coordinate translation API and
that way paves the road for replacing FlTextInputPlugin's FlView
instance with a plain GdkWindow. In tests, that window can be an
instance of GdkOffscreenWindow.

There are no tests included yet but after a few more refactoring steps
it will be possible to execute tests like this: [fl_text_input_plugin_test.cc](f2e0d91b59/shell/platform/linux/fl_text_input_plugin_test.cc).
The other refactoring steps are visible at [jpnurmi/engine/commits/text-input-plugin](https://github.com/jpnurmi/engine/commits/text-input-plugin).
2022-05-26 13:08:06 -07:00