The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in mozilla24

Status

()

Core
Widget: Cocoa
RESOLVED FIXED
4 years ago
2 years ago

People

(Reporter: Evan Wallace, Assigned: Evan Wallace)

Tracking

({dev-doc-needed})

Trunk
mozilla24
x86
Mac OS X
dev-doc-needed
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

4 years ago
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.
(Assignee)

Comment 1

4 years ago
Created attachment 758063 [details] [diff] [review]
Patch to add mozPressure support for OS X
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
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/fe9dcdf48551
Keywords: checkin-needed
Backed out for mochitest crashes.
https://hg.mozilla.org/integration/mozilla-inbound/rev/a54df4462572

https://tbpl.mozilla.org/php/getParsedLog.php?id=23818811&tree=Mozilla-Inbound
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.
(Assignee)

Comment 6

4 years ago
Created attachment 759268 [details] [diff] [review]
Patch to add mozPressure support for OS X
Attachment #758063 - Attachment is obsolete: true
Attachment #759268 - Flags: review?(smichaud)
(Assignee)

Comment 7

4 years ago
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+
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/105a243547d3
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/105a243547d3
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Keywords: dev-doc-needed
Depends on: 1091979
You need to log in before you can comment on or make changes to this bug.