diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 18:42:38 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 18:42:38 +0000 |
commit | 6b031fded2df8357b804f08fe84503b5b1adbb8d (patch) | |
tree | d7a8ececabab8a0643d18354a96f90d9bf146eba /views | |
parent | bc04b24f04d8afd339c24d9f214481377de2aa56 (diff) | |
download | chromium_src-6b031fded2df8357b804f08fe84503b5b1adbb8d.zip chromium_src-6b031fded2df8357b804f08fe84503b5b1adbb8d.tar.gz chromium_src-6b031fded2df8357b804f08fe84503b5b1adbb8d.tar.bz2 |
Fix mouse-wheel scrolling and shifted/capslocked keyevents for touchui.
BUG=None
TEST=Mouse wheel should work in a webpage, and shift+a should show up as 'A' in a textfield. Caps-lock should also work.
Review URL: http://codereview.chromium.org/4341001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66977 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/event.h | 4 | ||||
-rw-r--r-- | views/event_x.cc | 10 | ||||
-rw-r--r-- | views/focus/accelerator_handler_touch.cc | 18 |
3 files changed, 26 insertions, 6 deletions
diff --git a/views/event.h b/views/event.h index 89909b5..ab9abf3 100644 --- a/views/event.h +++ b/views/event.h @@ -381,6 +381,10 @@ class MouseWheelEvent : public LocatedEvent { offset_(offset) { } +#if defined(TOUCH_UI) + explicit MouseWheelEvent(XEvent* xev); +#endif + int GetOffset() const { return offset_; } diff --git a/views/event_x.cc b/views/event_x.cc index 7f6e7b1..60b0d2f 100644 --- a/views/event_x.cc +++ b/views/event_x.cc @@ -25,6 +25,8 @@ int GetEventFlagsFromXState(unsigned int state) { flags |= Event::EF_SHIFT_DOWN; if (state & Mod1Mask) flags |= Event::EF_ALT_DOWN; + if (state & LockMask) + flags |= Event::EF_CAPS_LOCK_DOWN; if (state & Button1Mask) flags |= Event::EF_LEFT_BUTTON_DOWN; if (state & Button2Mask) @@ -172,4 +174,12 @@ MouseEvent::MouseEvent(XEvent* xev) GetMouseEventFlags(xev)) { } +MouseWheelEvent::MouseWheelEvent(XEvent* xev) + : LocatedEvent(Event::ET_MOUSEWHEEL, + GetMouseEventLocation(xev), + GetEventFlagsFromXState(xev->xbutton.state)), + offset_(xev->xbutton.button == 4 ? 53 : -53) { // '53' is also the value + // used for GTK+. +} + } // namespace views diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc index a07b977..aa971d5 100644 --- a/views/focus/accelerator_handler_touch.cc +++ b/views/focus/accelerator_handler_touch.cc @@ -132,13 +132,19 @@ bool DispatchXEvent(XEvent* xev) { case ButtonPress: case ButtonRelease: { - MouseEvent mouseev(xev); - if (xev->type == ButtonPress) { - return root->OnMousePressed(mouseev); + if (xev->xbutton.button == 4 || xev->xbutton.button == 5) { + // Scrolling the wheel triggers button press/release events. + MouseWheelEvent wheelev(xev); + return root->ProcessMouseWheelEvent(wheelev); } else { - root->OnMouseReleased(mouseev, false); - return true; // Assume the event has been processed to make sure we - // don't process it twice. + MouseEvent mouseev(xev); + if (xev->type == ButtonPress) { + return root->OnMousePressed(mouseev); + } else { + root->OnMouseReleased(mouseev, false); + return true; // Assume the event has been processed to make sure we + // don't process it twice. + } } } |