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

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

Issue 688253002: Implemented smooth scrolling using xinput2 in X11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applied @msw's comments - renamed amount to remainder Created 4 years, 11 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
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..d2e00efece36918e7f6184a4214519a67146f3e3 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))
@@ -786,30 +789,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()->GetScrollClassDeviceDetail(
+ 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,

Powered by Google App Engine
This is Rietveld 408576698