-
Notifications
You must be signed in to change notification settings - Fork 6k
feat: add custom cursor interface on windows #36143
feat: add custom cursor interface on windows #36143
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
66d2190
to
93434f3
Compare
0d14ab9
to
ad36c9e
Compare
Thanks for the review, all comments has resolved. Is there other jobs I need to do? :) |
@Kingtous Thanks for following up quickly! Could you add a unit test that sends a Once that's ready, we should get approval from @dkwingsmt as they worked in this space. |
Thank you. I didn't know you can create However, I'm hesitant on merging the method channel, since we are hoping to design a universal API (method channel) for all platforms, and the current method is likely platform dependent. But I also understand that we need to develop one step at a time. So I think there are two options:
Also, the flow I'm imagining is, instead of setting the cursor using the buffer directly, which you have to do every time you set the same cursor,
|
Sounds great for a universal API to change cursor, which is a very important feature, especially for games. Although this PR is providing a new feature, it more like a bugfix. It fills the limitation(or fix bugs?) with custom cursor on windows, currently.(by extending offcial This problem has blocked so many developers as mentioned in flutter/flutter#31952 (comment) flutter/flutter#99484 I think the two options are all ok, and I prefer Option 2. Currently, this PR can be a temporary and fast workaround to uniform custom cursor behaviors on all platforms. Devs can change custom cursor easily by providing a raw BGRA buffer, without any win32 knowledge. here are some questions: I've thought about |
I noticed that |
I've extracted the cursor creation logic to a function named |
@stuartmorgan What do you think? (Also I'm not familiar enough with the capability of plugins.) |
No problem, let me know when it's ready :) Thank you so much for working on this! |
I've tested this commit with the latest flutter/engine, it works perfectly with https://github.com/Kingtous/rustdesk_flutter_custom_cursor/blob/refactor/flutter/master/lib/cursor_manager.dart The test cursor has successfully shown without a delay or an error. All comments have been resolved now. Later I consider to publish this custom plugin to |
auto label is removed for flutter/engine, pr: 36143, due to - Please get at least one approved review if you are already a member or two member reviews if you are not a member before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead. |
auto label is removed for flutter/engine, pr: 36143, due to Validations Fail. |
@stuartmorgan Would you like to give a second review? |
@Kingtous I've approved this PR, but it is required that each PR needs the participance of 2 members of flutter/flutter-hackers, or in the case of this PR, 2 approvals. I'm looking for a second reviewer. |
How long will this take? |
@dkwingsmt This looks good to go. Please CQ when ready :) |
…116387) * fa24f943a feat: add custom cursor interface on windows (flutter/engine#36143) * 1603fa1bb Remove glitches when scrolling on old Android TV devices (flutter/engine#37493)
…lutter#116387) * fa24f943a feat: add custom cursor interface on windows (flutter/engine#36143) * 1603fa1bb Remove glitches when scrolling on old Android TV devices (flutter/engine#37493)
…lutter#116387) * fa24f943a feat: add custom cursor interface on windows (flutter/engine#36143) * 1603fa1bb Remove glitches when scrolling on old Android TV devices (flutter/engine#37493)
* feat: initial custom cursor and cache support * opt: add cursor validity check * opt: format code * opt: rename more suitable name * opt: key, method name * opt: code * feat: add unittests * opt: change to ref * opt: docs * opt: format code * opt: code * opt: correct code and comments * opt: rgba -> bgra * opt: name * opt: create valid/compatible mask of bitmap & mask * opt: null check * opt: split cursor functions into configurable ones * fix: EncodableValue type * opt: doc for custom cursor key * update: cursor doc * opt: docs * opt: refactor vector cache to unordered_map * opt: code * opt: unifrom key value * opt: uniform key_iter to name_iter * opt: docs * fix: get width out of range
…lutter#116387) * fa24f943a feat: add custom cursor interface on windows (flutter/engine#36143) * 1603fa1bb Remove glitches when scrolling on old Android TV devices (flutter/engine#37493)
* feat: initial custom cursor and cache support * opt: add cursor validity check * opt: format code * opt: rename more suitable name * opt: key, method name * opt: code * feat: add unittests * opt: change to ref * opt: docs * opt: format code * opt: code * opt: correct code and comments * opt: rgba -> bgra * opt: name * opt: create valid/compatible mask of bitmap & mask * opt: null check * opt: split cursor functions into configurable ones * fix: EncodableValue type * opt: doc for custom cursor key * update: cursor doc * opt: docs * opt: refactor vector cache to unordered_map * opt: code * opt: unifrom key value * opt: uniform key_iter to name_iter * opt: docs * fix: get width out of range
This PR adds an additional interface to set custom cursor on windows, which fixes issues mentioned below.
Currently, Customizing
MouseCursor
on windows is not working, the customed mouse will restore to arrow once it moves. See flutter/flutter#31952 (comment)flutter/flutter#99484
for details. Variable
current_cursor_
incursor handler
will not update when we set our custom cursors, and we cannot change this field to prevent the cursor from restoring due to lacking of interface.The reason is that cursor handler on windows has no interface to change current cursor to custom cursor, only support setting windows self-contained icons.
Changes:
SystemCursors.mousecursors
, which can changecurrent_cursor_
, make possible to handle custom cursor on windows correctly.We have successfully tested this interface in https://github.com/Kingtous/rustdesk_flutter_custom_cursor/blob/8f3be4ac68b4fb20d05b8d30df4c13d8fd77f9c4/lib/flutter_custom_cursor.dart#L113, which works perfectly on windows.
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
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.