Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: views/focus/accelerator_handler_touch.cc

Issue 7942004: Consolidate/cleanup event cracking code; single out GdkEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix GdkEvent init, NativeWidgetGtk casting, and Get[Unmodified]Character checks. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: views/focus/accelerator_handler_touch.cc
diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc
index c76e8badbe38773b3d2fd21bf235ddc388c381af..ac2c35aa8d5ac5668fb5dce0d5dfb9560f46a9b8 100644
--- a/views/focus/accelerator_handler_touch.cc
+++ b/views/focus/accelerator_handler_touch.cc
@@ -8,11 +8,11 @@
#include <gtk/gtk.h>
#include <X11/extensions/XInput2.h>
+#include "ui/base/touchui/touch_factory.h"
#include "views/accelerator.h"
#include "views/events/event.h"
#include "views/focus/focus_manager.h"
#include "views/ime/input_method.h"
-#include "views/touchui/touch_factory.h"
#include "views/view.h"
#include "views/widget/native_widget.h"
@@ -51,19 +51,18 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) {
case XI_ButtonRelease:
case XI_Motion: {
XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data);
- Event::FromNativeEvent2 from_native;
// Scrolling the wheel generates press/release events with button id's 4
// and 5. In case of a wheelscroll, we do not want to show the cursor.
if (xievent->detail == 4 || xievent->detail == 5) {
- MouseWheelEvent wheelev(xev, from_native);
+ MouseWheelEvent wheelev(xev);
return widget->OnMouseEvent(wheelev);
}
// Is the event coming from a touch device?
- if (TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid)) {
+ if (ui::TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid)) {
// Hide the cursor when a touch event comes in.
- TouchFactory::GetInstance()->SetCursorVisible(false, false);
+ ui::TouchFactory::GetInstance()->SetCursorVisible(false, false);
// With XInput 2.0, XI_ButtonPress and XI_ButtonRelease events are
// ignored, as XI_Motion events contain enough data to detect finger
@@ -74,7 +73,7 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) {
// If the TouchEvent is processed by |root|, then return. Otherwise let
// it fall through so it can be used as a MouseEvent, if desired.
- TouchEvent touch(xev, from_native);
+ TouchEvent touch(xev);
if (widget->OnTouchEvent(touch) != ui::TOUCH_STATUS_UNKNOWN)
return true;
@@ -83,7 +82,7 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) {
// RootView::OnTouchEvent.
return false;
} else {
- MouseEvent mouseev(xev, from_native);
+ MouseEvent mouseev(xev);
// Show the cursor. Start a timer to hide the cursor after a delay on
// move (not drag) events, or if the only button pressed is released.
@@ -92,7 +91,7 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) {
(mouseev.IsOnlyLeftMouseButton() ||
mouseev.IsOnlyMiddleMouseButton() ||
mouseev.IsOnlyRightMouseButton());
- TouchFactory::GetInstance()->SetCursorVisible(true, start_timer);
+ ui::TouchFactory::GetInstance()->SetCursorVisible(true, start_timer);
return widget->OnMouseEvent(mouseev);
}
@@ -106,12 +105,12 @@ bool DispatchXEvent(XEvent* xev) {
XID xwindow = xev->xany.window;
if (xev->type == GenericEvent) {
- if (!TouchFactory::GetInstance()->ShouldProcessXI2Event(xev))
+ if (!ui::TouchFactory::GetInstance()->ShouldProcessXI2Event(xev))
return true; // Consume the event.
XGenericEventCookie* cookie = &xev->xcookie;
if (cookie->evtype == XI_HierarchyChanged) {
- TouchFactory::GetInstance()->UpdateDeviceList(cookie->display);
+ ui::TouchFactory::GetInstance()->UpdateDeviceList(cookie->display);
return true;
}
@@ -122,11 +121,10 @@ bool DispatchXEvent(XEvent* xev) {
GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow);
Widget* widget = FindWidgetForGdkWindow(gwind);
if (widget) {
- Event::FromNativeEvent2 from_native;
switch (xev->type) {
case KeyPress:
case KeyRelease: {
- KeyEvent keyev(xev, from_native);
+ KeyEvent keyev(xev);
InputMethod* ime = widget->GetInputMethod();
// Always dispatch key events to the input method first, to make sure
// that the input method's hotkeys work all time.
@@ -140,12 +138,12 @@ bool DispatchXEvent(XEvent* xev) {
case ButtonRelease:
if (xev->xbutton.button == 4 || xev->xbutton.button == 5) {
// Scrolling the wheel triggers button press/release events.
- MouseWheelEvent wheelev(xev, from_native);
+ MouseWheelEvent wheelev(xev);
return widget->OnMouseEvent(wheelev);
}
// fallthrough
case MotionNotify: {
- MouseEvent mouseev(xev, from_native);
+ MouseEvent mouseev(xev);
return widget->OnMouseEvent(mouseev);
}
@@ -159,7 +157,7 @@ bool DispatchXEvent(XEvent* xev) {
}
void SetTouchDeviceList(std::vector<unsigned int>& devices) {
- TouchFactory::GetInstance()->SetTouchDeviceList(devices);
+ ui::TouchFactory::GetInstance()->SetTouchDeviceList(devices);
}
AcceleratorHandler::AcceleratorHandler() {}

Powered by Google App Engine
This is Rietveld 408576698