77 Commits

Author SHA1 Message Date
Matej Knopp
acc246676c
Fix code style issues in MacOS embedder (#22270) 2020-11-04 14:49:03 -08:00
stuartmorgan
3d194fa545
Switch macOS embedding to proc table embedder API (#21811)
Converts the macOS embedding to use the new proc table version of the embedding API, and adds one example unit test using it to demonstrate and validate the approach.
2020-11-02 21:44:10 -08:00
Matej Knopp
e61e8c2482
Smooth window resizing on macOS (#21525) 2020-10-28 11:12:04 -07:00
stuartmorgan
c896d6d1bb
Defer macOS arrow and backspace handling to framework (#22063)
The Flutter framework now has handling for arrow keys and backspace
in its editable text, so they no longer need to be handled in the
embedding. This not only avoids duplicate work, but improves the
handling of complex unicode (surrogate pairs, grapheme clusters) which
are currently correctly handled in the framework but not the macOS
embedding.

Fixes https://github.com/flutter/flutter/issues/68497
2020-10-26 12:56:30 -07:00
Greg Spencer
6bc70e4a11
Reland: Migration to PlatformDispatcher and multi-window (#21932)
This re-lands #20496 and #21780 after fixing the semantics-enabling code that was causing the post-submit web_smoke_test to fail.

Below is the description from the original PR:

This is a PR for converting the dart:ui code in the engine to use a multi-window API. The goal here is to convert from the window singleton to an API that has the concept of multiple windows. Also, I'm matching up the new PlatformDispatcher class to talk directly to the PlatformConfiguration class in the engine. I'm not attempting to actually enable creating multiple windows here, just migrate to an API that has a concept of multiple windows. The multi-window API in this PR currently only ever creates one window.

The design doc for this change is here.

The major changes in this PR:

Move the platfom-specific attributes out of Window, and into the new PlatformDispatcher class that holds all of the platform state, so that the platform code need only update the configuration on this class.
Create FlutterView, FlutterWindow, and SingletonFlutterWindow classes to separate out the concepts of a view (of which there may be multiple in a window), a window (of which there may be multiple on a screen, and they host views), and a window where there is only ever expected to be one (this hosts the entire API of the former Window class, and will eventually be the type of the window singleton).
Next step after this PR lands:

Remove the Window class entirely (it is replaced by SingletonFlutterWindow). Some minor changes in the Framework are needed to switch to using SingletonFlutterWindow directly first.

The Window class still exists in this PR, but will be removed as soon as the framework is converted to point to the SingletonFlutterWindow class instead. They share the same API, just have different names (Window is currently a subclass of SingletonFlutterWindow). The intention is that the Window name will be freed up to use as a widget class name in the framework for managing windows. The singleton called window will remain, and keep the same API it has now.
2020-10-22 14:54:25 -07:00
George Wright
04bf8791fe
Add plumbing to grab dart entrypoint args on macOS (#21789) 2020-10-16 16:07:02 -07:00
Chris Bracken
c449c8ee50
Eliminate FLUTTER_NOLINT where possible (#21904)
This removes most of the remaining FLUTTER_NOLINT comments and opts
these files back into linter enforcement.

I've filed https://github.com/flutter/flutter/issues/68273 to require
that all FLUTTER_NOLINT comments be followed by a GitHub issue URL
describing the problem to be fixed.
2020-10-16 12:44:49 -07:00
Yuqian Li
c2938d06b1
Revert "Migration to PlatformDispatcher and multi-window #20496" (#21792)
* Revert "Fix documentation build for window changes. (#21780)"

This reverts commit 931a04683d6eb49fc92059b2384ac5b1618d5422.

* Revert "Migration to PlatformDispatcher and multi-window (#20496)"

This reverts commit 85b0031f73544e448354047dc6a236c0b0808252.
2020-10-12 19:26:41 -07:00
Greg Spencer
85b0031f73
Migration to PlatformDispatcher and multi-window (#20496)
This is a PR for converting the dart:ui code in the engine to use a multi-window API. The goal here is to convert from the window singleton to an API that has the concept of multiple windows. Also, I'm matching up the new PlatformDispatcher class to talk directly to the PlatformConfiguration class in the engine. I'm not attempting to actually enable creating multiple windows here, just migrate to an API that has a concept of multiple windows. The multi-window API in this PR currently only ever creates one window.

The design doc for this change is here.

The major changes in this PR:

Move the platfom-specific attributes out of Window, and into the new PlatformDispatcher class that holds all of the platform state, so that the platform code need only update the configuration on this class.
Create FlutterView, FlutterWindow, and SingletonFlutterWindow classes to separate out the concepts of a view (of which there may be multiple in a window), a window (of which there may be multiple on a screen, and they host views), and a window where there is only ever expected to be one (this hosts the entire API of the former Window class, and will eventually be the type of the window singleton).
Next step after this PR lands:

Remove the Window class entirely (it is replaced by SingletonFlutterWindow). Some minor changes in the Framework are needed to switch to using SingletonFlutterWindow directly first.

The Window class still exists in this PR, but will be removed as soon as the framework is converted to point to the SingletonFlutterWindow class instead. They share the same API, just have different names (Window is currently a subclass of SingletonFlutterWindow). The intention is that the Window name will be freed up to use as a widget class name in the framework for managing windows. The singleton called window will remain, and keep the same API it has now.
2020-10-09 16:29:16 -07:00
Kaushik Iska
5c1960284a
Fix filesystem access prior to macOS 10.15 (#21740) 2020-10-09 13:42:01 -07:00
Kaushik Iska
8b1799b616
[macOS] Fix docs for loadAOTData and minor refactor (#21699) 2020-10-08 11:34:02 -07:00
Kaushik Iska
75bc9360d9
[macOS] flutter_desktop_darwin_unittests can be enabled for all runtime modes (#21681) 2020-10-08 10:12:03 -07:00
Kaushik Iska
15739917f3
[macOS] Allow loading of AOT snapshots and instructions from elf bundle (#21670) 2020-10-07 16:34:49 -07:00
stuartmorgan
41ce791926
[macos] Allow engine flags via environment vars (#21468)
Replaces the (temporary) compile-time option to pass engine switches
with the ability to pass them temporarily at runtime via environment
variables. This moves the recently-added code for doing this on Windows
to a shared location for use by all desktop embeddings.

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

Temporarily adds a way to enable mirrors as a compile time option,
as is already provided in the Linux embedding, to provide a migration
path for the one remaining known need for compile-time options
that has been raised in flutter/flutter#38569.
2020-09-29 09:36:30 -07:00
Kaushik Iska
149df4318d
Reland multiple display support for embedder API (#21464) 2020-09-28 12:35:34 -07:00
Kaushik Iska
8d165faca1
Revert multiple display support for embedder API (#21456)
This reverts commits
- 67fdd7ededcbb161a857cc187619ae115c8c8e7f.
- 854943d5c8670a241524b71945b2c8ca77246556.

See: https://github.com/flutter/flutter/issues/66829
2020-09-28 09:46:46 -07:00
Kaushik Iska
854943d5c8
[macOS] Set the display refresh rate (#21095)
Fixes: https://github.com/flutter/flutter/issues/49222
2020-09-26 06:47:26 -07:00
Chris Bracken
2cd1753c6c
[darwin] Header #import hygiene (#21193)
This patch applies the following changes:

* Rename a stray .cc file to .mm (connection_collection.cc).
* Migrate Objective-C #includes to #import as per the style guide.
* #include/#import order updated to reflect the style guide order:
  associated header, system/standard library headers, library headers,
  platform-specific includes.
* Include cstring where we're using strlen.
* Add a missing copyright header in SemanticsObjectTest.mm.

Bugs: https://github.com/flutter/flutter/issues/60025
2020-09-15 18:44:09 -07:00
Justin McCandless
3c9308faad
hasStrings Mac (#20531)
Adds the hasStrings method for Mac, and improves the state of unit testing on Mac.
2020-09-15 08:40:27 -07:00
stuartmorgan
2bc0bfdab4
Send locale information in the macOS embedding (#20461)
Queries the system list of user-preferred languages, and sends it to the
engine just after starting it up, as well as after any OS locale change.

macOS portion of https://github.com/flutter/flutter/issues/45152
2020-08-12 19:31:22 -07:00
Kaushik Iska
43067ed4fc
engineCallbackOnPresent should return false if glContext is invalid (#20337)
Co-authored-by: Kaushik Iska <kaushikiska@google.com>
2020-08-10 16:44:20 -07:00
Todd Volkert
48f90888a6
Add support for playing alert sound on MacOS (#19970)
flutter/flutter#62143
2020-07-23 14:00:13 -07:00
gaaclarke
21efd7325e
Made the linter print out more information in its output and fixed bugs (#19895) 2020-07-22 15:38:09 -07:00
Tong Mu
fbef051f5c
Add all system cursors (engine) (#19550)
* Support all system cursors in WIn, Linux, mac, Web and Android.
2020-07-15 15:37:18 -07:00
Andy Weiss
015f2ea765
Use the main bundle if the App bundle is not found (#18749)
It looks like half the code in this function was updated to use the
main bundle but this one line was still only using the _dartBundle. I am
pretty sure that is a mistake and instead we want to use the mainBundle
as a backup both to find the plist and to find the assets.
2020-07-11 21:08:27 -07:00
gaaclarke
41c503cc23
Changed iOS channels to start cleaning up the accessibility handler when the bridge is deleted (#19556)
Started cleaning up the accessibility handler when the bridge is
deleted and made nilling out channels safer by making sure they don't
overwrite newly setup handlers.
2020-07-08 13:26:29 -07:00
Todd Volkert
7e6c856ea0
Add support for horizontalDoubleArrow and verticalDoubleArrow cursors (#18916) 2020-06-10 07:17:11 -07:00
Tong Mu
69d0a8e710
System mouse cursor: macOS (#18131)
* Untested macOS impl

* Workable mac

* Modernize

* Simplify

* Address comments

* Refactor with FlutterPlugin

* Cached dict

* Update per comments

* format

* Remove device arg

* Format

* Update license

* Update licences

* Doc update
2020-05-20 16:27:25 -07:00
stuartmorgan
2fe73589fb
Use the right constant for macOS event timestamps (#17713)
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.
2020-04-15 14:33:00 -07:00
stuartmorgan
33a21d1ff8
Add DartProject for Windows embedding API (#17210)
This is a step toward aligning the API with macOS, and will make it easier to add the precompiled library later for release mode (since it can just be added to the project directory, without any code changes required for wrapper clients).

At the C API, uses a struct instead of individual arguments, mirroring a change that was already made on the Linux side to make the C API cleaner.

Functional changes in addition to the restructuring:

adds relative path support, as was recently added for GLFW
Uses wstring, rather than string, for paths; the conversion to UTF-8 is actually a potential problem on Windows, so pushing it into the embedding allows us the possibility of removing it later (if we can figure out a good solution at the embedder.h layer) without API breakage.
The old APIs used by the standard runner are left in place for now to avoid breaking the template on an engine roll. Once the framework template has been updated, the old API paths will be removed.
2020-03-23 10:46:10 -07:00
Ryan Macnak
930a80ac86
Fix some compiler warnings in newer versions of Clang. (#16733) 2020-02-21 12:57:06 -08:00
stuartmorgan
44f24bd980
Fix delete of entire selection in macOS text input (#16276)
Fixes a bug where deleteBackward was checking for being at the start of
the text before checking for a non-empty selection, breaking deletion
when the entire text field was selected.

Also removes an (incorrect) post-deletion position update that was
redundant with code in insertText:replacementRange:, and thus having no
effect.

Fixes https://github.com/flutter/flutter/issues/46150
2020-02-03 15:22:44 -08:00
Dan Field
447b022ae5
Change NSLog to FML_DLOG (#16331) 2020-02-03 10:07:59 -08:00
stuartmorgan
063efce92b Report backing store changes in the macOS view (#13933) 2019-12-02 16:33:04 -08:00
Francisco Magdaleno
a68805bcf8
Listen to keyUp event on meta modified keys (#13984) 2019-12-02 16:17:19 -08:00
Francisco Magdaleno
c0db9aa11f
Remove device independent mask (#14010) 2019-11-25 14:55:12 -08:00
Greg Spencer
572e3d16c0
Fix editing selection and deletion on macOS (#13702)
This fixes the selection and deletion during text editing on macOS so that it can handle selections that have a base (selection start) that is after the extent (selection end) in the string.

Apparently the insertText:replacementRange on macOS can supply an NSRange object that has negative values for the length (even though the length is an unsigned NSUInteger). This change checks for that case, and fixes the range of characters replaced in the text to have the right bounds.

Also, I added an additional updateEditState after the state is set from the framework, since there is a timing problem: when the delete key is pressed, it sends an insertText message, which updates the framework state after the framework has already sent its state update to delete the selected region. This additional updateEditState puts the engine and framework back in sync again. Ideally, we would just avoid sending the insertText message, but there's really no way for the engine to know if the pressed key is part of an edit sequence or not.
2019-11-05 19:17:52 -08:00
Chinmay Garde
e3c5f4827d
Switch the MacOS Desktop embedder to using a thread configuration where the platform and render task runners are the same. (#13300)
Also creates a new test harness for the desktop embedder framework target and adds a test that launches a headless engine in this new thread configuration.

Fixes https://github.com/flutter/flutter/issues/17579
2019-10-28 12:47:05 -07:00
Francisco Magdaleno
ef32890466
Send flag modified events to the framework (#13269) 2019-10-22 19:01:00 -07:00
Chinmay Garde
97f5ad4a90
Avoid accessing the Cocoa view on the GPU or IO task runners. (#13295)
The view was being accessed from a background thread so its OpenGL context could be accessed. This tripped thread safety assertions in Cocoa. Now the OpenGL context is stashed in the FlutterEngine instance itself.
2019-10-22 14:21:49 -07:00
CloudWebRTC
0f9d88c7b6 Add texture support for macOS shell. (#8507) 2019-10-09 20:35:09 -07:00
Francisco Magdaleno
07d4cd919a
[macos] Stops keeping track of text input models (#12267) 2019-09-13 14:30:20 -07:00
stuartmorgan
ca4c3f6df3
Add an initial macOS version of FlutterAppDelegate (#12230)
Creates a starting point for an app delegate. For now it just
incorporates the menu and window renaming functionality that's currently
in the FDE example, but in the future this will also do forwarding of
application lifecycle events to plugins.

Fixes https://github.com/flutter/flutter/issues/32419
2019-09-12 16:03:18 -07:00
Chris Bracken
92c63e848a
Ensure trailing newline before EOF in C++ sources (#11489)
In generated text fixture location lookup code:
When the second argument to write_file() is a list, it is written one
item per line to the path specified by the first argument. This ensures
that we emit a trailing newline at EOF to comply with -Wnewline-eof.

Elsewhere:
Lack of a newline at EOF was undefined behaviour prior to C++11. The
Fuchsia tree sets -Wnewline-eof in its buildroot, so we plan to do the
same. This cleans up remaining first-party C++ sources that don't
include a trailing newline.
2019-08-27 00:13:00 -07:00
stuartmorgan
5f03c7e35d
Use of App.framework in macOS FlutterDartProject (#11380)
Adds initial use of App.framework in the macOS project configuration,
using that rather than the main bundle as the default Dart bundle, and
expecting flutter_resources to be located there.

This is an incremental step toward aligning with the behvaior of the iOS
version of this class.

Fixes https://github.com/flutter/flutter/issues/38363
2019-08-22 10:40:18 -07:00
stuartmorgan
f310ec580e
Set FlutterMacOS podspec min version to 10.11 (#11306)
The framework is built using 10.11 as the deployment version; update the
podspec accordingly.

See https://github.com/flutter/flutter/issues/33200
2019-08-20 14:51:16 -07:00
stuartmorgan
c3e9c14586
Rename macOS FLE* classes to Flutter* (#11010)
Renames all FLE* classes in the macOS embedding to Flutter*. With the exception
of -[FlutterDartProject engineSwitches], which is very clearly called out in the
comment, the APIs should be stable at this point, so the marker prefix is no
longer needed.

This is a breaking change for macOS embedders, but going forward breaking
changes at the source level for the macOS API should now be rare.

Some of these classes will likely merge with the iOS versions in the future (e.g.,
FlutterDartProject), but that will be an implementation detail that will not affect
clients.

Fixes flutter/flutter#31735
2019-08-14 15:53:17 -07:00
Francisco Magdaleno
cfa6c7c72b
[macos] Reland function refactor (#10189)
* [macos] Reland function refactor

* Fix bug
2019-07-31 10:57:02 -07:00
Francisco Magdaleno
330b0f023c
Revert "[macos] Revert check on FlutterCodecs and refactor message function] (#10009)" (#10141)
This reverts commit bd3870219a1a7f6e18c94430ead9e0f8375b03b1.
2019-07-25 13:47:29 -07:00
Francisco Magdaleno
bd3870219a
[macos] Revert check on FlutterCodecs and refactor message function] (#10009)
* [macos] Revert check on FlutterCodecs and refactor message function]

* Remove duplicated code

* Move FlutterPlatformMessage initialization
2019-07-23 15:22:38 -07:00