Last Comment Bug 879374 - Tablet pressure for mouse events doesn't work on Mac OS X
: Tablet pressure for mouse events doesn't work on Mac OS X
Status: RESOLVED FIXED
: dev-doc-needed
Product: Core
Classification: Components
Component: Widget: Cocoa (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal (vote)
: mozilla24
Assigned To: Evan Wallace
:
: Markus Stange [:mstange]
Mentors:
Depends on: 1091979
Blocks: 428988
  Show dependency treegraph
 
Reported: 2013-06-04 11:26 PDT by Evan Wallace
Modified: 2014-10-30 18:55 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch to add mozPressure support for OS X (424 bytes, patch)
2013-06-04 11:29 PDT, Evan Wallace
smichaud: review+
Details | Diff | Splinter Review
Patch to add mozPressure support for OS X (740 bytes, patch)
2013-06-06 10:56 PDT, Evan Wallace
smichaud: review+
Details | Diff | Splinter Review

Description Evan Wallace 2013-06-04 11:26:40 PDT
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.
Comment 1 Evan Wallace 2013-06-04 11:29:43 PDT
Created attachment 758063 [details] [diff] [review]
Patch to add mozPressure support for OS X
Comment 2 Steven Michaud [:smichaud] (Retired) 2013-06-05 07:58:36 PDT
Comment on attachment 758063 [details] [diff] [review]
Patch to add mozPressure support for OS X

Looks fine to me.
Comment 3 Ryan VanderMeulen [:RyanVM] 2013-06-05 09:17:57 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/fe9dcdf48551
Comment 5 Steven Michaud [:smichaud] (Retired) 2013-06-06 10:08:41 PDT
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.
Comment 6 Evan Wallace 2013-06-06 10:56:23 PDT
Created attachment 759268 [details] [diff] [review]
Patch to add mozPressure support for OS X
Comment 7 Evan Wallace 2013-06-06 10:57:52 PDT
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 8 Steven Michaud [:smichaud] (Retired) 2013-06-06 12:38:14 PDT
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.
Comment 9 Ryan VanderMeulen [:RyanVM] 2013-06-07 05:42:55 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/105a243547d3
Comment 10 Ryan VanderMeulen [:RyanVM] 2013-06-07 12:31:41 PDT
https://hg.mozilla.org/mozilla-central/rev/105a243547d3

Note You need to log in before you can comment on or make changes to this bug.