summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 20:10:58 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 20:10:58 +0000
commit8f89638bcddd0325782e4b3bd1c4eaaf8f6fcc52 (patch)
treef1b9517332de32940111a5d170435bb8f5cda111
parentdf20554d16d08bc8fb5150939485b276efd7f5b5 (diff)
downloadchromium_src-8f89638bcddd0325782e4b3bd1c4eaaf8f6fcc52.zip
chromium_src-8f89638bcddd0325782e4b3bd1c4eaaf8f6fcc52.tar.gz
chromium_src-8f89638bcddd0325782e4b3bd1c4eaaf8f6fcc52.tar.bz2
linux aura: Support touch events.
Update coalescing code to make sure touch-update events are also coalesced. BUG=none R=dongseong.hwang@intel.com, erg@chromium.org Review URL: https://codereview.chromium.org/89413002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238745 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/base/x/x11_util.cc5
-rw-r--r--ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc33
-rw-r--r--ui/views/widget/desktop_aura/desktop_root_window_host_x11.h5
3 files changed, 30 insertions, 13 deletions
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index 6650e31..dfecc6c 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -444,7 +444,7 @@ int CoalescePendingMotionEvents(const XEvent* xev,
XDisplay* display = xev->xany.display;
int event_type = xev->xgeneric.evtype;
- DCHECK_EQ(event_type, XI_Motion);
+ DCHECK(event_type == XI_Motion || event_type == XI_TouchUpdate);
while (XPending(display)) {
XEvent next_event;
@@ -474,6 +474,7 @@ int CoalescePendingMotionEvents(const XEvent* xev,
// and that no buttons or modifiers have changed.
if (xievent->event == next_xievent->event &&
xievent->child == next_xievent->child &&
+ xievent->detail == next_xievent->detail &&
xievent->buttons.mask_len == next_xievent->buttons.mask_len &&
(memcmp(xievent->buttons.mask,
next_xievent->buttons.mask,
@@ -498,7 +499,7 @@ int CoalescePendingMotionEvents(const XEvent* xev,
break;
}
- if (num_coalesced > 0) {
+ if (event_type == XI_Motion && num_coalesced > 0) {
base::TimeDelta delta = ui::EventTimeFromNative(last_event) -
ui::EventTimeFromNative(const_cast<XEvent*>(xev));
UMA_HISTOGRAM_COUNTS_10000("Event.CoalescedCount.Mouse", num_coalesced);
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
index 6efc822..b9087c32 100644
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
@@ -1112,6 +1112,17 @@ void DesktopRootWindowHostX11::DispatchMouseEvent(ui::MouseEvent* event) {
}
}
+void DesktopRootWindowHostX11::DispatchTouchEvent(ui::TouchEvent* event) {
+ if (g_current_capture && g_current_capture != this &&
+ event->type() == ui::ET_TOUCH_PRESSED) {
+ event->ConvertLocationToTarget(root_window_->window(),
+ g_current_capture->root_window_->window());
+ g_current_capture->delegate_->OnHostTouchEvent(event);
+ } else {
+ delegate_->OnHostTouchEvent(event);
+ }
+}
+
void DesktopRootWindowHostX11::ResetWindowRegion() {
if (!IsMaximized()) {
gfx::Path window_mask;
@@ -1277,17 +1288,17 @@ bool DesktopRootWindowHostX11::Dispatch(const base::NativeEvent& event) {
int num_coalesced = 0;
switch (type) {
- // case ui::ET_TOUCH_MOVED:
- // num_coalesced = CoalescePendingMotionEvents(xev, &last_event);
- // if (num_coalesced > 0)
- // xev = &last_event;
- // // fallthrough
- // case ui::ET_TOUCH_PRESSED:
- // case ui::ET_TOUCH_RELEASED: {
- // ui::TouchEvent touchev(xev);
- // delegate_->OnHostTouchEvent(&touchev);
- // break;
- // }
+ case ui::ET_TOUCH_MOVED:
+ num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event);
+ if (num_coalesced > 0)
+ xev = &last_event;
+ // fallthrough
+ case ui::ET_TOUCH_PRESSED:
+ case ui::ET_TOUCH_RELEASED: {
+ ui::TouchEvent touchev(xev);
+ DispatchTouchEvent(&touchev);
+ break;
+ }
case ui::ET_MOUSE_MOVED:
case ui::ET_MOUSE_DRAGGED:
case ui::ET_MOUSE_PRESSED:
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h
index a9e2db4..ee24b74 100644
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h
@@ -180,6 +180,11 @@ private:
// and dispatch it to that host instead.
void DispatchMouseEvent(ui::MouseEvent* event);
+ // Dispatches a touch event, taking capture into account. If a different host
+ // has capture, then touch-press events are translated to its coordinate space
+ // and dispatched to that host instead.
+ void DispatchTouchEvent(ui::TouchEvent* event);
+
// Resets the window region for the current widget bounds if necessary.
void ResetWindowRegion();