Index: ui/platform_window/x11/x11_window.cc |
diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc |
index 2f4ed0063dd0a8792a93edb607aebf86006c2982..8738fca2ab4bf249b38edb227cffd9f656db0e66 100644 |
--- a/ui/platform_window/x11/x11_window.cc |
+++ b/ui/platform_window/x11/x11_window.cc |
@@ -14,6 +14,7 @@ |
#include "ui/events/platform/platform_event_dispatcher.h" |
#include "ui/events/platform/platform_event_source.h" |
#include "ui/events/platform/x11/x11_event_source.h" |
+#include "ui/events/x/touch_factory_x11.h" |
#include "ui/gfx/geometry/rect.h" |
#include "ui/gfx/x/x11_atom_cache.h" |
#include "ui/gfx/x/x11_types.h" |
@@ -47,6 +48,7 @@ X11Window::X11Window(PlatformWindowDelegate* delegate) |
atom_cache_(xdisplay_, kAtomsToCache), |
window_mapped_(false) { |
CHECK(delegate_); |
+ TouchFactory::SetTouchDeviceListFromCommandLine(); |
} |
X11Window::~X11Window() { |
@@ -63,6 +65,50 @@ void X11Window::Destroy() { |
xwindow_ = None; |
} |
+void X11Window::ProcessXInput2Event(XEvent* xev) { |
+ if (!TouchFactory::GetInstance()->ShouldProcessXI2Event(xev)) |
+ return; |
+ EventType event_type = EventTypeFromNative(xev); |
+ switch (event_type) { |
+ case ET_KEY_PRESSED: |
+ case ET_KEY_RELEASED: { |
+ KeyEvent key_event(xev, false); |
+ delegate_->DispatchEvent(&key_event); |
+ break; |
+ } |
+ case ET_MOUSE_PRESSED: |
+ case ET_MOUSE_MOVED: |
+ case ET_MOUSE_DRAGGED: |
+ case ET_MOUSE_RELEASED: { |
+ MouseEvent mouse_event(xev); |
+ delegate_->DispatchEvent(&mouse_event); |
+ break; |
+ } |
+ case ET_MOUSEWHEEL: { |
+ MouseWheelEvent wheel_event(xev); |
+ delegate_->DispatchEvent(&wheel_event); |
+ break; |
+ } |
+ case ET_SCROLL_FLING_START: |
+ case ET_SCROLL_FLING_CANCEL: |
+ case ET_SCROLL: { |
+ ScrollEvent scroll_event(xev); |
+ delegate_->DispatchEvent(&scroll_event); |
+ break; |
+ } |
+ case ET_TOUCH_MOVED: |
+ case ET_TOUCH_PRESSED: |
+ case ET_TOUCH_CANCELLED: |
+ case ET_TOUCH_RELEASED: { |
+ TouchEvent touch_event(xev); |
+ delegate_->DispatchEvent(&touch_event); |
+ break; |
+ } |
+ default: |
+ break; |
+ } |
+} |
+ |
void X11Window::Show() { |
if (window_mapped_) |
return; |
@@ -100,6 +146,11 @@ void X11Window::Show() { |
XISetMask(mask, XI_TouchBegin); |
XISetMask(mask, XI_TouchUpdate); |
XISetMask(mask, XI_TouchEnd); |
+ XISetMask(mask, XI_ButtonPress); |
+ XISetMask(mask, XI_ButtonRelease); |
+ XISetMask(mask, XI_Motion); |
+ XISetMask(mask, XI_KeyPress); |
+ XISetMask(mask, XI_KeyRelease); |
XIEventMask evmask; |
evmask.deviceid = XIAllDevices; |
@@ -292,6 +343,11 @@ uint32_t X11Window::DispatchEvent(const PlatformEvent& event) { |
} |
break; |
} |
+ |
+ case GenericEvent: { |
+ ProcessXInput2Event(xev); |
+ break; |
+ } |
} |
return POST_DISPATCH_STOP_PROPAGATION; |
} |