From fb15497e711b3e52428bf8f5e50b901810029f8a Mon Sep 17 00:00:00 2001 From: "davemoore@chromium.org" Date: Tue, 22 Nov 2011 01:35:23 +0000 Subject: Revert 111016 - aura: Re-enable XInput2 events. It turns out that the position information in an event for a slave device reported by X is always slightly behind than the actual position. However, it turns out that the valuators do contain the correct information. So get the event location from the valuator. BUG=103981 TEST=manually Review URL: http://codereview.chromium.org/8568044 TBR=sadrul@chromium.org Review URL: http://codereview.chromium.org/8624010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111072 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/aura/desktop_host_linux.cc | 3 +++ ui/base/x/events_x.cc | 19 ++----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/desktop_host_linux.cc index 46492cf..2de31e6 100644 --- a/ui/aura/desktop_host_linux.cc +++ b/ui/aura/desktop_host_linux.cc @@ -281,8 +281,11 @@ DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds) XSelectInput(xdisplay_, xwindow_, event_mask); XFlush(xdisplay_); + // TODO(sadrul): reenable once 103981 is fixed. +#if defined(TOUCH_UI) if (base::MessagePumpForUI::HasXInput2()) ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_); +#endif } DesktopHostLinux::~DesktopHostLinux() { diff --git a/ui/base/x/events_x.cc b/ui/base/x/events_x.cc index cf2499e..966fec2 100644 --- a/ui/base/x/events_x.cc +++ b/ui/base/x/events_x.cc @@ -248,23 +248,8 @@ gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { case GenericEvent: { XIDeviceEvent* xievent = static_cast(native_event->xcookie.data); - - if (xievent->sourceid == xievent->deviceid) { - // This event is coming from a slave device. Read the position from the - // valuators, because the events reported for a slave device seems to be - // behind the master device by one event. See more on crbug.com/103981. - // The position in the valuators is in the global screen coordinates. - // But it is necessary to convert it into the window's coordinates. - // Prepare to be revolted. - double x = xievent->valuators.values[0] - (xievent->root_x - - xievent->event_x); - double y = xievent->valuators.values[1] - (xievent->root_y - - xievent->event_y); - return gfx::Point(static_cast(x), static_cast(y)); - } else { - return gfx::Point(static_cast(xievent->event_x), - static_cast(xievent->event_y)); - } + return gfx::Point(static_cast(xievent->event_x), + static_cast(xievent->event_y)); } } return gfx::Point(); -- cgit v1.1