Chromium Code Reviews| Index: ui/events/x/events_x.cc |
| diff --git a/ui/events/x/events_x.cc b/ui/events/x/events_x.cc |
| index cbc14b663a0217c2ed2ea652b9109abbc71bdfc7..30fc8731927db1ac500d39719d20ee6d8a431f3f 100644 |
| --- a/ui/events/x/events_x.cc |
| +++ b/ui/events/x/events_x.cc |
| @@ -440,6 +440,9 @@ EventType EventTypeFromNative(const base::NativeEvent& native_event) { |
| return devices->IsTouchpadXInputEvent(native_event) ? ET_SCROLL |
| : ET_MOUSEWHEEL; |
| } |
| + if (devices->GetScrollClassEventDetail(native_event) != |
| + SCROLL_TYPE_NO_SCROLL) |
| + return ET_MOUSEWHEEL; |
| if (devices->IsCMTMetricsEvent(native_event)) |
| return ET_UMA_DATA; |
| if (GetButtonMaskForX2Event(xievent)) |
| @@ -691,15 +694,22 @@ gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& native_event) { |
| int button = native_event->type == GenericEvent ? |
| EventButtonFromNative(native_event) : native_event->xbutton.button; |
| + int scroll_class_type = |
| + DeviceDataManagerX11::GetInstance()->GetScrollClassDeviceDetail( |
| + native_event); |
| + bool vertical_scroll_class = scroll_class_type & SCROLL_TYPE_VERTICAL; |
| + bool horizontal_scroll_class = scroll_class_type & SCROLL_TYPE_HORIZONTAL; |
|
sadrul
2016/01/04 18:51:21
GetScrollOffsets() above should already take care
Will Shackleton
2016/01/04 21:07:42
In the current design this is needed - GetScrollOf
sadrul
2016/01/05 16:46:23
ugh, x11 ...
OK. In that case, can we use only Ge
Will Shackleton
2016/01/05 21:27:02
wooooo so even though I've done this and it works
Will Shackleton
2016/01/05 21:27:02
That seems like a better way of doing this.
|
| + |
| switch (button) { |
| case 4: |
| - return gfx::Vector2d(0, kWheelScrollAmount); |
| + return gfx::Vector2d(0, vertical_scroll_class ? 0 : kWheelScrollAmount); |
| case 5: |
| - return gfx::Vector2d(0, -kWheelScrollAmount); |
| + return gfx::Vector2d(0, vertical_scroll_class ? 0 : -kWheelScrollAmount); |
| case 6: |
| - return gfx::Vector2d(kWheelScrollAmount, 0); |
| + return gfx::Vector2d(horizontal_scroll_class ? 0 : kWheelScrollAmount, 0); |
| case 7: |
| - return gfx::Vector2d(-kWheelScrollAmount, 0); |
| + return gfx::Vector2d(horizontal_scroll_class ? 0 : -kWheelScrollAmount, |
| + 0); |
| default: |
| return gfx::Vector2d(); |
| } |
| @@ -783,30 +793,38 @@ bool GetScrollOffsets(const base::NativeEvent& native_event, |
| float* x_offset_ordinal, |
| float* y_offset_ordinal, |
| int* finger_count) { |
| - if (!DeviceDataManagerX11::GetInstance()->IsScrollEvent(native_event)) |
| - return false; |
| + if (DeviceDataManagerX11::GetInstance()->IsScrollEvent(native_event)) { |
| + // Temp values to prevent passing NULLs to DeviceDataManager. |
| + float x_offset_, y_offset_; |
| + float x_offset_ordinal_, y_offset_ordinal_; |
| + int finger_count_; |
| + if (!x_offset) |
| + x_offset = &x_offset_; |
| + if (!y_offset) |
| + y_offset = &y_offset_; |
| + if (!x_offset_ordinal) |
| + x_offset_ordinal = &x_offset_ordinal_; |
| + if (!y_offset_ordinal) |
| + y_offset_ordinal = &y_offset_ordinal_; |
| + if (!finger_count) |
| + finger_count = &finger_count_; |
| + |
| + DeviceDataManagerX11::GetInstance()->GetScrollOffsets( |
| + native_event, x_offset, y_offset, x_offset_ordinal, y_offset_ordinal, |
| + finger_count); |
| + return true; |
| + } |
| - // Temp values to prevent passing NULLs to DeviceDataManager. |
| - float x_offset_, y_offset_; |
| - float x_offset_ordinal_, y_offset_ordinal_; |
| - int finger_count_; |
| - if (!x_offset) |
| - x_offset = &x_offset_; |
| - if (!y_offset) |
| - y_offset = &y_offset_; |
| - if (!x_offset_ordinal) |
| - x_offset_ordinal = &x_offset_ordinal_; |
| - if (!y_offset_ordinal) |
| - y_offset_ordinal = &y_offset_ordinal_; |
| - if (!finger_count) |
| - finger_count = &finger_count_; |
| - |
| - DeviceDataManagerX11::GetInstance()->GetScrollOffsets( |
| - native_event, |
| - x_offset, y_offset, |
| - x_offset_ordinal, y_offset_ordinal, |
| - finger_count); |
| - return true; |
| + if (DeviceDataManagerX11::GetInstance()->GetScrollClassEventDetail( |
| + native_event) != SCROLL_TYPE_NO_SCROLL) { |
| + double x_scroll_offset, y_scroll_offset; |
| + DeviceDataManagerX11::GetInstance()->GetScrollClassOffsets( |
| + native_event, &x_scroll_offset, &y_scroll_offset); |
| + *x_offset = x_scroll_offset * kWheelScrollAmount; |
| + *y_offset = y_scroll_offset * kWheelScrollAmount; |
| + return true; |
| + } |
| + return false; |
| } |
| bool GetFlingData(const base::NativeEvent& native_event, |