summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/base.gypi1
-rw-r--r--base/event_types.h13
-rw-r--r--base/message_pump_wayland.cc2
-rw-r--r--base/message_pump_wayland.h12
-rw-r--r--base/wayland/wayland_event.h (renamed from ui/wayland/events/wayland_event.h)24
-rw-r--r--ui/base/wayland/events_wayland.cc22
-rw-r--r--ui/wayland/wayland.gyp1
-rw-r--r--ui/wayland/wayland_input_device.cc4
-rw-r--r--ui/wayland/wayland_widget.h18
-rw-r--r--ui/wayland/wayland_window.cc4
-rw-r--r--views/controls/menu/menu_controller.cc2
-rw-r--r--views/controls/menu/menu_controller.h2
-rw-r--r--views/focus/accelerator_handler.h2
-rw-r--r--views/focus/accelerator_handler_wayland.cc2
-rw-r--r--views/mouse_watcher.cc11
-rw-r--r--views/widget/native_widget_wayland.cc16
-rw-r--r--views/widget/native_widget_wayland.h18
-rw-r--r--views/widget/tooltip_manager_views.cc5
-rw-r--r--views/widget/tooltip_manager_views.h3
19 files changed, 87 insertions, 75 deletions
diff --git a/base/base.gypi b/base/base.gypi
index e1877c9..c8a21e9 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -362,6 +362,7 @@
'nix/mime_util_xdg.h',
'nix/xdg_util.cc',
'nix/xdg_util.h',
+ 'wayland/wayland_event.h',
'win/event_trace_consumer.h',
'win/event_trace_controller.cc',
'win/event_trace_controller.h',
diff --git a/base/event_types.h b/base/event_types.h
index 092ec7f..f916234 100644
--- a/base/event_types.h
+++ b/base/event_types.h
@@ -10,9 +10,9 @@
#if defined(OS_WIN)
#include <windows.h>
-#endif
-
-#if defined(USE_X11)
+#elif defined(USE_WAYLAND)
+#include "base/wayland/wayland_event.h"
+#elif defined(USE_X11)
typedef union _XEvent XEvent;
#endif
@@ -21,13 +21,10 @@ namespace base {
// Cross platform typedefs for native event types.
#if defined(OS_WIN)
typedef MSG NativeEvent;
+#elif defined(USE_WAYLAND)
+typedef wayland::WaylandEvent* NativeEvent;
#elif defined(USE_X11)
typedef XEvent* NativeEvent;
-#elif defined(USE_WAYLAND)
-// WaylandEvent is currently defined in ui component and cannot be
-// used in base component. Probably wayland maintainer has to move it
-// outside of ui in order to define NativeEvent for wayland here.
-typedef void* NativeEvent;
#else
typedef void* NativeEvent;
#endif
diff --git a/base/message_pump_wayland.cc b/base/message_pump_wayland.cc
index a666ce6..ab60a76 100644
--- a/base/message_pump_wayland.cc
+++ b/base/message_pump_wayland.cc
@@ -22,7 +22,7 @@ bool MessagePumpWayland::RunOnce(GMainContext* context, bool block) {
}
MessagePumpObserver::EventStatus
- MessagePumpObserver::WillProcessEvent(ui::WaylandEvent* event) {
+ MessagePumpObserver::WillProcessEvent(wayland::WaylandEvent* event) {
return EVENT_CONTINUE;
}
diff --git a/base/message_pump_wayland.h b/base/message_pump_wayland.h
index 86b22a2..8734c7a 100644
--- a/base/message_pump_wayland.h
+++ b/base/message_pump_wayland.h
@@ -13,12 +13,12 @@ typedef struct _GMainContext GMainContext;
typedef struct _GPollFD GPollFD;
typedef struct _GSource GSource;
-namespace ui {
-union WaylandEvent;
-} // namespace ui
-
namespace base {
+namespace wayland {
+union WaylandEvent;
+}
+
// The documentation for this class is in message_pump_glib.h
class BASE_EXPORT MessagePumpObserver {
public:
@@ -31,7 +31,7 @@ class BASE_EXPORT MessagePumpObserver {
// EVENT_HANDLED, it indicates the event has already been handled, so the
// event is not processed any farther. If the method returns EVENT_CONTINUE,
// the event dispatching proceeds as normal.
- virtual EventStatus WillProcessEvent(ui::WaylandEvent* event);
+ virtual EventStatus WillProcessEvent(wayland::WaylandEvent* event);
protected:
virtual ~MessagePumpObserver() {}
@@ -52,7 +52,7 @@ class MessagePumpDispatcher {
// Dispatches the event. If true is returned processing continues as
// normal. If false is returned, the nested loop exits immediately.
- virtual DispatchStatus Dispatch(ui::WaylandEvent* event) = 0;
+ virtual DispatchStatus Dispatch(wayland::WaylandEvent* event) = 0;
protected:
virtual ~MessagePumpDispatcher() {}
diff --git a/ui/wayland/events/wayland_event.h b/base/wayland/wayland_event.h
index 0c20361..1d6808d 100644
--- a/ui/wayland/events/wayland_event.h
+++ b/base/wayland/wayland_event.h
@@ -2,10 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_
-#define UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_
+#ifndef BASE_WAYLAND_WAYLAND_EVENT_H_
+#define BASE_WAYLAND_WAYLAND_EVENT_H_
-#include <linux/input.h>
#include <stdint.h>
// Wayland event information is being passed in as arguments to the callbacks.
@@ -26,7 +25,8 @@
// Stores all the keyboard modifiers (Ctrl, Alt, Shift, ...) currently
// active. The modifiers are values as defined by xkbcommon.
-namespace ui {
+namespace base {
+namespace wayland {
// Types of events Wayland will send
enum WaylandEventType {
@@ -38,17 +38,6 @@ enum WaylandEventType {
WAYLAND_GEOMETRY_CHANGE,
};
-// These are the mouse events expected. The event type Wayland sends is an
-// evdev event. The following is the correct mapping from evdev to expected
-// events type.
-enum WaylandEventButtonType {
- LEFT_BUTTON = BTN_LEFT,
- MIDDLE_BUTTON = BTN_RIGHT,
- RIGHT_BUTTON = BTN_MIDDLE,
- SCROLL_UP = BTN_SIDE,
- SCROLL_DOWN = BTN_EXTRA,
-};
-
struct WaylandEventButton {
WaylandEventType type;
uint32_t time;
@@ -122,6 +111,7 @@ union WaylandEvent {
WaylandEventGeometryChange geometry_change;
};
-} // namespace ui
+} // namespace wayland
+} // namespace base
-#endif // UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_
+#endif // BASE_WAYLAND_WAYLAND_EVENT_H_
diff --git a/ui/base/wayland/events_wayland.cc b/ui/base/wayland/events_wayland.cc
index df6ffac..a52a93b 100644
--- a/ui/base/wayland/events_wayland.cc
+++ b/ui/base/wayland/events_wayland.cc
@@ -4,13 +4,31 @@
#include "ui/base/events.h"
+#include <linux/input.h>
#include <X11/extensions/XInput2.h>
+#include "base/event_types.h"
#include "base/logging.h"
#include "ui/base/keycodes/keyboard_code_conversion_x.h"
-#include "ui/wayland/events/wayland_event.h"
#include "ui/gfx/point.h"
+using namespace base::wayland;
+
+namespace ui {
+
+// These are the mouse events expected. The event type Wayland sends is an
+// evdev event. The following is the correct mapping from evdev to expected
+// events type.
+enum WaylandEventButtonType {
+ LEFT_BUTTON = BTN_LEFT,
+ MIDDLE_BUTTON = BTN_RIGHT,
+ RIGHT_BUTTON = BTN_MIDDLE,
+ SCROLL_UP = BTN_SIDE,
+ SCROLL_DOWN = BTN_EXTRA,
+};
+
+} // namespace ui
+
namespace {
// Scroll amount for each wheelscroll event. 53 is also the value used for GTK+.
@@ -126,7 +144,7 @@ bool IsMouseEvent(const base::NativeEvent& native_event) {
}
int GetMouseWheelOffset(const base::NativeEvent& native_event) {
- return native_event->button.button == ui::SCROLL_UP ?
+ return native_event->button.button == SCROLL_UP ?
kWheelScrollAmount : -kWheelScrollAmount;
}
diff --git a/ui/wayland/wayland.gyp b/ui/wayland/wayland.gyp
index 72e456e..3953e2c 100644
--- a/ui/wayland/wayland.gyp
+++ b/ui/wayland/wayland.gyp
@@ -18,7 +18,6 @@
'events',
],
'sources': [
- 'events/wayland_event.h',
'wayland_buffer.cc',
'wayland_buffer.h',
'wayland_cursor.cc',
diff --git a/ui/wayland/wayland_input_device.cc b/ui/wayland/wayland_input_device.cc
index 100e19d..034b4a1 100644
--- a/ui/wayland/wayland_input_device.cc
+++ b/ui/wayland/wayland_input_device.cc
@@ -7,10 +7,12 @@
#include <X11/extensions/XKBcommon.h>
#include <wayland-client.h>
-#include "ui/wayland/events/wayland_event.h"
+#include "base/wayland/wayland_event.h"
#include "ui/wayland/wayland_widget.h"
#include "ui/wayland/wayland_window.h"
+using namespace base::wayland;
+
namespace ui {
WaylandInputDevice::WaylandInputDevice(
diff --git a/ui/wayland/wayland_widget.h b/ui/wayland/wayland_widget.h
index f274141..1c4e40d 100644
--- a/ui/wayland/wayland_widget.h
+++ b/ui/wayland/wayland_widget.h
@@ -5,7 +5,11 @@
#ifndef UI_WAYLAND_WAYLAND_WIDGET_H_
#define UI_WAYLAND_WAYLAND_WIDGET_H_
-#include "ui/wayland/events/wayland_event.h"
+namespace base {
+namespace wayland {
+union WaylandEvent;
+}
+}
namespace ui {
@@ -14,13 +18,13 @@ class WaylandWidget {
public:
virtual ~WaylandWidget() {}
- virtual void OnMotionNotify(WaylandEvent event) = 0;
- virtual void OnButtonNotify(WaylandEvent event) = 0;
- virtual void OnKeyNotify(WaylandEvent event) = 0;
- virtual void OnPointerFocus(WaylandEvent event) = 0;
- virtual void OnKeyboardFocus(WaylandEvent event) = 0;
+ virtual void OnMotionNotify(base::wayland::WaylandEvent event) = 0;
+ virtual void OnButtonNotify(base::wayland::WaylandEvent event) = 0;
+ virtual void OnKeyNotify(base::wayland::WaylandEvent event) = 0;
+ virtual void OnPointerFocus(base::wayland::WaylandEvent event) = 0;
+ virtual void OnKeyboardFocus(base::wayland::WaylandEvent event) = 0;
- virtual void OnGeometryChange(WaylandEvent event) = 0;
+ virtual void OnGeometryChange(base::wayland::WaylandEvent event) = 0;
};
} // namespace ui
diff --git a/ui/wayland/wayland_window.cc b/ui/wayland/wayland_window.cc
index 7199494..cd84a45 100644
--- a/ui/wayland/wayland_window.cc
+++ b/ui/wayland/wayland_window.cc
@@ -6,10 +6,12 @@
#include <wayland-egl.h>
-#include "ui/wayland/events/wayland_event.h"
+#include "base/wayland/wayland_event.h"
#include "ui/wayland/wayland_display.h"
#include "ui/wayland/wayland_widget.h"
+using base::wayland::WaylandEvent;
+
namespace ui {
WaylandWindow::WaylandWindow(WaylandWidget* widget, WaylandDisplay* display)
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc
index 0983299..84433b5 100644
--- a/views/controls/menu/menu_controller.cc
+++ b/views/controls/menu/menu_controller.cc
@@ -880,7 +880,7 @@ bool MenuController::Dispatch(const MSG& msg) {
}
#elif defined(USE_WAYLAND)
base::MessagePumpDispatcher::DispatchStatus
- MenuController::Dispatch(ui::WaylandEvent* ev) {
+ MenuController::Dispatch(base::wayland::WaylandEvent* ev) {
return exit_type_ != EXIT_NONE ?
base::MessagePumpDispatcher::EVENT_QUIT :
base::MessagePumpDispatcher::EVENT_PROCESSED;
diff --git a/views/controls/menu/menu_controller.h b/views/controls/menu/menu_controller.h
index 9ca806d..63efbab 100644
--- a/views/controls/menu/menu_controller.h
+++ b/views/controls/menu/menu_controller.h
@@ -222,7 +222,7 @@ class VIEWS_EXPORT MenuController : public MessageLoop::Dispatcher {
virtual bool Dispatch(const MSG& msg);
#elif defined(USE_WAYLAND)
virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(
- ui::WaylandEvent* event);
+ base::wayland::WaylandEvent* event);
#elif defined(TOUCH_UI) || defined(USE_AURA)
virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xevent);
#else
diff --git a/views/focus/accelerator_handler.h b/views/focus/accelerator_handler.h
index f4c969c..71f8688 100644
--- a/views/focus/accelerator_handler.h
+++ b/views/focus/accelerator_handler.h
@@ -40,7 +40,7 @@ class VIEWS_EXPORT AcceleratorHandler : public MessageLoop::Dispatcher {
virtual bool Dispatch(const MSG& msg);
#elif defined(USE_WAYLAND)
virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(
- ui::WaylandEvent* ev);
+ base::wayland::WaylandEvent* ev);
#elif defined(TOUCH_UI) || defined(USE_AURA)
virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xev);
#else
diff --git a/views/focus/accelerator_handler_wayland.cc b/views/focus/accelerator_handler_wayland.cc
index 6a88b03..a8963ee 100644
--- a/views/focus/accelerator_handler_wayland.cc
+++ b/views/focus/accelerator_handler_wayland.cc
@@ -11,7 +11,7 @@ namespace views {
AcceleratorHandler::AcceleratorHandler() {}
base::MessagePumpDispatcher::DispatchStatus
- AcceleratorHandler::Dispatch(ui::WaylandEvent* ev) {
+ AcceleratorHandler::Dispatch(base::wayland::WaylandEvent* ev) {
return base::MessagePumpDispatcher::EVENT_IGNORED;
}
diff --git a/views/mouse_watcher.cc b/views/mouse_watcher.cc
index 02e1cc0..b88e85f 100644
--- a/views/mouse_watcher.cc
+++ b/views/mouse_watcher.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
+#include "base/event_types.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "ui/base/events.h"
@@ -13,10 +14,6 @@
#include "views/view.h"
#include "views/widget/widget.h"
-#if defined(USE_WAYLAND)
-#include "ui/wayland/events/wayland_event.h"
-#endif
-
namespace views {
// Amount of time between when the mouse moves outside the view's zone and when
@@ -66,12 +63,12 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
}
#elif defined(USE_WAYLAND)
virtual MessageLoopForUI::Observer::EventStatus WillProcessEvent(
- ui::WaylandEvent* event) OVERRIDE {
+ base::wayland::WaylandEvent* event) OVERRIDE {
switch (event->type) {
- case ui::WAYLAND_MOTION:
+ case base::wayland::WAYLAND_MOTION:
HandleGlobalMouseMoveEvent(false);
break;
- case ui::WAYLAND_POINTER_FOCUS:
+ case base::wayland::WAYLAND_POINTER_FOCUS:
if (!event->pointer_focus.state)
HandleGlobalMouseMoveEvent(true);
break;
diff --git a/views/widget/native_widget_wayland.cc b/views/widget/native_widget_wayland.cc
index 2be625a..cae95f7 100644
--- a/views/widget/native_widget_wayland.cc
+++ b/views/widget/native_widget_wayland.cc
@@ -15,12 +15,12 @@
#include "base/bind.h"
#include "base/memory/scoped_ptr.h"
+#include "base/wayland/wayland_event.h"
#include "ui/base/view_prop.h"
#include "ui/gfx/canvas_skia_paint.h"
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/gl/gl_surface.h"
#include "ui/gfx/gl/gl_surface_egl.h"
-#include "ui/wayland/events/wayland_event.h"
#include "ui/wayland/wayland_display.h"
#include "ui/wayland/wayland_input_device.h"
#include "ui/wayland/wayland_screen.h"
@@ -33,6 +33,8 @@
using ui::ViewProp;
+using base::wayland::WaylandEvent;
+
namespace views {
namespace {
@@ -549,12 +551,12 @@ void NativeWidgetWayland::OnPaint(gfx::Rect damage_area) {
}
}
-void NativeWidgetWayland::OnMotionNotify(ui::WaylandEvent event) {
+void NativeWidgetWayland::OnMotionNotify(WaylandEvent event) {
MouseEvent mouse_event(&event);
delegate_->OnMouseEvent(mouse_event);
}
-void NativeWidgetWayland::OnButtonNotify(ui::WaylandEvent event) {
+void NativeWidgetWayland::OnButtonNotify(WaylandEvent event) {
if (event.button.button == ui::SCROLL_UP ||
event.button.button == ui::SCROLL_DOWN) {
MouseWheelEvent mouse_event(&event);
@@ -565,7 +567,7 @@ void NativeWidgetWayland::OnButtonNotify(ui::WaylandEvent event) {
}
}
-void NativeWidgetWayland::OnKeyNotify(ui::WaylandEvent event) {
+void NativeWidgetWayland::OnKeyNotify(WaylandEvent event) {
KeyEvent key_event(&event);
InputMethod* input_method = GetWidget()->GetInputMethodDirect();
if (input_method)
@@ -574,12 +576,12 @@ void NativeWidgetWayland::OnKeyNotify(ui::WaylandEvent event) {
DispatchKeyEventPostIME(key_event);
}
-void NativeWidgetWayland::OnPointerFocus(ui::WaylandEvent event) {
+void NativeWidgetWayland::OnPointerFocus(WaylandEvent event) {
MouseEvent mouse_event(&event);
delegate_->OnMouseEvent(mouse_event);
}
-void NativeWidgetWayland::OnKeyboardFocus(ui::WaylandEvent event) {
+void NativeWidgetWayland::OnKeyboardFocus(WaylandEvent event) {
InputMethod* input_method = GetWidget()->GetInputMethodDirect();
if (input_method) {
if (event.keyboard_focus.state)
@@ -589,7 +591,7 @@ void NativeWidgetWayland::OnKeyboardFocus(ui::WaylandEvent event) {
}
}
-void NativeWidgetWayland::OnGeometryChange(ui::WaylandEvent event) {
+void NativeWidgetWayland::OnGeometryChange(WaylandEvent event) {
SetSize(gfx::Size(event.geometry_change.width,
event.geometry_change.height));
}
diff --git a/views/widget/native_widget_wayland.h b/views/widget/native_widget_wayland.h
index 8431588..52e29a5 100644
--- a/views/widget/native_widget_wayland.h
+++ b/views/widget/native_widget_wayland.h
@@ -21,6 +21,12 @@
typedef struct _cairo_device cairo_device_t;
typedef struct _cairo_surface cairo_surface_t;
+namespace base {
+namespace wayland {
+union WaylandEvent;
+}
+}
+
namespace gfx {
class Rect;
}
@@ -127,13 +133,13 @@ class NativeWidgetWayland : public internal::NativeWidgetPrivate,
virtual bool ConvertPointFromAncestor(
const Widget* ancestor, gfx::Point* point) const OVERRIDE;
- virtual void OnMotionNotify(ui::WaylandEvent event) OVERRIDE;
- virtual void OnButtonNotify(ui::WaylandEvent event) OVERRIDE;
- virtual void OnKeyNotify(ui::WaylandEvent event) OVERRIDE;
- virtual void OnPointerFocus(ui::WaylandEvent event) OVERRIDE;
- virtual void OnKeyboardFocus(ui::WaylandEvent event) OVERRIDE;
+ virtual void OnMotionNotify(WaylandEvent event) OVERRIDE;
+ virtual void OnButtonNotify(WaylandEvent event) OVERRIDE;
+ virtual void OnKeyNotify(WaylandEvent event) OVERRIDE;
+ virtual void OnPointerFocus(WaylandEvent event) OVERRIDE;
+ virtual void OnKeyboardFocus(WaylandEvent event) OVERRIDE;
- virtual void OnGeometryChange(ui::WaylandEvent event) OVERRIDE;
+ virtual void OnGeometryChange(WaylandEvent event) OVERRIDE;
private:
typedef ScopedVector<ui::ViewProp> ViewProps;
diff --git a/views/widget/tooltip_manager_views.cc b/views/widget/tooltip_manager_views.cc
index d038dd8..1f8fc19 100644
--- a/views/widget/tooltip_manager_views.cc
+++ b/views/widget/tooltip_manager_views.cc
@@ -13,6 +13,7 @@
#include <windowsx.h>
#endif
+#include "base/event_types.h"
#include "base/logging.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
@@ -32,10 +33,6 @@
#include "views/view.h"
#include "views/widget/native_widget.h"
-#if defined(USE_WAYLAND)
-#include "ui/wayland/events/wayland_event.h"
-#endif
-
namespace {
SkColor kTooltipBackground = 0xFF7F7F00;
int kTooltipTimeoutMs = 500;
diff --git a/views/widget/tooltip_manager_views.h b/views/widget/tooltip_manager_views.h
index fe3593e..4cf2657 100644
--- a/views/widget/tooltip_manager_views.h
+++ b/views/widget/tooltip_manager_views.h
@@ -16,9 +16,6 @@
#if defined(USE_X11)
typedef union _XEvent XEvent;
-namespace ui {
-union WaylandEvent;
-}
#endif
namespace views {