Closed Bug 879374 Opened 13 years ago Closed 13 years ago

Tablet pressure for mouse events doesn't work on Mac OS X

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: evanw, Assigned: evanw)

References

Details

(Keywords: dev-doc-needed)

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.29 Safari/537.36 Steps to reproduce: Open a new tab and type "document.onmousemove = function(e) { console.log(e.mozPressure); };" into the console. Actual results: Only 0 is printed to the console, even when the mouse events are generated using a tablet that supports pressure (tested on OS X). Expected results: The pressure should be reported as a number between 0 and 1, which should be non-zero when the pen tip is pressed.
Attachment #758063 - Flags: review?(smichaud)
Comment on attachment 758063 [details] [diff] [review] Patch to add mozPressure support for OS X Looks fine to me.
Attachment #758063 - Flags: review?(smichaud) → review+
Assignee: nobody → evan.exe
Status: UNCONFIRMED → ASSIGNED
Component: Untriaged → Widget: Cocoa
Ever confirmed: true
Product: Firefox → Core
Blocks: 428988
Evan: Probably the best way to fix your patch is to make sure you're not trying to call -[NSEvent pressure] on an event of type NSMouseEntered or NSMouseExited. It's certainly the simplest. An alternative would be to make sure the event has one of the following types: NSLeftMouseDown NSLeftMouseUp NSRightMouseDown NSRightMouseUp NSMouseMoved NSLeftMouseDragged NSRightMouseDragged NSOtherMouseDown NSOtherMouseUp NSOtherMouseDragged But as best I can tell that would be overkill. Side note: It's surprising that an NSEvent of subtype NSTabletPointEventSubtype can be generated by our mochitests. Maybe that's a bug in our code that synthesizes native mouse events, or more likely in Apple's +[NSEvent mouseEventWithType:...] method called by it. We may need to initialize that event's subtype to a reasonable value. I'll try to remember to check up on this later.
Attachment #758063 - Attachment is obsolete: true
Attachment #759268 - Flags: review?(smichaud)
Thanks for your help! I just finished running the whitelist approach through mochitest and it doesn't cause any issues AFAIK. I don't think NSMouseMoved events make sense with pressure so I haven't included them in the whitelist.
Comment on attachment 759268 [details] [diff] [review] Patch to add mozPressure support for OS X Looks fine to me. > Thanks for your help! You're most welcome. And thanks for your patch.
Attachment #759268 - Flags: review?(smichaud) → review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Depends on: 1091979
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: