diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-14 21:52:52 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-14 21:52:52 +0000 |
commit | d280ab686b2dbfe743bbaa7d39e9d2f03af82e31 (patch) | |
tree | 29033f8a3ed27e7550efe1c6708558f437b6eece /ui | |
parent | 133340cf3417b015205ce0f8297adb5e9a698e10 (diff) | |
download | chromium_src-d280ab686b2dbfe743bbaa7d39e9d2f03af82e31.zip chromium_src-d280ab686b2dbfe743bbaa7d39e9d2f03af82e31.tar.gz chromium_src-d280ab686b2dbfe743bbaa7d39e9d2f03af82e31.tar.bz2 |
Throw away motion events if we can't keep up
BUG=100226
TEST=None
Review URL: http://codereview.chromium.org/8301009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105588 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/desktop_host_linux.cc | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/desktop_host_linux.cc index 65cee8b..06030b7 100644 --- a/ui/aura/desktop_host_linux.cc +++ b/ui/aura/desktop_host_linux.cc @@ -88,13 +88,32 @@ base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch( break; } case ButtonPress: - case ButtonRelease: + case ButtonRelease: { + MouseEvent mouseev(xev); + handled = desktop_->OnMouseEvent(mouseev); + break; + } case MotionNotify: { + // Discard all but the most recent motion event that targets the same + // window with unchanged state. + XEvent last_event; + while (XPending(xev->xany.display)) { + XEvent next_event; + XPeekEvent(xev->xany.display, &next_event); + if (next_event.type == MotionNotify && + next_event.xmotion.window == xev->xmotion.window && + next_event.xmotion.subwindow == xev->xmotion.subwindow && + next_event.xmotion.state == xev->xmotion.state) { + XNextEvent(xev->xany.display, &last_event); + xev = &last_event; + } else { + break; + } + } MouseEvent mouseev(xev); handled = desktop_->OnMouseEvent(mouseev); break; } - case ConfigureNotify: { DCHECK_EQ(xdisplay_, xev->xconfigure.display); DCHECK_EQ(xwindow_, xev->xconfigure.window); |