| Index: views/controls/native_control_gtk.cc
|
| diff --git a/views/controls/native_control_gtk.cc b/views/controls/native_control_gtk.cc
|
| index 52b2d45c675b6e051e92ae7d572ff5ea0b02a02b..24410f4a70492102c88f1e9c089b9c3374460712 100644
|
| --- a/views/controls/native_control_gtk.cc
|
| +++ b/views/controls/native_control_gtk.cc
|
| @@ -11,135 +11,8 @@
|
| #include "ui/views/focus/focus_manager.h"
|
| #include "ui/views/widget/widget.h"
|
|
|
| -#if defined(TOUCH_UI)
|
| -namespace {
|
| -
|
| -GdkEvent* MouseButtonEvent(const views::MouseEvent& mouseev,
|
| - const views::NativeViewHost* source) {
|
| - GdkEvent* event = NULL;
|
| - switch (mouseev.type()) {
|
| - case ui::ET_MOUSE_PRESSED:
|
| - event = gdk_event_new(GDK_BUTTON_PRESS);
|
| - break;
|
| - case ui::ET_MOUSE_RELEASED:
|
| - event = gdk_event_new(GDK_BUTTON_RELEASE);
|
| - break;
|
| - default:
|
| - NOTREACHED();
|
| - return NULL;
|
| - }
|
| - event->button.send_event = false;
|
| - event->button.time = GDK_CURRENT_TIME;
|
| -
|
| - // Ideally using native_view()->window should work, but it doesn't.
|
| - event->button.window = gdk_window_at_pointer(NULL, NULL);
|
| - g_object_ref(event->button.window);
|
| - event->button.x = mouseev.location().x();
|
| - event->button.y = mouseev.location().y();
|
| -
|
| - gfx::Point point = mouseev.location();
|
| - views::View::ConvertPointToScreen(source, &point);
|
| - event->button.x_root = point.x();
|
| - event->button.y_root = point.y();
|
| -
|
| - event->button.axes = NULL;
|
| -
|
| - // Ideally, this should reconstruct the state from mouseev.flags().
|
| - GdkModifierType modifier;
|
| - gdk_window_get_pointer(event->button.window, NULL, NULL, &modifier);
|
| - event->button.state = modifier;
|
| -
|
| - event->button.button = (mouseev.flags() & ui::EF_LEFT_BUTTON_DOWN) ? 1 :
|
| - (mouseev.flags() & ui::EF_RIGHT_BUTTON_DOWN) ? 3 :
|
| - 2;
|
| - event->button.device = gdk_device_get_core_pointer();
|
| - return event;
|
| -}
|
| -
|
| -GdkEvent* MouseMoveEvent(const views::MouseEvent& mouseev,
|
| - const views::NativeViewHost* source) {
|
| - GdkEvent* event = gdk_event_new(GDK_MOTION_NOTIFY);
|
| - event->motion.send_event = false;
|
| - event->motion.time = GDK_CURRENT_TIME;
|
| -
|
| - event->motion.window = source->native_view()->window;
|
| - g_object_ref(event->motion.window);
|
| - event->motion.x = mouseev.location().x();
|
| - event->motion.y = mouseev.location().y();
|
| -
|
| - gfx::Point point = mouseev.location();
|
| - views::View::ConvertPointToScreen(source, &point);
|
| - event->motion.x_root = point.x();
|
| - event->motion.y_root = point.y();
|
| -
|
| - event->motion.device = gdk_device_get_core_pointer();
|
| - return event;
|
| -}
|
| -
|
| -GdkEvent* MouseCrossEvent(const views::MouseEvent& mouseev,
|
| - const views::NativeViewHost* source) {
|
| - GdkEvent* event = NULL;
|
| - switch (mouseev.type()) {
|
| - case ui::ET_MOUSE_ENTERED:
|
| - event = gdk_event_new(GDK_ENTER_NOTIFY);
|
| - break;
|
| - case ui::ET_MOUSE_EXITED:
|
| - event = gdk_event_new(GDK_LEAVE_NOTIFY);
|
| - break;
|
| - default:
|
| - NOTREACHED();
|
| - return NULL;
|
| - }
|
| - event->crossing.send_event = false;
|
| - event->crossing.time = GDK_CURRENT_TIME;
|
| -
|
| - event->crossing.window = source->native_view()->window;
|
| - g_object_ref(event->crossing.window);
|
| -
|
| - event->crossing.x = event->crossing.y = 0;
|
| - event->crossing.x_root = event->crossing.y_root = 0;
|
| - event->crossing.mode = GDK_CROSSING_NORMAL;
|
| - event->crossing.detail = GDK_NOTIFY_VIRTUAL;
|
| - event->crossing.focus = false;
|
| - event->crossing.state = 0;
|
| -
|
| - return event;
|
| -}
|
| -
|
| -} // namespace
|
| -#endif // defined(TOUCH_UI)
|
| -
|
| namespace views {
|
|
|
| -#if defined(TOUCH_UI)
|
| -void NativeControlGtk::FakeNativeMouseEvent(const MouseEvent& mouseev) {
|
| - GdkEvent* event = NULL;
|
| - switch (mouseev.type()) {
|
| - case ui::ET_MOUSE_PRESSED:
|
| - case ui::ET_MOUSE_RELEASED:
|
| - event = MouseButtonEvent(mouseev, this);
|
| - break;
|
| - case ui::ET_MOUSE_MOVED:
|
| - event = MouseMoveEvent(mouseev, this);
|
| - break;
|
| - case ui::ET_MOUSE_ENTERED:
|
| - case ui::ET_MOUSE_EXITED:
|
| - event = MouseCrossEvent(mouseev, this);
|
| - break;
|
| - default:
|
| - NOTREACHED();
|
| - return;
|
| - }
|
| -
|
| - if (event) {
|
| - // Do not gdk_event_put, since that will end up going through the
|
| - // message-loop and turn into an infinite loop.
|
| - gtk_widget_event(native_view(), event);
|
| - gdk_event_free(event);
|
| - }
|
| -}
|
| -#endif // defined(TOUCH_UI)
|
| -
|
| NativeControlGtk::NativeControlGtk() {
|
| }
|
|
|
| @@ -189,29 +62,6 @@ void NativeControlGtk::OnFocus() {
|
| parent(), ui::AccessibilityTypes::EVENT_FOCUS, true);
|
| }
|
|
|
| -#if defined(TOUCH_UI)
|
| -bool NativeControlGtk::OnMousePressed(const MouseEvent& mouseev) {
|
| - FakeNativeMouseEvent(mouseev);
|
| - return true;
|
| -}
|
| -
|
| -void NativeControlGtk::OnMouseReleased(const MouseEvent& mouseev) {
|
| - FakeNativeMouseEvent(mouseev);
|
| -}
|
| -
|
| -void NativeControlGtk::OnMouseMoved(const MouseEvent& mouseev) {
|
| - FakeNativeMouseEvent(mouseev);
|
| -}
|
| -
|
| -void NativeControlGtk::OnMouseEntered(const MouseEvent& mouseev) {
|
| - FakeNativeMouseEvent(mouseev);
|
| -}
|
| -
|
| -void NativeControlGtk::OnMouseExited(const MouseEvent& mouseev) {
|
| - FakeNativeMouseEvent(mouseev);
|
| -}
|
| -#endif // defined(TOUCH_UI)
|
| -
|
| void NativeControlGtk::NativeControlCreated(GtkWidget* native_control) {
|
| Attach(native_control);
|
|
|
|
|