diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-12 13:01:10 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-12 13:01:10 +0000 |
commit | 2de9d4a731d60ba3e5b9d07fe2a7c3022e632d43 (patch) | |
tree | cf853dc073aa7bb8f07c0c884cc8fc74039d97c4 /views | |
parent | ac7f3fdb4987d7f44c1612d55437cfcb3eb263f6 (diff) | |
download | chromium_src-2de9d4a731d60ba3e5b9d07fe2a7c3022e632d43.zip chromium_src-2de9d4a731d60ba3e5b9d07fe2a7c3022e632d43.tar.gz chromium_src-2de9d4a731d60ba3e5b9d07fe2a7c3022e632d43.tar.bz2 |
Revert 65938 (arm compile fail) - touchui: First pass at XInput2 message pump.
Capture X events using XInput2.
BUG=None
TEST=None
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=65888
Review URL: http://codereview.chromium.org/4186004
TBR=sadrul@chromium.org
Review URL: http://codereview.chromium.org/4894001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/event_x.cc | 62 | ||||
-rw-r--r-- | views/focus/accelerator_handler_touch.cc | 84 |
2 files changed, 3 insertions, 143 deletions
diff --git a/views/event_x.cc b/views/event_x.cc index 7f6e7b1..69101bb 100644 --- a/views/event_x.cc +++ b/views/event_x.cc @@ -5,9 +5,6 @@ #include "views/event.h" #include <gdk/gdkx.h> -#if defined(HAVE_XINPUT2) -#include <X11/extensions/XInput2.h> -#endif #include "app/keyboard_code_conversion_x.h" #include "views/widget/root_view.h" @@ -35,8 +32,8 @@ int GetEventFlagsFromXState(unsigned int state) { return flags; } -// Get the event flag for the button in XButtonEvent. During a ButtonPress -// event, |state| in XButtonEvent does not include the button that has just been +// Get the event flag for the button in XButtonEvent. During a KeyPress event, +// |state| in XButtonEvent does not include the button that has just been // pressed. Instead |state| contains flags for the buttons (if any) that had // already been pressed before the current button, and |button| stores the most // current pressed button. So, if you press down left mouse button, and while @@ -57,20 +54,6 @@ int GetEventFlagsForButton(int button) { return 0; } -#if defined(HAVE_XINPUT2) -int GetButtonMaskForX2Event(XIDeviceEvent* xievent) { - int buttonflags = 0; - - for (int i = 0; i < 8 * xievent->buttons.mask_len; i++) { - if (XIMaskIsSet(xievent->buttons.mask, i)) { - buttonflags |= GetEventFlagsForButton(i); - } - } - - return buttonflags; -} -#endif // HAVE_XINPUT2 - Event::EventType GetMouseEventType(XEvent* xev) { switch (xev->type) { case ButtonPress: @@ -82,21 +65,6 @@ Event::EventType GetMouseEventType(XEvent* xev) { return Event::ET_MOUSE_DRAGGED; } return Event::ET_MOUSE_MOVED; -#if defined(HAVE_XINPUT2) - case GenericEvent: { - XIDeviceEvent* xievent = - static_cast<XIDeviceEvent*>(xev->xcookie.data); - switch (xievent->evtype) { - case XI_ButtonPress: - return Event::ET_MOUSE_PRESSED; - case XI_ButtonRelease: - return Event::ET_MOUSE_RELEASED; - case XI_Motion: - return GetButtonMaskForX2Event(xievent) ? Event::ET_MOUSE_DRAGGED : - Event::ET_MOUSE_MOVED; - } - } -#endif } return Event::ET_UNKNOWN; @@ -110,15 +78,6 @@ gfx::Point GetMouseEventLocation(XEvent* xev) { case MotionNotify: return gfx::Point(xev->xmotion.x, xev->xmotion.y); - -#if defined(HAVE_XINPUT2) - case GenericEvent: { - XIDeviceEvent* xievent = - static_cast<XIDeviceEvent*>(xev->xcookie.data); - return gfx::Point(static_cast<int>(xievent->event_x), - static_cast<int>(xievent->event_y)); - } -#endif } return gfx::Point(); @@ -133,23 +92,6 @@ int GetMouseEventFlags(XEvent* xev) { case MotionNotify: return GetEventFlagsFromXState(xev->xmotion.state); - -#if defined(HAVE_XINPUT2) - case GenericEvent: { - XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); - switch (xievent->evtype) { - case XI_ButtonPress: - case XI_ButtonRelease: - return GetButtonMaskForX2Event(xievent) | - GetEventFlagsFromXState(xievent->mods.effective) | - GetEventFlagsForButton(xievent->detail); - - case XI_Motion: - return GetButtonMaskForX2Event(xievent) | - GetEventFlagsFromXState(xievent->mods.effective); - } - } -#endif } return 0; diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc index a07b977..9473600 100644 --- a/views/focus/accelerator_handler_touch.cc +++ b/views/focus/accelerator_handler_touch.cc @@ -5,11 +5,7 @@ #include "views/focus/accelerator_handler.h" #include <gtk/gtk.h> -#if defined(HAVE_XINPUT2) -#include <X11/extensions/XInput2.h> -#else #include <X11/Xlib.h> -#endif #include "views/accelerator.h" #include "views/event.h" @@ -38,81 +34,11 @@ RootView* FindRootViewForGdkWindow(GdkWindow* gdk_window) { return widget_gtk->GetRootView(); } -#if defined(HAVE_XINPUT2) -bool X2EventIsTouchEvent(XEvent* xev) { - // TODO(sad): Determine if the captured event is a touch-event. - return false; -} -#endif // HAVE_XINPUT2 - } // namespace -#if defined(HAVE_XINPUT2) -bool DispatchX2Event(RootView* root, XEvent* xev) { - if (X2EventIsTouchEvent(xev)) { - // TODO(sad): Create a TouchEvent, and send it off to |root|. If the event - // is processed by |root|, then return. Otherwise let it fall through so it - // can be used (if desired) as a mouse event. - - // TouchEvent touch(xev); - // if (root->OnTouchEvent(touch)) - // return true; - } - - XGenericEventCookie* cookie = &xev->xcookie; - - switch (cookie->evtype) { - case XI_KeyPress: - case XI_KeyRelease: { - // TODO(sad): We don't capture XInput2 events from keyboard yet. - break; - } - case XI_ButtonPress: - case XI_ButtonRelease: { - MouseEvent mouseev(xev); - if (cookie->evtype == XI_ButtonPress) { - return root->OnMousePressed(mouseev); - } else { - root->OnMouseReleased(mouseev, false); - return true; - } - } - - case XI_Motion: { - MouseEvent mouseev(xev); - if (mouseev.GetType() == Event::ET_MOUSE_DRAGGED) { - return root->OnMouseDragged(mouseev); - } else { - root->OnMouseMoved(mouseev); - return true; - } - break; - } - } - - return false; -} - -#endif // HAVE_XINPUT2 - bool DispatchXEvent(XEvent* xev) { GdkDisplay* gdisp = gdk_display_get_default(); - XID xwindow = xev->xany.window; - -#if defined(HAVE_XINPUT2) - if (xev->type == GenericEvent) { - if (XGetEventData(xev->xgeneric.display, &xev->xcookie)) { - XGenericEventCookie* cookie = &xev->xcookie; - XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(cookie->data); - xwindow = xiev->event; - } else { - DLOG(WARNING) << "Error fetching XGenericEventCookie for event."; - return false; - } - } -#endif - - GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow); + GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xev->xany.window); if (RootView* root = FindRootViewForGdkWindow(gwind)) { switch (xev->type) { @@ -151,14 +77,6 @@ bool DispatchXEvent(XEvent* xev) { return true; } } - -#if defined(HAVE_XINPUT2) - case GenericEvent: { - bool ret = DispatchX2Event(root, xev); - XFreeEventData(xev->xgeneric.display, &xev->xcookie); - return ret; - } -#endif } } |