Index: ui/aura/root_window_host_linux.cc |
diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc |
index a2c4a731a11e4153a0c838c901de236f53c38814..25ef06e266f0da0928480f7cecf7268c693c170e 100644 |
--- a/ui/aura/root_window_host_linux.cc |
+++ b/ui/aura/root_window_host_linux.cc |
@@ -19,6 +19,7 @@ |
#include "ui/aura/root_window.h" |
#include "ui/base/keycodes/keyboard_codes.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/compositor/layer.h" |
@@ -197,7 +198,9 @@ int CoalescePendingXIMotionEvents(const XEvent* xev, XEvent* last_event) { |
} |
if (next_event.type == GenericEvent && |
- next_event.xgeneric.evtype == XI_Motion) { |
+ next_event.xgeneric.evtype == XI_Motion && |
+ !ui::ScrollFactory::GetInstance()->GetScrollOffsets( |
+ next_event, NULL, NULL)) { |
XIDeviceEvent* next_xievent = |
static_cast<XIDeviceEvent*>(next_event.xcookie.data); |
// Confirm that the motion event is targeted at the same window |
@@ -422,17 +425,20 @@ base::MessagePumpDispatcher::DispatchStatus RootWindowHostLinux::Dispatch( |
if (!factory->ShouldProcessXI2Event(xev)) |
break; |
+ // Update the device list if necessary. |
+ if (xev->xgeneric.evtype == XI_HierarchyChanged) { |
+ ui::ScrollFactory::GetInstance()->UpdateDeviceList(xdisplay_); |
+ factory->UpdateDeviceList(xdisplay_); |
+ handled = true; |
+ break; |
+ } |
+ |
+ ui::EventType type = ui::EventTypeFromNative(xev); |
// If this is a motion event we want to coalesce all pending motion |
// events that are at the top of the queue. |
XEvent last_event; |
int num_coalesced = 0; |
- if (xev->xgeneric.evtype == XI_Motion) { |
- num_coalesced = CoalescePendingXIMotionEvents(xev, &last_event); |
- if (num_coalesced > 0) |
- xev = &last_event; |
- } |
- ui::EventType type = ui::EventTypeFromNative(xev); |
switch (type) { |
case ui::ET_TOUCH_PRESSED: |
case ui::ET_TOUCH_RELEASED: |
@@ -441,10 +447,16 @@ base::MessagePumpDispatcher::DispatchStatus RootWindowHostLinux::Dispatch( |
handled = root_window_->DispatchTouchEvent(&touchev); |
break; |
} |
+ case ui::ET_MOUSE_MOVED: |
+ case ui::ET_MOUSE_DRAGGED: { |
+ // If this is a motion event we want to coalesce all pending motion |
+ // events that are at the top of the queue. |
+ num_coalesced = CoalescePendingXIMotionEvents(xev, &last_event); |
+ if (num_coalesced > 0) |
+ xev = &last_event; |
+ } |
case ui::ET_MOUSE_PRESSED: |
case ui::ET_MOUSE_RELEASED: |
- case ui::ET_MOUSE_MOVED: |
- case ui::ET_MOUSE_DRAGGED: |
case ui::ET_MOUSEWHEEL: |
case ui::ET_MOUSE_ENTERED: |
case ui::ET_MOUSE_EXITED: { |
@@ -452,6 +464,11 @@ base::MessagePumpDispatcher::DispatchStatus RootWindowHostLinux::Dispatch( |
handled = root_window_->DispatchMouseEvent(&mouseev); |
break; |
} |
+ case ui::ET_SCROLL: { |
+ ScrollEvent scrollev(xev); |
+ handled = root_window_->DispatchScrollEvent(&scrollev); |
+ break; |
+ } |
case ui::ET_UNKNOWN: |
handled = false; |
break; |