Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: ui/events/x/events_x_utils.cc

Issue 1891303002: Fixed scrolling for mixed-valuator mouse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/x/events_x_utils.cc
diff --git a/ui/events/x/events_x_utils.cc b/ui/events/x/events_x_utils.cc
index 452c096a06a1e4baa0fc296cc2cbf8062703f913..64b652c7cfc469c6fa4baea3eed622d7a8b70c58 100644
--- a/ui/events/x/events_x_utils.cc
+++ b/ui/events/x/events_x_utils.cc
@@ -626,15 +626,22 @@ gfx::Vector2d GetMouseWheelOffsetFromXEvent(const XEvent& xev) {
int button = xev.type == GenericEvent ? EventButtonFromXEvent(xev)
: xev.xbutton.button;
+ // If this is an xinput1 scroll event from an xinput2 mouse then we need to
+ // block the legacy scroll events for the necessary axes.
sadrul 2016/04/19 14:28:24 For mouse-press/releases on a normal mouse device,
+ int scroll_class_type =
+ DeviceDataManagerX11::GetInstance()->GetScrollClassDeviceDetail(xev);
+ bool xi2_vertical = scroll_class_type & SCROLL_TYPE_VERTICAL;
+ bool xi2_horizontal = scroll_class_type & SCROLL_TYPE_HORIZONTAL;
+
switch (button) {
case 4:
- return gfx::Vector2d(0, kWheelScrollAmount);
+ return gfx::Vector2d(0, xi2_vertical ? 0 : kWheelScrollAmount);
case 5:
- return gfx::Vector2d(0, -kWheelScrollAmount);
+ return gfx::Vector2d(0, xi2_vertical ? 0 : -kWheelScrollAmount);
case 6:
- return gfx::Vector2d(kWheelScrollAmount, 0);
+ return gfx::Vector2d(xi2_horizontal ? 0 : kWheelScrollAmount, 0);
case 7:
- return gfx::Vector2d(-kWheelScrollAmount, 0);
+ return gfx::Vector2d(xi2_horizontal ? 0 : -kWheelScrollAmount, 0);
default:
return gfx::Vector2d();
}
@@ -731,7 +738,7 @@ bool GetScrollOffsetsFromXEvent(const XEvent& xev,
return true;
}
- if (DeviceDataManagerX11::GetInstance()->GetScrollClassDeviceDetail(xev) !=
+ if (DeviceDataManagerX11::GetInstance()->GetScrollClassEventDetail(xev) !=
SCROLL_TYPE_NO_SCROLL) {
double x_scroll_offset, y_scroll_offset;
DeviceDataManagerX11::GetInstance()->GetScrollClassOffsets(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698