avm2: Implement flash.ui.Mouse.cursor - #24150
Open
falpi wants to merge 1 commit into
Open
Conversation
falpi
force-pushed
the
add-mouse-cursor-property
branch
from
July 7, 2026 21:01
9fe540d to
3462e65
Compare
flash.ui.Mouse had no `cursor` property, so assignments to it were lost. The Text Layout Framework sets `Mouse.cursor = MouseCursor.IBEAM` when the pointer enters editable text, so Spark TextInput/TextArea (and any TLF content) never showed the I-beam cursor. Add the native `cursor` getter/setter, backed by a `forced_cursor` field on MouseData. `MouseCursor.AUTO` maps to `None` (the cursor is still chosen automatically from the object under the pointer); any other value overrides that automatic choice in the player's cursor update. Invalid values throw ArgumentError ruffle-rs#2008, matching Flash Player.
falpi
force-pushed
the
add-mouse-cursor-property
branch
from
July 7, 2026 23:31
3462e65 to
02d39d6
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
flash.ui.Mousewas missing thecursorproperty entirely, so assignments toMouse.cursorhad no effect. The Text Layout Framework setsMouse.cursor = MouseCursor.IBEAMwhen the pointer moves over editable text, soSpark
TextInput/TextArea(and any TLF-based content) never displayed theI-beam cursor — the pointer stayed an arrow.
This implements
flash.ui.Mouse.cursor(getter and setter), letting contentforce a specific cursor and matching Flash Player.
Root cause
flash.ui.Mouseonly exposedhide/show/supportsCursor/registerCursor.There was no
cursorproperty, so:Mouse.cursor = MouseCursor.IBEAM(used byflashx.textLayout.edit.SelectionManager.setMouseCursor) was a no-op / illegal write, andMouse.cursorwas unsupported.Ruffle already picks a cursor automatically from the object under the pointer
(arrow, button, I-beam over a
TextField, …), but nothing let ActionScriptforce one.
Reproduction
Minimal AS3: a grey rectangle that requests the I-beam while hovered. Without
this patch the cursor stays an arrow (and the assignment does not take effect);
with it, the pointer becomes an I-beam over the rectangle.
The same path is exercised implicitly by any Flex Spark editable text control.
Fix
forced_cursor: Option<MouseCursor>field to the persistentMouseData.Mouse.cursorsetter stores it; the getter reads it back.MouseCursor.AUTOmaps toNone— the automatic per-object cursor is kept —and any other value overrides that choice. Invalid strings throw
ArgumentErroravm1: Color.setTransform/setRGB sets transformed-by-script flag (fix #1906) #2008, as in Flash Player.Noneforced_cursorreplaces theautomatically-computed cursor before it is applied.
The AS3 constant ↔ internal enum mapping:
AUTO→None,ARROW→Arrow,BUTTON→Hand,IBEAM→IBeam,HAND→Grab.Notes
recomputed while processing pointer events); TLF sets it during
rollOver/mouseMove, so it applies immediately in practice.Mouse.cursoris left at its default"auto".Checklist