| Index: views/events/event.h
|
| diff --git a/views/events/event.h b/views/events/event.h
|
| index 4231598e4c04eae765869dd822a7d813d10a1b7b..cd9e6480eaa955a9ad1f169d000c7d96bb3466e8 100644
|
| --- a/views/events/event.h
|
| +++ b/views/events/event.h
|
| @@ -11,20 +11,31 @@
|
| #include "ui/base/events.h"
|
| #include "ui/base/keycodes/keyboard_codes.h"
|
| #include "ui/gfx/point.h"
|
| -#include "views/native_types.h"
|
| #include "views/views_export.h"
|
|
|
| -#if defined(USE_X11)
|
| -typedef union _XEvent XEvent;
|
| -#endif
|
| -
|
| namespace ui {
|
| class OSExchangeData;
|
| }
|
| -using ui::OSExchangeData;
|
| +
|
| +#if defined(USE_AURA)
|
| +namespace aura {
|
| +class Event;
|
| +}
|
| +#endif
|
| +
|
| +// TODO(msw): Remove GTK support from views event code when possible.
|
| +#if defined(TOOLKIT_USES_GTK)
|
| +typedef union _GdkEvent GdkEvent;
|
| +#endif
|
|
|
| namespace views {
|
|
|
| +#if defined(USE_AURA)
|
| +typedef aura::Event* NativeEvent;
|
| +#else
|
| +typedef ui::NativeEvent NativeEvent;
|
| +#endif
|
| +
|
| class View;
|
|
|
| namespace internal {
|
| @@ -32,11 +43,6 @@ class NativeWidgetView;
|
| class RootView;
|
| }
|
|
|
| -#if defined(OS_WIN) || defined(USE_AURA)
|
| -VIEWS_EXPORT bool IsClientMouseEvent(const views::NativeEvent& native_event);
|
| -VIEWS_EXPORT bool IsNonClientMouseEvent(const views::NativeEvent& native_event);
|
| -#endif
|
| -
|
| ////////////////////////////////////////////////////////////////////////////////
|
| //
|
| // Event class
|
| @@ -51,13 +57,10 @@ VIEWS_EXPORT bool IsNonClientMouseEvent(const views::NativeEvent& native_event);
|
| ////////////////////////////////////////////////////////////////////////////////
|
| class VIEWS_EXPORT Event {
|
| public:
|
| - // This type exists to distinguish between the NativeEvent and NativeEvent2
|
| - // constructors.
|
| - // TODO(beng): remove once we rid views of Gtk/Gdk.
|
| - struct FromNativeEvent2 {};
|
| -
|
| const NativeEvent& native_event() const { return native_event_; }
|
| - const NativeEvent2& native_event_2() const { return native_event_2_; }
|
| +#if defined(TOOLKIT_USES_GTK)
|
| + GdkEvent* gdk_event() const { return gdk_event_; }
|
| +#endif
|
| ui::EventType type() const { return type_; }
|
| const base::Time& time_stamp() const { return time_stamp_; }
|
| int flags() const { return flags_; }
|
| @@ -88,26 +91,15 @@ class VIEWS_EXPORT Event {
|
| type_ == ui::ET_TOUCH_CANCELLED;
|
| }
|
|
|
| -#if defined(OS_WIN) && !defined(USE_AURA)
|
| - // Returns the EventFlags in terms of windows flags.
|
| - int GetWindowsFlags() const;
|
| -#elif defined(OS_LINUX)
|
| - // Get the views::Event flags from a native GdkEvent.
|
| - static int GetFlagsFromGdkEvent(NativeEvent native_event);
|
| -#endif
|
| -
|
| protected:
|
| Event(ui::EventType type, int flags);
|
| - Event(NativeEvent native_event, ui::EventType type, int flags);
|
| - // Because the world is complicated, sometimes we have two different kinds of
|
| - // NativeEvent in play in the same executable. See native_types.h for the tale
|
| - // of woe.
|
| - Event(NativeEvent2 native_event, ui::EventType type, int flags,
|
| - FromNativeEvent2);
|
| + Event(const NativeEvent& native_event, ui::EventType type, int flags);
|
| +#if defined(TOOLKIT_USES_GTK)
|
| + Event(GdkEvent* gdk_event, ui::EventType type, int flags);
|
| +#endif
|
|
|
| Event(const Event& model)
|
| : native_event_(model.native_event()),
|
| - native_event_2_(model.native_event_2()),
|
| type_(model.type()),
|
| time_stamp_(model.time_stamp()),
|
| flags_(model.flags()) {
|
| @@ -118,13 +110,10 @@ class VIEWS_EXPORT Event {
|
| private:
|
| void operator=(const Event&);
|
|
|
| - // Safely initializes the native event members of this class.
|
| - void Init();
|
| - void InitWithNativeEvent(NativeEvent native_event);
|
| - void InitWithNativeEvent2(NativeEvent2 native_event_2, FromNativeEvent2);
|
| -
|
| NativeEvent native_event_;
|
| - NativeEvent2 native_event_2_;
|
| +#if defined(TOOLKIT_USES_GTK)
|
| + GdkEvent* gdk_event_;
|
| +#endif
|
| ui::EventType type_;
|
| base::Time time_stamp_;
|
| int flags_;
|
| @@ -145,8 +134,10 @@ class VIEWS_EXPORT LocatedEvent : public Event {
|
| const gfx::Point& location() const { return location_; }
|
|
|
| protected:
|
| - explicit LocatedEvent(NativeEvent native_event);
|
| - LocatedEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
|
| + explicit LocatedEvent(const NativeEvent& native_event);
|
| +#if defined(TOOLKIT_USES_GTK)
|
| + explicit LocatedEvent(GdkEvent* gdk_event);
|
| +#endif
|
|
|
| // TODO(msw): Kill this legacy constructor when we update uses.
|
| // Simple initialization from cracked metadata.
|
| @@ -175,8 +166,10 @@ class TouchEvent;
|
| ////////////////////////////////////////////////////////////////////////////////
|
| class VIEWS_EXPORT MouseEvent : public LocatedEvent {
|
| public:
|
| - explicit MouseEvent(NativeEvent native_event);
|
| - MouseEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
|
| + explicit MouseEvent(const NativeEvent& native_event);
|
| +#if defined(TOOLKIT_USES_GTK)
|
| + explicit MouseEvent(GdkEvent* gdk_event);
|
| +#endif
|
|
|
| // Create a new MouseEvent which is identical to the provided model.
|
| // If source / target views are provided, the model location will be converted
|
| @@ -188,7 +181,7 @@ class VIEWS_EXPORT MouseEvent : public LocatedEvent {
|
| // mapped from the TouchEvent to appropriate MouseEvent attributes.
|
| // GestureManager uses this to convert TouchEvents that are not handled by any
|
| // view.
|
| - MouseEvent(const TouchEvent& touch, FromNativeEvent2 from_native);
|
| + explicit MouseEvent(const TouchEvent& touch);
|
|
|
| // TODO(msw): Kill this legacy constructor when we update uses.
|
| // Create a new mouse event
|
| @@ -247,7 +240,7 @@ class VIEWS_EXPORT MouseEvent : public LocatedEvent {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| class VIEWS_EXPORT TouchEvent : public LocatedEvent {
|
| public:
|
| - TouchEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
|
| + explicit TouchEvent(const NativeEvent& native_event);
|
|
|
| // Create a new touch event.
|
| TouchEvent(ui::EventType type,
|
| @@ -305,8 +298,10 @@ class VIEWS_EXPORT TouchEvent : public LocatedEvent {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| class VIEWS_EXPORT KeyEvent : public Event {
|
| public:
|
| - explicit KeyEvent(NativeEvent native_event);
|
| - KeyEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
|
| + explicit KeyEvent(const NativeEvent& native_event);
|
| +#if defined(TOOLKIT_USES_GTK)
|
| + explicit KeyEvent(GdkEvent* gdk_event);
|
| +#endif
|
|
|
| // Creates a new KeyEvent synthetically (i.e. not in response to an input
|
| // event from the host environment). This is typically only used in testing as
|
| @@ -381,8 +376,10 @@ class VIEWS_EXPORT MouseWheelEvent : public MouseEvent {
|
| // See |offset| for details.
|
| static const int kWheelDelta;
|
|
|
| - explicit MouseWheelEvent(NativeEvent native_event);
|
| - MouseWheelEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
|
| + explicit MouseWheelEvent(const NativeEvent& native_event);
|
| +#if defined(TOOLKIT_USES_GTK)
|
| + explicit MouseWheelEvent(GdkEvent* gdk_event);
|
| +#endif
|
|
|
| // The amount to scroll. This is in multiples of kWheelDelta.
|
| int offset() const { return offset_; }
|
| @@ -411,7 +408,7 @@ class VIEWS_EXPORT MouseWheelEvent : public MouseEvent {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| class VIEWS_EXPORT DropTargetEvent : public LocatedEvent {
|
| public:
|
| - DropTargetEvent(const OSExchangeData& data,
|
| + DropTargetEvent(const ui::OSExchangeData& data,
|
| int x,
|
| int y,
|
| int source_operations)
|
| @@ -421,12 +418,12 @@ class VIEWS_EXPORT DropTargetEvent : public LocatedEvent {
|
| // TODO(msw): Hook up key state flags for CTRL + drag and drop, etc.
|
| }
|
|
|
| - const OSExchangeData& data() const { return data_; }
|
| + const ui::OSExchangeData& data() const { return data_; }
|
| int source_operations() const { return source_operations_; }
|
|
|
| private:
|
| // Data associated with the drag/drop session.
|
| - const OSExchangeData& data_;
|
| + const ui::OSExchangeData& data_;
|
|
|
| // Bitmask of supported ui::DragDropTypes::DragOperation by the source.
|
| int source_operations_;
|
|
|