Closed
Bug 741968
Opened 13 years ago
Closed 13 years ago
Support mouse wheel scrolling in WinRT widget
Categories
(Firefox for Metro Graveyard :: Input, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: bbondy, Assigned: TimAbraldes)
References
()
Details
(Keywords: feature, Whiteboard: [metro-mvp] completed-elm)
Attachments
(2 files, 4 obsolete files)
2.41 KB,
patch
|
jimm
:
review+
|
Details | Diff | Splinter Review |
3.87 KB,
patch
|
masayuki
:
review+
|
Details | Diff | Splinter Review |
The mouse wheel doesn't currently do anything in Metro Fennec, it should scroll the page.
Reporter | ||
Comment 1•13 years ago
|
||
Reporter | ||
Updated•13 years ago
|
Whiteboard: completed-elm
Comment 2•13 years ago
|
||
Hmm, we're going to remove nsMouseScrollEvent from widget. See bug 719320.
![]() |
||
Comment 3•13 years ago
|
||
Doing an mc merge today which brought in the new w3c wheel events. I'm pretty sure this totally broke. :/ Will try to test this on the tablet when I get a chance this weekend.
Whiteboard: completed-elm
![]() |
||
Updated•13 years ago
|
Reporter | ||
Updated•13 years ago
|
Assignee: netzen → nobody
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → tabraldes
![]() |
||
Updated•13 years ago
|
Whiteboard: metro-beta
![]() |
||
Comment 4•13 years ago
|
||
Tim, we'd really like to get this fix in asap if possible for the preview, can you make this a priority for today?
Depends on: 719320
![]() |
||
Updated•13 years ago
|
Whiteboard: metro-beta → metro-preview
Assignee | ||
Comment 5•13 years ago
|
||
This patch makes "horizontal" scrolling be in the X direction and "vertical" in the Y. Also it uses `InitMouseEvent` to initialize the wheel event.
Attachment #611893 -
Attachment is obsolete: true
Attachment #668219 -
Flags: review?(jmathies)
![]() |
||
Comment 6•13 years ago
|
||
Comment on attachment 668219 [details] [diff] [review]
Patch
This works fine, lets get it landed.
The scrolling seems kinda slow, I wonder if that's a pref we can tweak, or something in the values winrt is sending us, or maybe it's just my system. We can file a follow up on that though if it's wide spread.
Attachment #668219 -
Flags: review?(jmathies) → review+
Reporter | ||
Comment 7•13 years ago
|
||
sweet!
Reporter | ||
Comment 8•13 years ago
|
||
Hey Tim I think maybe we need to set the mouse button like this:
https://bugzilla.mozilla.org/page.cgi?id=splinter.html&bug=741968&attachment=611893
Currently it's always being set to 0
Reporter | ||
Comment 9•13 years ago
|
||
Maybe it doesn't matter for scrolling
Assignee | ||
Comment 10•13 years ago
|
||
(In reply to Brian R. Bondy [:bbondy] from comment #8)
> Hey Tim I think maybe we need to set the mouse button like this:
> https://bugzilla.mozilla.org/page.cgi?id=splinter.
> html&bug=741968&attachment=611893
>
> Currently it's always being set to 0
I believe the `InitMouseEvent` call should handle that.
https://hg.mozilla.org/projects/elm/file/9a65b4e8099d/widget/windows/winrt/MetroWidget.cpp#l910
Status: NEW → ASSIGNED
Reporter | ||
Comment 11•13 years ago
|
||
Yup good call, glad this will be fixed in tomorrow's nightly for preview users :D This is their biggest complaint.
Assignee | ||
Comment 12•13 years ago
|
||
Whiteboard: metro-preview → metro-preview completed-elm
Comment 13•13 years ago
|
||
Looks like the patch doesn't set lineOrPageDeltaX and lineOrPageDeltaY. They are necessary for dispatching DOMMouseScrollEvent.
And why the refPoint is always 0.0? the cursor position is important for wheel event to decide the event target.
Assignee | ||
Comment 14•13 years ago
|
||
(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #13)
> Looks like the patch doesn't set lineOrPageDeltaX and lineOrPageDeltaY. They
> are necessary for dispatching DOMMouseScrollEvent.
>
> And why the refPoint is always 0.0? the cursor position is important for
> wheel event to decide the event target.
I'll write a follow-up patch that addresses these issues. Thanks!
Assignee | ||
Comment 15•13 years ago
|
||
I'm currently building this patch to test it.
(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #13)
> Looks like the patch doesn't set lineOrPageDeltaX and lineOrPageDeltaY. They
> are necessary for dispatching DOMMouseScrollEvent.
From the other uses of `lineOrPageDeltaX` and `lineOrPageDeltaY` that I've found, it seems that they should just be set to the same value as `deltaX` and `deltaY`. Is this correct?
> And why the refPoint is always 0.0? the cursor position is important for
> wheel event to decide the event target.
I've removed the lines that set `refPoint` back to (0,0). The values set in `InitMousePoint` are now the ones we send in the `WheelEvent`.
Attachment #668258 -
Flags: review?(masayuki)
Comment 16•13 years ago
|
||
Comment on attachment 668258 [details] [diff] [review]
Followup patch
Hmm, I think that current code doesn't support high-resolution scrolling, right?
>diff --git a/widget/windows/winrt/MetroWidget.cpp b/widget/windows/winrt/MetroWidget.cpp
>--- a/widget/windows/winrt/MetroWidget.cpp
>+++ b/widget/windows/winrt/MetroWidget.cpp
>@@ -975,32 +975,32 @@ MetroWidget::InitMouseEvent(PointerEvent
> static int previousVertLeftOverDelta = 0;
> static int previousHorLeftOverDelta = 0;
> if (currentProps->IsHorizontalMouseWheel) {
> wheelEvent.deltaX = (currentProps->MouseWheelDelta + previousHorLeftOverDelta) / WHEEL_DELTA * -1;
I think that this should be:
> wheelEvent.deltaX =
> static_cast<double>(currentProps->MouseWheelDelta + previousHorLeftOverDelta) / WHEEL_DELTA;
deltaX is double. So, you need to cast the first int value to double. Then, it supports high resolution scroll such as scrolling per 0.1 line.
And I think that you shouldn't revert the sign for horizontal scroll. Doesn't the positive native delta value mean to scroll to right?
>+ wheelEvent.lineOrPageDeltaX = wheelEvent.deltaX;
I think that this needs static_cast<int32_t> for preventing the warning.
> previousHorLeftOverDelta = (currentProps->MouseWheelDelta + previousHorLeftOverDelta) % WHEEL_DELTA;
Then, I think that this static variable isn't necessary for this use.
However, then, lineOrPageDeltaX cannot be computed correctly. It never becomes 1 or -1 if the deltaX is always smaller than 1 or larger than -1.
So, I think the block should be:
> static double previousHorLeftOverDelta = 0.0;
> if (currentProps->IsHorizontalMouseWheel) {
> wheelEvent.deltaX = static_cast<double>(currentProps->MouseWheelDelta) / WHEEL_DELTA;
> if ((wheelEvent.deltaX > 0.0 && previousHorLeftOverDelta < 0.0) ||
> (wheelEvent.deltaX < 0.0 && previousHorLeftOverDelta > 0.0) {
> previousHorLeftOverDelta = 0.0;
> }
> wheelEvent.lineOrPageDeltaX = static_cast<int32_t>(wheelEvent.deltaX + previousHorLeftOverDelta);
> previousHorLeftOverDelta = wheelEvent.deltaX - wheelEvent.lineOrPageDeltaX;
> }
Please write similar code for vertical scroll.
You can test the wheel events in here:
https://bug719320.bugzilla.mozilla.org/attachment.cgi?id=650444
FYI:
https://developer.mozilla.org/en-US/docs/DOM/MouseScrollEvent
https://developer.mozilla.org/en-US/docs/en-US/DOM/DOM_event_reference/DOMMouseScroll
https://developer.mozilla.org/en-US/docs/en-US/DOM/DOM_event_reference/MozMousePixelScroll
https://developer.mozilla.org/en-US/docs/DOM/WheelEvent
https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/wheel
Assignee | ||
Comment 17•13 years ago
|
||
I think I now understand the intent of `deltaX/Y` versus `lineOrPageDeltaX/Y`.
This patch should set those values appropriately and avoid any nasty double/int casting issues.
Attachment #668258 -
Attachment is obsolete: true
Attachment #668258 -
Flags: review?(masayuki)
Attachment #668631 -
Flags: review?(masayuki)
Assignee | ||
Comment 18•13 years ago
|
||
This patch avoids the positive/negative numbers issues in the last patch. Sorry for the bug spam!
Attachment #668631 -
Attachment is obsolete: true
Attachment #668631 -
Flags: review?(masayuki)
Attachment #668639 -
Flags: review?(masayuki)
Comment 19•13 years ago
|
||
Comment on attachment 668639 [details] [diff] [review]
Followup patch
>+#include <math.h>
You don't need this.
> if (currentProps->IsHorizontalMouseWheel) {
>- wheelEvent.deltaX = (currentProps->MouseWheelDelta + previousHorLeftOverDelta) / WHEEL_DELTA * -1;
>- previousHorLeftOverDelta = (currentProps->MouseWheelDelta + previousHorLeftOverDelta) % WHEEL_DELTA;
>+ wheelEvent.deltaX = static_cast<double>(currentProps->MouseWheelDelta)
>+ / WHEEL_DELTA_DOUBLE;
Isn't the result of (int / double) double? I mean don't you remove the cast because WHEEL_DELTA_DOUBLE is double. Then, looks like the two lines become a line.
>+ previousHorLeftOverDelta += currentProps->MouseWheelDelta;
>+ if (abs(previousHorLeftOverDelta) >= WHEEL_DELTA) {
Hmm, I don't think this if statement is necessary. E.g., 60 / WHEEL_DELTA is 0. Even if it were necessary, you should use NS_ABS() instead of abs().
>+ wheelEvent.lineOrPageDeltaX = previousHorLeftOverDelta / WHEEL_DELTA;
>+ previousHorLeftOverDelta %= WHEEL_DELTA;
>+ }
Assignee | ||
Comment 20•13 years ago
|
||
(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #19)
> Comment on attachment 668639 [details] [diff] [review]
> Followup patch
>
> >+#include <math.h>
>
> You don't need this.
Removed.
> > if (currentProps->IsHorizontalMouseWheel) {
> >- wheelEvent.deltaX = (currentProps->MouseWheelDelta + previousHorLeftOverDelta) / WHEEL_DELTA * -1;
> >- previousHorLeftOverDelta = (currentProps->MouseWheelDelta + previousHorLeftOverDelta) % WHEEL_DELTA;
> >+ wheelEvent.deltaX = static_cast<double>(currentProps->MouseWheelDelta)
> >+ / WHEEL_DELTA_DOUBLE;
>
> Isn't the result of (int / double) double? I mean don't you remove the cast
> because WHEEL_DELTA_DOUBLE is double. Then, looks like the two lines become
> a line.
I had included the cast to make it more obvious what was happening here. Writing out the cast isn't strictly necessary since it will happen implicitly. Removed.
> >+ previousHorLeftOverDelta += currentProps->MouseWheelDelta;
> >+ if (abs(previousHorLeftOverDelta) >= WHEEL_DELTA) {
>
> Hmm, I don't think this if statement is necessary. E.g., 60 / WHEEL_DELTA is
> 0. Even if it were necessary, you should use NS_ABS() instead of abs().
>
> >+ wheelEvent.lineOrPageDeltaX = previousHorLeftOverDelta / WHEEL_DELTA;
> >+ previousHorLeftOverDelta %= WHEEL_DELTA;
> >+ }
I was trying to be more explicit for the sake of people who read this code later. In this case, it's probably easier to read without the "if" statement. Removed.
Attachment #668639 -
Attachment is obsolete: true
Attachment #668639 -
Flags: review?(masayuki)
Attachment #669230 -
Flags: review?(masayuki)
Comment 21•13 years ago
|
||
Comment on attachment 669230 [details] [diff] [review]
Followup patch
Looks fine, thank you.
Attachment #669230 -
Flags: review?(masayuki) → review+
Assignee | ||
Comment 22•13 years ago
|
||
Assignee | ||
Updated•13 years ago
|
Component: Widget: Win32 → Input
Keywords: feature
Product: Core → Firefox for Metro
Hardware: x86_64 → All
Whiteboard: metro-preview completed-elm → [metro-mvp] completed-elm
Comment 24•13 years ago
|
||
Resolving bugs in the Firefox for Metro product that are fixed on the elm branch. Sorry for the bugspam. Search your email for "bugspam-elm" if you want to find and delete all of these messages at once.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
OS: Windows 8 Metro → Windows 8.1
You need to log in
before you can comment on or make changes to this bug.
Description
•