Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

System mouse cursor: Web #17718

Merged
merged 14 commits into from
May 20, 2020
Merged

Conversation

dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Apr 14, 2020

Description

This PR adds system mouse cursor to the web engine.

This PR adds only a limited pool of system cursors. More will be added when the system is set up.

Related Issues

Known issues

The mouse position flickers when the cursor changes.

Update: This is not a Flutter issue, but a general issue of macOS

1

Entering:
image
Leaving:
image

@dkwingsmt
Copy link
Contributor Author

@yjbanov @ferhatb Can you take a look, also do you have an idea about the flickering?

@dkwingsmt
Copy link
Contributor Author

It seems to me that this issue is not related to Flutter but a general issue (I noticed it on https://css-tricks.com/almanac/properties/c/cursor/).

// The shape code values must be kept in sync with flutter's
// rendering/mouse_cursor.dart
switch (shapeCode) {
case /* none */ 0x334c4a:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you define kShapeCodeX/Y/Z in engine and then use those codes in rendering/mouse_cursor instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to import engine code from framework at all? Also these constants have to be replicated to other platforms as well, including Android, macOS, GLFW, etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They would be part of dart:ui , just like StrokeJoin or other consts/enums. @gspencergoog : how do you typically handle consts across the 2 repos?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, actually, I think Ferhat is right: we should define the codes just as contiguous integers, and define an enum that matches in the Dart code.

StrokeJoin defines an enum, and then in the C++/Java code, it defines constants that are used as indices into the StrokeJoin.values member.

Then the only things that need to be kept in sync are the enum (which is in the engine repo in dart:ui), and the constants (which are also in the engine repo).

You can also look at ImageByteFormat or TileMode, or any of the other enums we use that way in the engine.

@ferhatb
Copy link
Contributor

ferhatb commented Apr 15, 2020

I noticed that resize cursors are missing from codes which are used very frequently for things like resizing dividers etc. Are you planning to add more ? The web list of cursors is probably a good set to look at.

@dkwingsmt
Copy link
Contributor Author

dkwingsmt commented Apr 15, 2020

Yes, all cursors from CSS will be supported in an upcoming PR when the code styles are stabilized. This PR is a first step that aims to set up the infrastructure, and only include a small set of cursors to limit the scope of changes.

@dkwingsmt
Copy link
Contributor Author

The described bug is actually from macOS, and not related to Web whatsoever.

Copy link
Contributor

@ferhatb ferhatb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please dartfmt. Thx!

@nturgut
Copy link
Contributor

nturgut commented May 20, 2020

I think Linux Fuchsia unit tests were a temporary breakage. I checked the LUCI , builds the current PRs are passing. May be we can sync to the head and re-run.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 22, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 22, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 22, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 22, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 22, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 22, 2020
wandyers pushed a commit to wandyers/engine that referenced this pull request May 23, 2020
Adds system mouse cursor to the web engine.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 23, 2020
@ayushin
Copy link

ayushin commented May 24, 2020

Still present in master on Mac OSX Safari Version 13.1 (15609.1.20.111.8)

Overflow on channel: flutter/mousecursor. Messages on this channel are being discarded in FIFO fashion. The engine may not be running or you need to adjust the buffer size if of the channel. SE — channel_buffers.dart:144

[✓] Flutter (Channel master, 1.19.0-2.0.pre.143, on Mac OS X 10.15.4 19E287, locale en-CZ)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants