Index: ui/events/x/events_x.cc |
diff --git a/ui/events/x/events_x.cc b/ui/events/x/events_x.cc |
index 94a7785c58f0a4086a67548c15cf5d554ac243cc..daff41b59a40a54edce0ed7e9bef5ad910a45d48 100644 |
--- a/ui/events/x/events_x.cc |
+++ b/ui/events/x/events_x.cc |
@@ -443,6 +443,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)) |
@@ -694,15 +697,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; |
+ |
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(); |
} |
@@ -786,30 +796,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, |