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

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

Issue 8907005: Add support for new scroll valuators coming from CMT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup and comments Created 9 years 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/base/x/events_x.cc
diff --git a/ui/base/x/events_x.cc b/ui/base/x/events_x.cc
index 4f2db853d7cb08892f4f8cb9a49e6dc114fc288a..1ccec4b1a5bbc6e1740e11c12586d374ccb60f26 100644
--- a/ui/base/x/events_x.cc
+++ b/ui/base/x/events_x.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "ui/base/keycodes/keyboard_code_conversion_x.h"
#include "ui/base/touch/touch_factory.h"
+#include "ui/base/x/scroll_factory.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/point.h"
@@ -192,21 +193,22 @@ EventType EventTypeFromNative(const base::NativeEvent& native_event) {
static_cast<XIDeviceEvent*>(native_event->xcookie.data);
if (TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid))
return GetTouchEventType(native_event);
- int button = EventButtonFromNative(native_event);
switch (xievent->evtype) {
case XI_ButtonPress:
- if (button >= kMinWheelButton &&
- button <= kMaxWheelButton)
- return ET_MOUSEWHEEL;
- return ET_MOUSE_PRESSED;
- case XI_ButtonRelease:
- if (button >= kMinWheelButton &&
- button <= kMaxWheelButton)
+ case XI_ButtonRelease: {
+ int button = EventButtonFromNative(native_event);
+ if (button >= kMinWheelButton && button <= kMaxWheelButton)
return ET_MOUSEWHEEL;
- return ET_MOUSE_RELEASED;
+ return xievent->evtype == XI_ButtonPress ?
+ ET_MOUSE_PRESSED : ET_MOUSE_RELEASED;
+ }
case XI_Motion:
- return GetButtonMaskForX2Event(xievent) ?
- ET_MOUSE_DRAGGED : ET_MOUSE_MOVED;
+ if (GetScrollOffsets(native_event, NULL, NULL))
+ return ET_SCROLL;
+ else if (GetButtonMaskForX2Event(xievent))
+ return ET_MOUSE_DRAGGED;
+ else
+ return ET_MOUSE_MOVED;
}
}
default:
@@ -405,6 +407,13 @@ float GetTouchForce(const base::NativeEvent& native_event) {
return force;
}
+bool GetScrollOffsets(const base::NativeEvent& native_event,
+ float* x_offset,
+ float* y_offset) {
+ return ui::ScrollFactory::GetInstance()->GetScrollOffsets(
+ *native_event, x_offset, y_offset);
+}
+
base::NativeEvent CreateNoopEvent() {
static XEvent* noop = NULL;
if (!noop) {

Powered by Google App Engine
This is Rietveld 408576698